X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Fwatch.py;h=738cfe230be94dfb415a6c40b21045e8e1583960;hb=cffceea601459816660ab46d46be2f3e9370c2fe;hp=7221d2b716595fb05623f1f66a8d476aaeee9d3c;hpb=5ef83cb7db7464a5a625b0b7c86c4e25ebbb0de1;p=loctrkd.git diff --git a/loctrkd/watch.py b/loctrkd/watch.py index 7221d2b..738cfe2 100644 --- a/loctrkd/watch.py +++ b/loctrkd/watch.py @@ -14,7 +14,9 @@ log = getLogger("loctrkd/watch") class ProtoModule: - PROTO_PREFIX: str + @staticmethod + def proto_handled(proto: str) -> bool: + ... @staticmethod def parse_message(packet: bytes, is_incoming: bool = True) -> Any: @@ -41,7 +43,7 @@ def runserver(conf: ConfigParser) -> None: zmsg = Bcast(zsub.recv()) print("I" if zmsg.is_incoming else "O", zmsg.proto, zmsg.imei) for pmod in pmods: - if zmsg.proto.startswith(pmod.PROTO_PREFIX): + if pmod.proto_handled(zmsg.proto.startswith): msg = pmod.parse_message(zmsg.packet, zmsg.is_incoming) print(msg) except KeyboardInterrupt: