]> www.average.org Git - loctrkd.git/blobdiff - loctrkd/rectifier.py
watch: watch for both raw and rectified feeds
[loctrkd.git] / loctrkd / rectifier.py
index 47d9d055f8471357d5edb748f580cbaf6be90169..1da57528d733a52df0be0955f18d7d29ce86d49b 100644 (file)
@@ -51,7 +51,7 @@ def runserver(conf: ConfigParser) -> None:
     zpush = zctx.socket(zmq.PUSH)  # type: ignore
     zpush.connect(conf.get("collector", "listenurl"))
     zpub = zctx.socket(zmq.PUB)  # type: ignore
-    zpub.connect(conf.get("rectifier", "publishurl"))
+    zpub.bind(conf.get("rectifier", "publishurl"))
 
     try:
         while True:
@@ -89,19 +89,21 @@ def runserver(conf: ConfigParser) -> None:
                         )
                         log.debug("Sending reponse %s", resp)
                         zpush.send(resp.packed)
+                    rept = CoordReport(
+                        devtime=rect.devtime,
+                        battery_percentage=rect.battery_percentage,
+                        accuracy=-1,
+                        altitude=-1,
+                        speed=-1,
+                        direction=-1,
+                        latitude=lat,
+                        longitude=lon,
+                    )
+                    log.debug("Sending report %s", rept)
                     zpub.send(
                         Rept(
                             imei=zmsg.imei,
-                            payload=CoordReport(
-                                devtime=rect.devtime,
-                                battery_percentage=rect.battery_percentage,
-                                accuracy=-1,
-                                altitude=-1,
-                                speed=-1,
-                                direction=-1,
-                                latitude=lat,
-                                longitude=lon,
-                            ).json,
+                            payload=rept.json,
                         ).packed
                     )
                 except Exception as e: