Starting to add UI manipulation commands
This commit is contained in:
@@ -26,6 +26,8 @@ type Command uint8
|
||||
const (
|
||||
CmdRequestID Command = iota
|
||||
CmdAckID
|
||||
CmdCreateScreen
|
||||
CmdCreateWindow
|
||||
)
|
||||
|
||||
type DataReceiver interface {
|
||||
@@ -33,6 +35,11 @@ type DataReceiver interface {
|
||||
Validate(data []byte) bool
|
||||
}
|
||||
|
||||
type WalkieTalkie struct {
|
||||
Serial *serial.Port
|
||||
Cfg *serial.Config
|
||||
}
|
||||
|
||||
func (wt *WalkieTalkie) ReadFramedData(size int, packet any) error {
|
||||
buf := make([]byte, size)
|
||||
|
||||
@@ -65,11 +72,6 @@ func (wt *WalkieTalkie) ReadFramedData(size int, packet any) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type WalkieTalkie struct {
|
||||
Serial *serial.Port
|
||||
Cfg *serial.Config
|
||||
}
|
||||
|
||||
func (wt *WalkieTalkie) TurnOn() error {
|
||||
var err error
|
||||
|
||||
@@ -99,3 +101,7 @@ func (wt *WalkieTalkie) RequestIdentification() (int, error) {
|
||||
func (wt *WalkieTalkie) AknowledgeIdentification() (int, error) {
|
||||
return wt.Serial.Write([]byte{uint8(CmdAckID)})
|
||||
}
|
||||
|
||||
func (wt *WalkieTalkie) SendCommand(payload []byte) (int, error) {
|
||||
return wt.Serial.Write(payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user