]> average.org Git - loctrkd.git/blobdiff - gps303/lookaside.py
add lookaside module and opencellid lookup
[loctrkd.git] / gps303 / lookaside.py
diff --git a/gps303/lookaside.py b/gps303/lookaside.py
new file mode 100644 (file)
index 0000000..3c3ee32
--- /dev/null
@@ -0,0 +1,13 @@
+"""
+For when responding to the terminal is not trivial
+"""
+
+from .GT06mod import *
+from .opencellid import qry_cell
+
+def prepare_response(conf, msg):
+    if isinstance(msg, WIFI_POSITIONING):
+        lat, lon = qry_cell(conf["opencellid"]["dbfn"],
+                msg.mcc, msg.gsm_cells)
+        return {"lat": lat, "lon": lon}
+    return {}