esp_alox/goTool/api/uart.go

88 lines
1.4 KiB
Go

package api
// Topics
const (
TopicUARTRx = "uart:rx"
TopicUARTTx = "uart:tx"
TopicUARTError = "uart:error"
TopicOTA = "ota"
)
type Frame struct {
Time uint64
ID byte
Data []byte
}
const (
CmdEcho byte = 0x01
CmdVersion byte = 0x02
CmdClientInfo byte = 0x03
CmdClientInput byte = 0x04
CmdOtaStart byte = 0x10
CmdOtaPayload byte = 0x11
CmdOtaEnd byte = 0x12
CmdOtaStatus byte = 0x13
CmdOtaStartEspNow byte = 0x14
)
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
}
type PayloadOtaStatus struct {
SequenzCounter uint16
WriteIndex uint16
Data []byte
}
type PayloadOtaStart struct {
Data []byte
Parition byte
Error byte
}
type PayloadOtaEnd struct {
Data []byte
}
type PayloadOtaPayload struct {
SequenzCounter uint16
WriteIndex uint16
Data []byte
Error byte
}
type PayloadOtaStartEspNow struct {
Data []byte
}