Simplified applets
[gregoa/zavai.git] / zavai / gps.py
index 22e3a6dc86f030c8ea71c6f6193ad18eb56bff2a..bb0d8ae8c7d5cbccb2370b6c27fc07b940e9a5b1 100755 (executable)
 #import sys
 #import os
 import os.path
-#import time
-#import struct
+import time
 #import signal
 #import optparse
-#import dbus
-#import dbus.mainloop.glib
+import dbus
 #import gobject
 import zavai
 
@@ -69,9 +67,11 @@ class GPSMonitor():
         self.debug_update()
 
     def on_satellites_changed(self, satellites):
-        self.gps_debug.request()
+        zavai.info("gps monitor: satellites changed")
+        self.debug_request()
 
     def on_ubxdebug_packet(self, clid, length, data):
+        zavai.info("gps monitor: UBX debug packet")
         for c in self.callbacks:
             c(clid, length, data)
 
@@ -109,56 +109,6 @@ class GPSMonitor():
         if not self.callbacks:
             self._stop_listening()
 
-#        # In zhone it is cbUBXDebugPacket
-#        #if clid == "NAV-STATUS" and data:
-#        #    i = ["%s: %d" % (k, data[0][k]) for k in sorted(data[0].keys())]
-#        #    zavai.info("Status:", " ".join(i))
-#        ##    if data[0]['TTFF']:
-#        ##        zavai.info("TTFF: %f", data[0]['TTFF']/1000.0)
-#        if clid == "NAV-SVINFO":
-#            self.print_ubx_sat_data(data[1:])
-#        #else:
-#        #    zavai.info("gps got ubxdebug packet", clid)
-#        #    zavai.info("DATA:", data)
-#
-#    def print_ubx_sat_data(self, ubxinfo):
-#        zavai.info("CH ID SN ELE AZI Used Diff Alm Eph Bad Status")
-#        for sv in ubxinfo:
-#            if sv["CNO"] == 0: continue
-#            svid = sv["SVID"]
-#            used = sv["Flags"] & 0x01
-#            diff = sv["Flags"] & 0x02
-#            almoreph = sv["Flags"] & 0x04
-#            eph = sv["Flags"] & 0x08
-#            bad = sv["Flags"] & 0x10
-#            qi = ("%i: " % sv["QI"]) + {
-#                0: "idle",
-#                1: "searching",
-#                2: "signal acquired",
-#                3: "signal unusable",
-#                4: "code lock",
-#                5: "code&carrier lock",
-#                6: "code&carrier lock",
-#                7: "receiving data"
-#            }[sv["QI"]]
-#            zavai.info("%2d %2d %2d %3d %3d %s %s %s %s %s %s" % (
-#                sv["chn"], sv["SVID"],
-#                sv["CNO"], sv["Elev"], sv["Azim"],
-#                used and "used" or "----",
-#                diff and "diff" or "----",
-#                almoreph and "alm" or "---",
-#                eph and "eph" or "---",
-#                bad and "bad" or "---",
-#                qi))
-#
-#    def print_sat_data(self, satellites):
-#        for sat in satellites:
-#            if sat[4] == 0: continue
-#            zavai.info("PRN %u" % sat[0],
-#                 sat[1] and "used" or "unused",
-#                 "el %u" % sat[2],
-#                 "az %u" % sat[3],
-#                 "snr %u" % sat[4])
 
 # For a list of dbus services, look in /etc/dbus-1/system.d/
 class GPS(zavai.Resource):