mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-01-01 14:30:00 +01:00
Only check losses in pkt7 req/replies from us
This commit is contained in:
parent
bfb7789996
commit
aad9b54e3d
|
|
@ -35,12 +35,12 @@ func (s *controlStream) sendPkt7(replyID []byte, seq uint16) {
|
|||
replyID[1] = randID[1]
|
||||
replyID[2] = s.randIDByteForPktSeven[0]
|
||||
replyID[3] = 0x03
|
||||
|
||||
s.expectedPkt7ReplySeq = s.common.sendSeq
|
||||
} else {
|
||||
replyFlag = 0x01
|
||||
}
|
||||
|
||||
s.expectedPkt7ReplySeq = s.common.sendSeq
|
||||
|
||||
s.common.send([]byte{0x15, 0x00, 0x00, 0x00, 0x07, 0x00, byte(seq), byte(seq >> 8),
|
||||
byte(s.common.localSID >> 24), byte(s.common.localSID >> 16), byte(s.common.localSID >> 8), byte(s.common.localSID),
|
||||
byte(s.common.remoteSID >> 24), byte(s.common.remoteSID >> 16), byte(s.common.remoteSID >> 8), byte(s.common.remoteSID),
|
||||
|
|
@ -160,15 +160,15 @@ func (s *controlStream) sendRequestSerialAndAudio() {
|
|||
func (s *controlStream) handleRead(r []byte) {
|
||||
switch len(r) {
|
||||
case 21:
|
||||
if bytes.Equal(r[1:6], []byte{0x00, 0x00, 0x00, 0x07, 0x00}) {
|
||||
if bytes.Equal(r[1:6], []byte{0x00, 0x00, 0x00, 0x07, 0x00}) { // Note that the first byte can be 0x15 or 0x00, so we ignore that.
|
||||
gotSeq := binary.LittleEndian.Uint16(r[6:8])
|
||||
if r[16] == 0x00 { // This is a pkt7 request from the radio.
|
||||
// Replying to the radio.
|
||||
// Example request from radio: 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x1c, 0x0e, 0xe4, 0x35, 0xdd, 0x72, 0xbe, 0xd9, 0xf2, 0x63, 0x00, 0x57, 0x2b, 0x12, 0x00
|
||||
// Example answer from PC: 0x15, 0x00, 0x00, 0x00, 0x07, 0x00, 0x1c, 0x0e, 0xbe, 0xd9, 0xf2, 0x63, 0xe4, 0x35, 0xdd, 0x72, 0x01, 0x57, 0x2b, 0x12, 0x00
|
||||
s.sendPkt7(r[17:21], gotSeq)
|
||||
} else {
|
||||
if s.expectedPkt7ReplySeq != gotSeq { // TODO
|
||||
} else { // This is a pkt7 reply to our request.
|
||||
if s.expectedPkt7ReplySeq != gotSeq {
|
||||
var missingPkts int
|
||||
if gotSeq > s.expectedPkt7ReplySeq {
|
||||
missingPkts = int(gotSeq) - int(s.expectedPkt7ReplySeq)
|
||||
|
|
|
|||
Loading…
Reference in a new issue