mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-03-01 10:54:17 +01:00
Add detection of radio poweroff
This commit is contained in:
parent
334583ce44
commit
3731871cc7
|
|
@ -174,7 +174,7 @@ func (s *controlStream) handleRead(r []byte) error {
|
|||
}
|
||||
}
|
||||
case 80:
|
||||
if bytes.Equal(r[:6], []byte{0x50, 0x00, 0x00, 0x00, 0x00, 0x00}) && bytes.Equal(r[48:51], []byte{0xff, 0xff, 0xff}) {
|
||||
if bytes.Equal(r[:6], []byte{0x50, 0x00, 0x00, 0x00, 0x00, 0x00}) {
|
||||
// Example answer from radio: 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
|
||||
// 0x86, 0x1f, 0x2f, 0xcc, 0x03, 0x03, 0x89, 0x29,
|
||||
// 0x00, 0x00, 0x00, 0x40, 0x02, 0x03, 0x00, 0x52,
|
||||
|
|
@ -186,7 +186,12 @@ func (s *controlStream) handleRead(r []byte) error {
|
|||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
return errors.New("auth failed")
|
||||
if bytes.Equal(r[48:51], []byte{0xff, 0xff, 0xff}) {
|
||||
return errors.New("auth failed")
|
||||
}
|
||||
if bytes.Equal(r[48:51], []byte{0x00, 0x00, 0x00}) && r[64] == 0x01 {
|
||||
return errors.New("got radio disconnected")
|
||||
}
|
||||
}
|
||||
case 144:
|
||||
if !s.serialAndAudioStreamOpened && bytes.Equal(r[:6], []byte{0x90, 0x00, 0x00, 0x00, 0x00, 0x00}) && r[96] == 1 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue