]> www.average.org Git - loctrkd.git/blobdiff - gps303/lookaside.py
cleanup and document config file a bit
[loctrkd.git] / gps303 / lookaside.py
index dd5a449bdbcfa771fd5358f25b1d56afd52b386a..b42ce06f378a5ae10fe9a642475556ab577d6859 100644 (file)
@@ -15,11 +15,14 @@ log = getLogger("gps303/lookaside")
 
 
 def runserver(conf):
+    if conf.get("lookaside", "backend") != "opencellid":
+        raise NotImplementedError(
+            "Lookaside only implements opencellid backend"
+        )
     zctx = zmq.Context()
     zsub = zctx.socket(zmq.SUB)
     zsub.connect(conf.get("collector", "publishurl"))
-    tosub = topic(WIFI_POSITIONING.PROTO)
-    zsub.setsockopt(zmq.SUBSCRIBE, tosub)
+    zsub.setsockopt(zmq.SUBSCRIBE, topic(WIFI_POSITIONING.PROTO))
     zpush = zctx.socket(zmq.PUSH)
     zpush.connect(conf.get("collector", "listenurl"))
 
@@ -39,6 +42,7 @@ def runserver(conf):
             )
             resp = Resp(
                 imei=zmsg.imei,
+                when=zmsg.when,  # not the current time, but the original!
                 packet=msg.Out(latitude=lat, longitude=lon).packed,
             )
             log.debug("Response for lat=%s, lon=%s: %s", lat, lon, resp)