diff --git a/requirements.txt b/requirements.txt index 541678e..81be216 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ uvicorn[standard]==0.34.3 fastapi==0.115.12 pymongo==4.16.0 pydantic==2.11.7 -aiohttp==3.12.13 \ No newline at end of file +aiohttp==3.12.13 +protobuf-decoder==0.4.0 \ No newline at end of file diff --git a/service.py b/service.py index c02d491..a43559f 100644 --- a/service.py +++ b/service.py @@ -158,6 +158,9 @@ class MongoDriver(MeshArgsParse): from tileManager import TileManager self.tileManager = TileManager(self) + from protobuf_decoder.protobuf_decoder import Parser + self.protoParser = Parser() + async def dbSaveRadio(self, new_from_radio): from_radio = copy.deepcopy(new_from_radio) for k, v in from_radio.items(): @@ -195,6 +198,16 @@ class MongoDriver(MeshArgsParse): except: traceback.print_exc() + try: + if v.get("portnum", 0) in []: + pass + else: + to_parse = ' '.join(f'{byte:02x}' for byte in v["payload"]) + res = self.protoParser.parse(to_parse) + logger.debug(res.to_dict()) + except: + pass + if "user" in v: v.update(v["user"]) del v["user"]