53 lines
844 B
Go
53 lines
844 B
Go
package api
|
|
|
|
// Topics
|
|
const (
|
|
TopicUARTRx = "uart:rx"
|
|
TopicUARTTx = "uart:tx"
|
|
TopicUARTError = "uart:error"
|
|
)
|
|
|
|
type Frame struct {
|
|
Time uint64
|
|
ID byte
|
|
Data []byte
|
|
}
|
|
|
|
const (
|
|
CmdEcho byte = 0x01
|
|
CmdVersion byte = 0x02
|
|
CmdClientInfo byte = 0x03
|
|
CmdClientInput byte = 0x04
|
|
)
|
|
|
|
const (
|
|
ClientCountOffset = 1
|
|
|
|
// Payload Sizes
|
|
PayloadVersionSize = 10
|
|
PayloadClientInfoSize = 19
|
|
PayloadClientInputSize = 13
|
|
)
|
|
|
|
type PayloadVersion struct {
|
|
Version uint16
|
|
Buildhash [7]uint8
|
|
}
|
|
|
|
type PayloadClientInfo struct {
|
|
ClientID uint8
|
|
IsAvailable uint8
|
|
SlotIsUsed uint8
|
|
MACAddr [6]uint8
|
|
LastPing uint32
|
|
LastSuccessfulPing uint32
|
|
Version uint16
|
|
}
|
|
|
|
type PayloadClientInput struct {
|
|
ClientID byte
|
|
X float32
|
|
Y float32
|
|
InputMask uint32
|
|
}
|