README
¶
hdhomerun
======
Overview
Use this package to connect to and interact with HD HomeRun devices.
Installation
go get github.com/mh-orange/hdhomerun
Examples
Discover devices:
package main
import(
"fmt"
"github.com/mh-orange/hdhomerun"
)
func main() {
for discoverResult := range hdhomerun.Discover(nil, time.Millisecond*200) {
if discoverResult.Err != nil {
fmt.Printf("Error during discovery: %v\n", discoverResult.Err)
} else {
fmt.Printf("hdhomerun device %s found at %s\n", discoverResult.Device.ID(), discoverResult.Device.Addr())
}
}
}
Tune to a channel:
package main
import(
"github.com/mh-orange/hdhomerun"
"net"
)
func main() {
device, _ := hdhomerun.ConnectTCP(&net.TCPAddr{net.IP{192,168,1,100}, 65001, ""})
tuner := device.Tuner(0)
tuner.Tune("auto", 177000000)
}
Scan available channels:
package main
import(
"fmt"
"github.com/mh-orange/hdhomerun"
"net"
)
func main() {
device, _ := hdhomerun.ConnectTCP(&net.TCPAddr{net.IP{192,168,1,100}, 65001, ""})
tuner := device.Tuner(0)
for result := range tuner.Scan() {
if result.Err != nil {
fmt.Printf("Error scanning for channels: %v\n", err)
continue
}
fmt.Printf("Found channel %s\n", result.Channel.Name)
}
}
Documentation
¶
Index ¶
- Constants
- Variables
- func Channels(channelMap string) chan Channel
- func Discover(ip net.IP, timeout time.Duration) chan DiscoverResult
- type Channel
- type Decoder
- type Device
- type DeviceID
- type DiscoverResult
- type Encoder
- type ErrCommunicationError
- type ErrParseError
- type ErrRemoteError
- type ErrWrongPacketType
- type GenericDevice
- type Packet
- type PacketType
- type Program
- type ProgramList
- type ProgramType
- type TCPDevice
- type Tag
- type TagType
- type TagValue
- type TagsMap
- type Tuner
- func (t *Tuner) GetTuner(name string) (TagValue, error)
- func (t *Tuner) Scan() chan Channel
- func (t *Tuner) SetTuner(name, value string) (TagValue, error)
- func (t *Tuner) Status() (*TunerStatus, error)
- func (t *Tuner) Stream(frequency, program int, localAddr *net.UDPAddr) error
- func (t *Tuner) StreamInfo() (TagValue, error)
- func (t *Tuner) Tune(modulation string, frequency int) error
- func (t *Tuner) WaitForLock() (err error)
- type TunerStatus
Constants ¶
View Source
const ( ProgramTypeNormal = iota ProgramTypeNoData ProgramTypeControl ProgramTypeEncrypted )
Variables ¶
View Source
var ( ErrTimeout = fmt.Errorf("Timeout") ErrNoSignal = fmt.Errorf("Signal Strength Too Low") )
View Source
var ( DeviceTypeWildcard []byte = []byte{0xFF, 0xFF, 0xFF, 0xFF} DeviceTypeTuner []byte = []byte{0x00, 0x00, 0x00, 0x01} DeviceTypeStorage []byte = []byte{0x00, 0x00, 0x00, 0x05} DeviceIdWildcard []byte = []byte{0xFF, 0xFF, 0xFF, 0xFF} )
View Source
var (
ErrCrc error = errors.New("Invalid CRC")
)
Functions ¶
Types ¶
type Channel ¶
type Channel struct { Number int Frequency int Modulation string Name string TSID int ONID int Programs []Program }
func (*Channel) ONIDDetected ¶
func (*Channel) TSIDDetected ¶
func (*Channel) UnmarshalText ¶
type DiscoverResult ¶
type ErrCommunicationError ¶
type ErrCommunicationError struct {
ConnectionError error
}
type ErrParseError ¶
type ErrParseError string
func (ErrParseError) Error ¶
func (e ErrParseError) Error() string
type ErrRemoteError ¶
type ErrRemoteError string
func (ErrRemoteError) Error ¶
func (e ErrRemoteError) Error() string
type ErrWrongPacketType ¶
type ErrWrongPacketType string
func (ErrWrongPacketType) Error ¶
func (e ErrWrongPacketType) Error() string
type GenericDevice ¶
type GenericDevice struct {
// contains filtered or unexported fields
}
func NewGenericDevice ¶
func NewGenericDevice(rw io.ReadWriter) *GenericDevice
func (*GenericDevice) Tuner ¶
func (d *GenericDevice) Tuner(n int) *Tuner
type Packet ¶
type Packet struct { Type PacketType Tags TagsMap }
type PacketType ¶
type PacketType uint16
const ( TypeDiscoverReq PacketType = 0x0002 TypeDiscoverRpy PacketType = 0x0003 TypeGetSetReq PacketType = 0x0004 TypeGetSetRpy PacketType = 0x0005 TypeUpgradeReq PacketType = 0x0006 TypeUpgradeRpy PacketType = 0x0007 )
func (PacketType) String ¶
func (pt PacketType) String() string
type Program ¶
type Program struct { Name string Type ProgramType Number int VirtualMajor int VirtualMinor int }
func (*Program) MarshalText ¶
func (*Program) UnmarshalText ¶
type ProgramList ¶
type ProgramList []Program
type ProgramType ¶
type ProgramType int
func (ProgramType) String ¶
func (pt ProgramType) String() string
type TCPDevice ¶
type TCPDevice struct { *net.TCPConn *GenericDevice // contains filtered or unexported fields }
func NewTCPDevice ¶
type TagType ¶
type TagType uint8
const ( TagDeviceType TagType = 0x01 TagDeviceId TagType = 0x02 TagGetSetName TagType = 0x03 TagGetSetValue TagType = 0x04 TagGetSetLockKey TagType = 0x15 TagErrorMsg TagType = 0x05 TagTunerCount TagType = 0x10 TagDeviceAuthBin TagType = 0x29 TagBaseUrl TagType = 0x2A TagDeviceAuthStr TagType = 0x2B )
type Tuner ¶
type Tuner struct {
// contains filtered or unexported fields
}
func (*Tuner) Status ¶
func (t *Tuner) Status() (*TunerStatus, error)
func (*Tuner) StreamInfo ¶
func (*Tuner) WaitForLock ¶
type TunerStatus ¶
type TunerStatus struct { Channel string LockStr string Lock bool SignalStrength int SignalToNoiseQuality int SymbolErrorQuality int BitsPerSecond int PacketsPerSecond int }
func (*TunerStatus) Dump ¶
func (ts *TunerStatus) Dump() string
func (*TunerStatus) MarshalText ¶
func (ts *TunerStatus) MarshalText() ([]byte, error)
func (*TunerStatus) SignalPresent ¶
func (ts *TunerStatus) SignalPresent() bool
func (*TunerStatus) UnmarshalText ¶
func (ts *TunerStatus) UnmarshalText(text []byte) (err error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.