Documentation
¶
Index ¶
- func CreateCommand(command string) C.cec_command
- func CreateCommandString(cmd *C.cec_command) string
- func GetKeyCodeByName(name string) int
- func GetLogicalAddressByName(name string) int
- func GetLogicalNameByAddress(addr int) string
- func GetVendorByID(id uint64) string
- type Command
- type Connection
- func (c *Connection) Close()
- func (c *Connection) Destroy()
- func (c *Connection) GetActiveDevices() [16]bool
- func (c *Connection) GetDeviceOSDName(address int) string
- func (c *Connection) GetDevicePhysicalAddress(address int) string
- func (c *Connection) GetDevicePowerStatus(address int) string
- func (c *Connection) GetDeviceVendorID(address int) uint64
- func (c *Connection) IsActiveSource(address int) bool
- func (c *Connection) Key(address int, key interface{})
- func (c *Connection) KeyPress(address int, key int) error
- func (c *Connection) KeyRelease(address int) error
- func (c *Connection) List() map[string]Device
- func (c *Connection) Mute() error
- func (c *Connection) Ping() int
- func (c *Connection) PollDevice(address int) string
- func (c *Connection) PowerOn(address int) error
- func (c *Connection) RescanDevices()
- func (c *Connection) SetActiveSource(device_type int) bool
- func (c *Connection) SetOSDString(address int, str string) error
- func (c *Connection) Standby(address int) error
- func (c *Connection) Transmit(command string)
- func (c *Connection) VolumeDown() error
- func (c *Connection) VolumeUp() error
- type DataPacket
- type Device
- type KeyPress
- type SourceActivation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCommand ¶
func CreateCommand(command string) C.cec_command
func CreateCommandString ¶
func CreateCommandString(cmd *C.cec_command) string
func GetKeyCodeByName ¶
GetKeyCodeByName - get the keycode by its name
func GetLogicalAddressByName ¶
GetLogicalAddressByName - get logical address by its name
func GetLogicalNameByAddress ¶
GetLogicalNameByAddress - get logical name by address
Types ¶
type Command ¶
type Command struct { Initiator uint32 /**< the logical address of the initiator of this message */ Destination uint32 /**< the logical address of the destination of this message */ Ack int8 /**< 1 when the ACK bit is set, 0 otherwise */ Eom int8 /**< 1 when the EOM bit is set, 0 otherwise */ Opcode int /**< the opcode of this message */ Parameters DataPacket /**< the parameters attached to this message */ OpcodeSet int8 /**< 1 when an opcode is set, 0 otherwise (POLL message) */ TransmitTimeout int32 /**< the timeout to use in ms */ Operation string CommandString string }
type Connection ¶
type Connection struct { Commands chan *Command KeyPresses chan *KeyPress Messages chan string SourceActivations chan *SourceActivation MenuActivations chan bool // contains filtered or unexported fields }
Connection class
func Open ¶
func Open(name string, deviceName string) (*Connection, error)
Open - open a new connection to the CEC device with the given name
func (*Connection) GetActiveDevices ¶
func (c *Connection) GetActiveDevices() [16]bool
GetActiveDevices - returns an array of active devices
func (*Connection) GetDeviceOSDName ¶
func (c *Connection) GetDeviceOSDName(address int) string
GetDeviceOSDName - get the OSD name of the specified device
func (*Connection) GetDevicePhysicalAddress ¶
func (c *Connection) GetDevicePhysicalAddress(address int) string
GetDevicePhysicalAddress - Get the physical address of the device at the given logical address
func (*Connection) GetDevicePowerStatus ¶
func (c *Connection) GetDevicePowerStatus(address int) string
GetDevicePowerStatus - Get the power status of the device at the given address
func (*Connection) GetDeviceVendorID ¶
func (c *Connection) GetDeviceVendorID(address int) uint64
GetDeviceVendorID - Get the Vendor-ID of the device at the given address
func (*Connection) IsActiveSource ¶
func (c *Connection) IsActiveSource(address int) bool
IsActiveSource - check if the device at the given address is the active source
func (*Connection) Key ¶
func (c *Connection) Key(address int, key interface{})
Key - send key press and release commands (hold key for 10ms) to the device at the given address, the key code can be specified as a hex-code or by its name
func (*Connection) KeyPress ¶
func (c *Connection) KeyPress(address int, key int) error
KeyPress - send a key press (down) command code to the given address
func (*Connection) KeyRelease ¶
func (c *Connection) KeyRelease(address int) error
KeyRelease - send a key releas command to the given address
func (*Connection) List ¶
func (c *Connection) List() map[string]Device
List - list active devices (returns a map of Devices)
func (*Connection) Mute ¶
func (c *Connection) Mute() error
Mute - send a mute/unmute command to the amp if present
func (*Connection) Ping ¶
func (c *Connection) Ping() int
func (*Connection) PollDevice ¶
func (c *Connection) PollDevice(address int) string
Poll device - poll the device at the given logical address
func (*Connection) PowerOn ¶
func (c *Connection) PowerOn(address int) error
PowerOn - power on the device with the given logical address
func (*Connection) SetActiveSource ¶
func (c *Connection) SetActiveSource(device_type int) bool
SetActiveSource
func (*Connection) SetOSDString ¶
func (c *Connection) SetOSDString(address int, str string) error
func (*Connection) Standby ¶
func (c *Connection) Standby(address int) error
Standby - put the device with the given address in standby mode
func (*Connection) Transmit ¶
func (c *Connection) Transmit(command string)
Transmit CEC command - command is encoded as a hex string with colons (e.g. "40:04")
func (*Connection) VolumeDown ¶
func (c *Connection) VolumeDown() error
VolumeDown - send a volume down command to the amp if present
func (*Connection) VolumeUp ¶
func (c *Connection) VolumeUp() error
VolumeUp - send a volume up command to the amp if present
type DataPacket ¶
type DataPacket struct { Data interface{} Size int }
type Device ¶
type Device struct { OSDName string Vendor string LogicalAddress int ActiveSource bool PowerStatus string PhysicalAddress string }
Device structure