From 9cab522c06d79311ff413866e3d9d9b8c6c4197a Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Thu, 30 Oct 2025 00:32:52 +0000 Subject: [PATCH] Starting to add UI manipulation commands --- peripheral/communication.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/peripheral/communication.go b/peripheral/communication.go index 057bc3c..bc23dc3 100644 --- a/peripheral/communication.go +++ b/peripheral/communication.go @@ -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) +}