]> www.average.org Git - loctrkd.git/blobdiff - gps303/zmsg.py
WIP on ws gateway, it now works
[loctrkd.git] / gps303 / zmsg.py
index 898918cab10204384986bf2b36ae710148dbab9c..0ccef007db6a0ddc5a9491b6d661ec89a63c1a57 100644 (file)
@@ -156,6 +156,19 @@ class LocEvt(_Zmsg):
             ).encode()
         )
 
+    # And this is full json that can be sent over websocket etc.
+    @property
+    def json(self):
+        return dumps(
+            {
+                "imei": self.imei,
+                "devtime": str(self.devtime),
+                "latitude": self.lat,
+                "longitude": self.lon,
+                "is-gps": self.is_gps,
+            }
+        )
+
     def decode(self, buffer):
         self.imei = buffer[:16].decode()
         json_data = loads(buffer[16:])