X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Frectifier.py;h=e73aeaed3188ca5433d9abfadbe2ed7b69052d22;hb=ca67cd29fc86054f08bcbf4995d484bab77a4e60;hp=47d9d055f8471357d5edb748f580cbaf6be90169;hpb=456fcc5a8964c84385d34a6687e83ae05ab2ddc3;p=loctrkd.git diff --git a/loctrkd/rectifier.py b/loctrkd/rectifier.py index 47d9d05..e73aeae 100644 --- a/loctrkd/rectifier.py +++ b/loctrkd/rectifier.py @@ -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=None, + altitude=None, + speed=None, + direction=None, + 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: