1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-18 06:11:49 -05:00

Fix for micE packet decoding with mbits

This commit is contained in:
Hemna 2024-03-20 16:12:18 -04:00
parent eada5e9ce2
commit 386d2bea62
2 changed files with 12 additions and 2 deletions

View File

@ -463,8 +463,10 @@ class MicEPacket(GPSPacket):
# 0 to 360
course: int = 0
def _build_payload(self):
raise NotImplementedError
@staticmethod
def from_aprslib_dict(raw: dict) -> "MicEPacket":
raw = _translate_fields(raw)
return MicEPacket(**raw)
@dataclass
@ -768,4 +770,6 @@ def factory(raw_packet: dict) -> type[Packet]:
else:
raise Exception(f"Unknown packet type {packet_type} {raw}")
print(f"factory({packet_type}): {class_name} {raw}")
return class_name.from_aprslib_dict(raw)

View File

@ -130,3 +130,9 @@ class TestPluginBase(unittest.TestCase):
packet_dict = aprslib.parse(packet_raw)
packet = packets.factory(packet_dict)
self.assertIsInstance(packet, packets.WeatherPacket)
def test_mice_factory(self):
packet_raw = 'kh2sr-15>S7TSYR,WIDE1-1,WIDE2-1,qAO,KO6KL-1:`1`7\x1c\x1c.#/`"4,}QuirkyQRP 4.6V 35.3C S06'
packet_dict = aprslib.parse(packet_raw)
packet = packets.factory(packet_dict)
self.assertIsInstance(packet, packets.MicEPacket)