X-Git-Url: http://www.average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Fbeesure.py;h=9c10286e178769b9bc31aaf465cd0388d3ef52cc;hb=e4f6256a6cd5a80e9afcaaa4033fa40d4d0b7ee9;hp=a0d802bb1df306e888e87218028241210ffd5695;hpb=5ef83cb7db7464a5a625b0b7c86c4e25ebbb0de1;p=loctrkd.git diff --git a/loctrkd/beesure.py b/loctrkd/beesure.py index a0d802b..9c10286 100755 --- a/loctrkd/beesure.py +++ b/loctrkd/beesure.py @@ -26,9 +26,9 @@ __all__ = ( "class_by_prefix", "enframe", "inline_response", + "proto_handled", "parse_message", "probe_buffer", - "proto_by_name", "proto_name", "DecodeError", "Respond", @@ -320,7 +320,10 @@ class LK(BeeSurePkt): class CONFIG(BeeSurePkt): PROTO = "CONFIG" - RESPOND = Respond.INL + + +class ICCID(BeeSurePkt): + PROTO = "ICCID" class UD(BeeSurePkt): @@ -405,16 +408,16 @@ def class_by_prefix( return CLASSES[proto] +def proto_handled(proto: str) -> bool: + return proto.startswith(PROTO_PREFIX) + + def proto_name(obj: Union[MetaPkt, BeeSurePkt]) -> str: return PROTO_PREFIX + ( obj.__class__.__name__ if isinstance(obj, BeeSurePkt) else obj.__name__ ) -def proto_by_name(name: str) -> str: - return PROTO_PREFIX + PROTOS.get(name, "UNKNOWN") - - def proto_of_message(packet: bytes) -> str: return PROTO_PREFIX + packet[20:-1].split(b",")[0].decode()