Add message IDs, transport interface, client package, extract protocol headers
This commit is contained in:
28
lib/client/types.go
Normal file
28
lib/client/types.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user