X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=gps303%2Fopencellid.py;h=583d2e167b98af216b7a05360cf7d6666ca49c6d;hb=bf48ccad4b4b91e7d7e09d1087f5953bc2db97d7;hp=1d60bfee1671defc9f8ed6fe9e994e787408ac0f;hpb=e84104c8d7e93efc4ab2f543e7dfef4cc0208187;p=loctrkd.git diff --git a/gps303/opencellid.py b/gps303/opencellid.py index 1d60bfe..583d2e1 100644 --- a/gps303/opencellid.py +++ b/gps303/opencellid.py @@ -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]: @@ -52,14 +57,14 @@ def lookup( if __name__.endswith("__main__"): from datetime import datetime, timezone import sys - from .gps303proto import * + from .zx303proto import * db = connect(sys.argv[1]) c = db.cursor() 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: