]> www.average.org Git - loctrkd.git/blobdiff - gps303/opencellid.py
Multiprotocol support in zmq messages and storage
[loctrkd.git] / gps303 / opencellid.py
index 1d60bfee1671defc9f8ed6fe9e994e787408ac0f..7b6e41306cf3973471d610403d693084f5aa0917 100644 (file)
@@ -15,6 +15,11 @@ def init(conf: Dict[str, Any]) -> None:
     ldb = connect(conf["opencellid"]["dbfn"])
 
 
+def shut() -> None:
+    if ldb is not None:
+        ldb.close()
+
+
 def lookup(
     mcc: int, mnc: int, gsm_cells: List[Tuple[int, int, int]], __: Any
 ) -> Tuple[float, float]:
@@ -59,7 +64,7 @@ if __name__.endswith("__main__"):
     c.execute(
         """select tstamp, packet from events
             where proto in (?, ?)""",
-        (WIFI_POSITIONING.PROTO, WIFI_OFFLINE_POSITIONING.PROTO),
+        (proto_name(WIFI_POSITIONING), proto_name(WIFI_OFFLINE_POSITIONING)),
     )
     init({"opencellid": {"dbfn": sys.argv[2]}})
     for timestamp, packet in c: