2026-04-03 17:41:44 +09:00
|
|
|
package client
|
|
|
|
|
|
|
|
|
|
import "github.com/theater/picomap/lib/msgpack"
|
|
|
|
|
|
2026-04-03 17:44:32 +09:00
|
|
|
type RequestPICOBOOT struct{}
|
2026-04-04 15:09:16 +09:00
|
|
|
type ResponsePICOBOOT struct{}
|
2026-04-03 17:41:44 +09:00
|
|
|
|
2026-04-04 15:00:16 +09:00
|
|
|
type RequestInfo struct{}
|
|
|
|
|
type ResponseInfo struct {
|
2026-04-06 20:09:30 +09:00
|
|
|
BoardID [8]byte
|
|
|
|
|
MAC [6]byte
|
2026-04-07 06:58:39 +09:00
|
|
|
IP [4]byte
|
2026-04-06 20:09:30 +09:00
|
|
|
FirmwareName string
|
2026-04-04 15:00:16 +09:00
|
|
|
}
|
|
|
|
|
|
2026-04-07 06:58:39 +09:00
|
|
|
type RequestTest struct {
|
|
|
|
|
Name string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ResponseTest struct {
|
|
|
|
|
Pass bool
|
|
|
|
|
Messages []string
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-03 17:41:44 +09:00
|
|
|
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))
|
2026-04-04 15:09:16 +09:00
|
|
|
msgpack.RegisterExt(1, (*DeviceError)(nil))
|
2026-04-03 17:44:32 +09:00
|
|
|
msgpack.RegisterExt(2, (*RequestPICOBOOT)(nil))
|
2026-04-04 15:09:16 +09:00
|
|
|
msgpack.RegisterExt(3, (*ResponsePICOBOOT)(nil))
|
2026-04-04 15:00:16 +09:00
|
|
|
msgpack.RegisterExt(4, (*RequestInfo)(nil))
|
|
|
|
|
msgpack.RegisterExt(5, (*ResponseInfo)(nil))
|
2026-04-07 06:58:39 +09:00
|
|
|
msgpack.RegisterExt(127, (*RequestTest)(nil))
|
|
|
|
|
msgpack.RegisterExt(126, (*ResponseTest)(nil))
|
2026-04-03 17:41:44 +09:00
|
|
|
}
|