Add message IDs, transport interface, client package, extract protocol headers

This commit is contained in:
Ian Gulliver
2026-04-03 17:41:44 +09:00
parent 302f7fdb6a
commit 64953ef985
10 changed files with 251 additions and 152 deletions

28
lib/client/types.go Normal file
View File

@@ -0,0 +1,28 @@
package client
import "github.com/theater/picomap/lib/msgpack"
type ResponseBOOTSEL struct{}
type RequestBOOTSEL struct{}
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, (*ResponseBOOTSEL)(nil))
msgpack.RegisterExt(2, (*RequestBOOTSEL)(nil))
msgpack.RegisterExt(3, (*DeviceError)(nil))
}