Documentation
¶
Index ¶
- Constants
- type Alarm
- type AlarmStatus
- type AlarmStatusReply
- type AlarmStatusRequest
- type Client
- type DeviceInitStatusBroadcast
- type DeviceStatus
- type EntityType
- type MessageType
- type OpCode
- type Packet
- type PacketHandler
- type RadioStatusReply
- type RadioStatusRequest
- type StatusType
- type UnknownPacket
- type VersionInfoReply
- type VersionInfoRequest
Constants ¶
const ( // Request is an XCMP request for data Request MessageType = 0x00 // Reply is an XCMP reply to a request Reply MessageType = 0x80 // Broadcast is an XCMP message to everyone Broadcast MessageType = 0xB0 OpCodeRadioStatus OpCode = 0x00E OpCodeVersionInfo OpCode = 0x00F OpCodeDeviceInitStatus OpCode = 0x400 OpCodeDisplayText OpCode = 0x401 OpCodeAlarm OpCode = 0x42E )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlarmStatus ¶
AlarmStatus an alarm status
func (AlarmStatus) ToArray ¶
func (p AlarmStatus) ToArray() []byte
ToArray converts and AlarmStatus to an array
type AlarmStatusReply ¶
type AlarmStatusReply struct { OpCode OpCode Alarms []AlarmStatus // contains filtered or unexported fields }
AlarmStatusReply a reply of the radio status
func NewAlarmStatusReplyByArray ¶
func NewAlarmStatusReplyByArray(data []byte) AlarmStatusReply
NewAlarmStatusReplyByArray create an data packet from data array
func NewAlarmStatusReplyByParam ¶
func NewAlarmStatusReplyByParam(EntityType EntityType, alarms []AlarmStatus) AlarmStatusReply
NewAlarmStatusReplyByParam create an data packet from data array
func (AlarmStatusReply) GetMessageType ¶
func (p AlarmStatusReply) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (AlarmStatusReply) GetOpCode ¶
func (p AlarmStatusReply) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (AlarmStatusReply) ToArray ¶
func (p AlarmStatusReply) ToArray() []byte
ToArray converts a packet to a byte array
type AlarmStatusRequest ¶
type AlarmStatusRequest struct {
OpCode OpCode
}
AlarmStatusRequest a request for radio status
func NewAlarmStatusRequestByArray ¶
func NewAlarmStatusRequestByArray(data []byte) AlarmStatusRequest
NewAlarmStatusRequestByArray create an data packet from data array
func NewAlarmStatusRequestByParam ¶
func NewAlarmStatusRequestByParam() AlarmStatusRequest
NewAlarmStatusRequestByParam create an data packet from data array
func (AlarmStatusRequest) GetMessageType ¶
func (p AlarmStatusRequest) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (AlarmStatusRequest) GetOpCode ¶
func (p AlarmStatusRequest) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (AlarmStatusRequest) ToArray ¶
func (p AlarmStatusRequest) ToArray() []byte
ToArray converts a packet to a byte array
type Client ¶
type Client struct { PacketsIn chan Packet Version string EntityType EntityType // contains filtered or unexported fields }
Client descripes a XCMP Client
func (*Client) RegisterHandler ¶
func (c *Client) RegisterHandler(messagetype MessageType, opcode OpCode, handlerFunc PacketHandler)
RegisterHandler registers a function to be called anytime a certain packet type is recieved
func (*Client) SendAndWaitForRadioStatusReply ¶
func (c *Client) SendAndWaitForRadioStatusReply(status StatusType) RadioStatusReply
SendAndWaitForRadioStatusReply waits for a radio status reply packet with a certain status type
func (*Client) SendPacket ¶
SendPacket sends an XCMP protocol packet to the radio
type DeviceInitStatusBroadcast ¶
type DeviceInitStatusBroadcast struct { OpCode OpCode MajorVersion byte MinorVersion byte RevVersion byte EntityType EntityType InitComplete bool Status DeviceStatus }
DeviceInitStatusBroadcast a broadcast of the device init status
func NewDeviceInitStatusBroadcastByArray ¶
func NewDeviceInitStatusBroadcastByArray(data []byte) DeviceInitStatusBroadcast
NewDeviceInitStatusBroadcastByArray create an data packet from data array
func NewDeviceInitStatusBroadcastByParam ¶
func NewDeviceInitStatusBroadcastByParam(EntityType EntityType, InitComplete bool, status DeviceStatus) DeviceInitStatusBroadcast
NewDeviceInitStatusBroadcastByParam create an data packet from data array
func (DeviceInitStatusBroadcast) GetMessageType ¶
func (p DeviceInitStatusBroadcast) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (DeviceInitStatusBroadcast) GetOpCode ¶
func (p DeviceInitStatusBroadcast) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (DeviceInitStatusBroadcast) ToArray ¶
func (p DeviceInitStatusBroadcast) ToArray() []byte
ToArray converts a packet to a byte array
type DeviceStatus ¶
DeviceStatus is the status of a child device
func (*DeviceStatus) FromArray ¶
func (d *DeviceStatus) FromArray(data []byte)
FromArray converts an array to a DeviceStatus
func (*DeviceStatus) ToArray ¶
func (d *DeviceStatus) ToArray() []byte
ToArray converts a DeviceStatus to an array
type OpCode ¶
type OpCode uint16
OpCode is the operation of the XCMP message
func CombinedOpCode ¶
func CombinedOpCode(mt MessageType, opCode OpCode) OpCode
CombinedOpCode combines the message type and opcode
type Packet ¶
type Packet interface { GetMessageType() MessageType GetOpCode() OpCode ToArray() []byte }
Packet is an XCMP packet
func CreatePacketFromArray ¶
CreatePacketFromArray creates a XCMP packet from an array
type PacketHandler ¶
PacketHandler is a function to handle a particular type of packet
type RadioStatusReply ¶
type RadioStatusReply struct { OpCode OpCode Status StatusType Data []byte // contains filtered or unexported fields }
RadioStatusReply a reply of the radio status
func NewRadioStatusReplyByArray ¶
func NewRadioStatusReplyByArray(data []byte) RadioStatusReply
NewRadioStatusReplyByArray create an data packet from data array
func NewRadioStatusReplyByParam ¶
func NewRadioStatusReplyByParam(EntityType EntityType, status StatusType, data []byte) RadioStatusReply
NewRadioStatusReplyByParam create an data packet from data array
func (RadioStatusReply) GetMessageType ¶
func (p RadioStatusReply) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (RadioStatusReply) GetOpCode ¶
func (p RadioStatusReply) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (RadioStatusReply) ToArray ¶
func (p RadioStatusReply) ToArray() []byte
ToArray converts a packet to a byte array
type RadioStatusRequest ¶
type RadioStatusRequest struct { OpCode OpCode Status StatusType }
RadioStatusRequest a request for radio status
func NewRadioStatusRequestByArray ¶
func NewRadioStatusRequestByArray(data []byte) RadioStatusRequest
NewRadioStatusRequestByArray create an data packet from data array
func NewRadioStatusRequestByParam ¶
func NewRadioStatusRequestByParam(status StatusType) RadioStatusRequest
NewRadioStatusRequestByParam create an data packet from data array
func (RadioStatusRequest) GetMessageType ¶
func (p RadioStatusRequest) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (RadioStatusRequest) GetOpCode ¶
func (p RadioStatusRequest) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (RadioStatusRequest) ToArray ¶
func (p RadioStatusRequest) ToArray() []byte
ToArray converts a packet to a byte array
type StatusType ¶
type StatusType byte
StatusType is the status type
const ( RSSI StatusType = 0x02 ModelNumber StatusType = 0x07 SerialNumber StatusType = 0x0B RadioAlias StatusType = 0x0F )
type UnknownPacket ¶
UnknownPacket an unknown packet
func NewUnkownPacketByArray ¶
func NewUnkownPacketByArray(data []byte) UnknownPacket
NewUnkownPacketByArray create an data packet from data array
func (UnknownPacket) GetMessageType ¶
func (p UnknownPacket) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (UnknownPacket) GetOpCode ¶
func (p UnknownPacket) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (UnknownPacket) ToArray ¶
func (p UnknownPacket) ToArray() []byte
ToArray converts a packet to a byte array
type VersionInfoReply ¶
type VersionInfoReply struct { OpCode OpCode Version string // contains filtered or unexported fields }
VersionInfoReply a reply of the radio version
func NewVersionInfoReplyByArray ¶
func NewVersionInfoReplyByArray(data []byte) VersionInfoReply
NewVersionInfoReplyByArray create an data packet from data array
func NewVersionInfoReplyReplyByParam ¶
func NewVersionInfoReplyReplyByParam(version string) VersionInfoReply
NewVersionInfoReplyReplyByParam create an data packet from data array
func (VersionInfoReply) GetMessageType ¶
func (p VersionInfoReply) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (VersionInfoReply) GetOpCode ¶
func (p VersionInfoReply) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (VersionInfoReply) ToArray ¶
func (p VersionInfoReply) ToArray() []byte
ToArray converts a packet to a byte array
type VersionInfoRequest ¶
type VersionInfoRequest struct {
OpCode OpCode
}
VersionInfoRequest a request for radio status
func NewVersionInfoRequestByArray ¶
func NewVersionInfoRequestByArray(data []byte) VersionInfoRequest
NewVersionInfoRequestByArray create an data packet from data array
func NewVersionInfoRequestByParam ¶
func NewVersionInfoRequestByParam() VersionInfoRequest
NewVersionInfoRequestByParam create an data packet from data array
func (VersionInfoRequest) GetMessageType ¶
func (p VersionInfoRequest) GetMessageType() MessageType
GetMessageType returns the message type for the packet
func (VersionInfoRequest) GetOpCode ¶
func (p VersionInfoRequest) GetOpCode() OpCode
GetOpCode returns the message opcode for the packet
func (VersionInfoRequest) ToArray ¶
func (p VersionInfoRequest) ToArray() []byte
ToArray converts a packet to a byte array