- UbxReceiver: added catch all
This commit is contained in:
+6
-3
@@ -16,7 +16,7 @@ from nmea.GGA import Gga
|
||||
from nmea.RMC import Rmc
|
||||
from threading import Thread
|
||||
from queue import Queue
|
||||
|
||||
from ubx.ubx import frame_create
|
||||
|
||||
class NetworkBackend(ABackend):
|
||||
def __init__(self, servers: list[dict]):
|
||||
@@ -145,9 +145,10 @@ if __name__ == "__main__":
|
||||
Gga(grm, 'GN'),
|
||||
]
|
||||
ubx_rx_list = [
|
||||
UbxReceiver('UBX-NAV-SIG', 0x01, 0x43),
|
||||
# UbxReceiver('UBX-NAV-SIG', 0x01, 0x43),
|
||||
UbxReceiver('UBX-ACK-ACK', 0x05, 0x01),
|
||||
UbxReceiver('UBX-ACK-NACK', 0x05, 0x00),
|
||||
UbxReceiver('default'),
|
||||
]
|
||||
|
||||
# Topology
|
||||
@@ -190,7 +191,9 @@ if __name__ == "__main__":
|
||||
while True:
|
||||
try:
|
||||
for grm in [" neo-f9p", "zed-x20p"]:
|
||||
transceiver[grm].send(b'Hallo')
|
||||
# Poll UBX-NAV-CLOCK (0x01 0x22)
|
||||
frame = frame_create(0x01, 0x22, b'')
|
||||
transceiver[grm].send(frame)
|
||||
except ValueError:
|
||||
break
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from msg_sink import MsgSink
|
||||
from ubx.ubx import frame_parse, frame_parse_hdr
|
||||
|
||||
class UbxReceiver(MsgSink):
|
||||
def __init__(self, name: str, mclass: int, mid: int):
|
||||
def __init__(self, name: str, mclass: int|None = None, mid: int|None = None):
|
||||
MsgSink.__init__(self)
|
||||
self.name = name
|
||||
self.mclass = mclass
|
||||
@@ -16,5 +16,8 @@ class UbxReceiver(MsgSink):
|
||||
def is_msg(self, msg: MsgContainer):
|
||||
hdr = frame_parse_hdr(msg.data)
|
||||
if hdr is not None:
|
||||
return self.mclass == hdr.mclass and self.mid == hdr.mid
|
||||
if self.mclass is not None and self.mid is not None:
|
||||
return self.mclass == hdr.mclass and self.mid == hdr.mid
|
||||
else:
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user