diff --git a/aprsd/packets/core.py b/aprsd/packets/core.py index 560423d..9337844 100644 --- a/aprsd/packets/core.py +++ b/aprsd/packets/core.py @@ -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) diff --git a/tests/test_packets.py b/tests/test_packets.py index 15f1433..9080591 100644 --- a/tests/test_packets.py +++ b/tests/test_packets.py @@ -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)