Added some basic command handling for the devices

This commit is contained in:
2025-12-22 23:06:33 +00:00
parent b3c3d4fbac
commit af3322bc9f
7 changed files with 176 additions and 50 deletions
+5 -17
View File
@@ -65,28 +65,16 @@ func (p *PeripheralDevice) Probe() error {
return err
}
// Papers, please!
_, err = p.WT.RequestIdentification()
if err != nil {
return err
}
// Verify the papers
var pkt pack.IdentificationPacket
err = pkt.Read(p.WT)
if err != nil {
// Throw the man in the gulag!
return err
}
// Acknowledge successful identification
_, err = p.WT.AknowledgeIdentification()
// Send the identification command
cmd := comm.CmdRequestID
var response pack.IdentificationPacket
err = p.WT.SendCommand(cmd, []byte{}, &response)
if err != nil {
return err
}
// copy the data
p.Merge(&pkt)
p.Merge(&response)
p.ToConnectedIdling()
return nil