xcmp

package
v0.0.0-...-7f53359 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
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 Alarm

type Alarm byte

Alarm is the alarm number

const (
	AlarmTransmit     Alarm = 1
	AlarmReceive      Alarm = 2
	AlarmTemp         Alarm = 3
	AlarmAC           Alarm = 4
	AlarmFan          Alarm = 5
	AlarmVSWR         Alarm = 20
	AlarmTrasmitPower Alarm = 23
	AlarmUnknown1     Alarm = 81
)

type AlarmStatus

type AlarmStatus struct {
	Severity byte
	State    byte
	Alarm    Alarm
	Unknown  []byte
}

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 NewClient

func NewClient(client *xnl.Client) *Client

NewClient creates a new Client instance

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

func (c *Client) SendPacket(pkt Packet)

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

type DeviceStatus struct {
	DeviceType   byte
	DeviceStatus uint16
	Descriptor   map[byte]byte
}

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 EntityType

type EntityType byte

EntityType reprsents the kind of XCMP entity

type MessageType

type MessageType byte

MessageType is the type of the XCMP message

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

func CreatePacketFromArray(array []byte) Packet

CreatePacketFromArray creates a XCMP packet from an array

type PacketHandler

type PacketHandler func(Packet) bool

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

type UnknownPacket struct {
	OpCode  OpCode
	Payload []byte
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL