package client import "github.com/theater/picomap/lib/msgpack" type RequestPICOBOOT struct{} type ResponsePICOBOOT struct{} type RequestInfo struct{} type BootReason uint8 const ( BootCold BootReason = 0 BootReboot BootReason = 1 BootWatchdog BootReason = 2 ) func (b BootReason) String() string { switch b { case BootCold: return "cold" case BootReboot: return "reboot" case BootWatchdog: return "watchdog" default: return "unknown" } } type ResponseInfo struct { BoardID [8]byte MAC [6]byte IP [4]byte FirmwareName string Boot BootReason BuildEpoch uint32 } type RequestLog struct{} type LogEntry struct { TimestampUS uint32 Message string } type ResponseLog struct { Entries []LogEntry } type RequestFlashErase struct { Addr uint32 Len uint32 } type ResponseFlashErase struct{} type RequestFlashWrite struct { Addr uint32 Data []byte } type ResponseFlashWrite struct{} type RequestReboot struct{} type ResponseReboot struct{} type RequestFlashStatus struct{} type ResponseFlashStatus struct { BootPartition int8 BootType uint8 } type RequestListTests struct{} type ResponseListTests struct { Names []string } type RequestTest struct { Name string } type ResponseTest struct { Pass bool Messages []string } type DeviceError struct { Code uint32 Message string } func (e *DeviceError) Error() string { return e.Message } type Envelope struct { MessageID uint32 Checksum uint32 Payload []byte } func init() { msgpack.RegisterExt(0, (*Envelope)(nil)) msgpack.RegisterExt(1, (*DeviceError)(nil)) msgpack.RegisterExt(2, (*RequestPICOBOOT)(nil)) msgpack.RegisterExt(3, (*ResponsePICOBOOT)(nil)) msgpack.RegisterExt(4, (*RequestInfo)(nil)) msgpack.RegisterExt(5, (*ResponseInfo)(nil)) msgpack.RegisterExt(6, (*RequestLog)(nil)) msgpack.RegisterExt(7, (*ResponseLog)(nil)) msgpack.RegisterExt(8, (*RequestFlashErase)(nil)) msgpack.RegisterExt(9, (*ResponseFlashErase)(nil)) msgpack.RegisterExt(10, (*RequestFlashWrite)(nil)) msgpack.RegisterExt(11, (*ResponseFlashWrite)(nil)) msgpack.RegisterExt(12, (*RequestReboot)(nil)) msgpack.RegisterExt(13, (*ResponseReboot)(nil)) msgpack.RegisterExt(14, (*RequestFlashStatus)(nil)) msgpack.RegisterExt(15, (*ResponseFlashStatus)(nil)) msgpack.RegisterExt(125, (*RequestListTests)(nil)) msgpack.RegisterExt(124, (*ResponseListTests)(nil)) msgpack.RegisterExt(127, (*RequestTest)(nil)) msgpack.RegisterExt(126, (*ResponseTest)(nil)) }