[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gpsd-commit-watch
Subject:    [Gpsd-commit-watch] r6878 - trunk
From:       esr at BerliOS <esr () mail ! berlios ! de>
Date:       2009-12-20 16:20:45
Message-ID: 200912201620.nBKGKjuc028187 () sheep ! berlios ! de
[Download RAW message or body]

Author: esr
Date: 2009-12-20 17:20:45 +0100 (Sun, 20 Dec 2009)
New Revision: 6878

Modified:
   trunk/gpsd_json.c
   trunk/xgps
Log:
More AIS tweaks.  Test client is turning up real bugs.


Modified: trunk/gpsd_json.c
===================================================================
--- trunk/gpsd_json.c	2009-12-20 15:42:15 UTC (rev 6877)
+++ trunk/gpsd_json.c	2009-12-20 16:20:45 UTC (rev 6878)
@@ -1230,7 +1230,7 @@
 	    (void)snprintf(buf+strlen(buf), buflen-strlen(buf),
 			   "\"ne_lon\":\"%f\",\"ne_lat\":\"%f\","
 			   "\"sw_lon\":\"%f\",\"sw_lat\":\"%f\","
-			   "\"stationtype\":%s,\"shiptype\":%s,"
+			   "\"stationtype\":\"%s\",\"shiptype\":\"%s\","
 			   "\"interval\":%u,\"quiet\":%u}\r\n",
 			   ais->type23.ne_lon / AIS_CHANNEL_LATLON_SCALE,
 			   ais->type23.ne_lat / AIS_CHANNEL_LATLON_SCALE,

Modified: trunk/xgps
===================================================================
--- trunk/xgps	2009-12-20 15:42:15 UTC (rev 6877)
+++ trunk/xgps	2009-12-20 16:20:45 UTC (rev 6878)
@@ -165,7 +165,7 @@
         "Initialize the store and view."
         self.name_to_mmsi = {}
         self.named = {}
-        self.store = gtk.ListStore(str, str,str,str,str)
+        self.store = gtk.ListStore(str,str,str,str,str)
         self.widget = gtk.ScrolledWindow()
         self.widget.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
         self.view = gtk.TreeView(model=self.store)
@@ -195,7 +195,6 @@
 
     def latlon(self, lat, lon):
         "Latitude/longitude display in nice format."
-        print "Foo!", lat, lon
         if lat < 0:
             latsuff = "S"
         elif lat > 0:
@@ -217,7 +216,18 @@
     def update(self, ais):
         "Update the AIS data fields."
         if ais.mmsi not in self.named:
-            if ais.type == 5:
+            if ais.type in (1, 2, 3):
+                #print "CNB", ais.mmsi
+                if ais.mmsi in self.named:
+                    for i in range(len(self.store)):
+                        here = self.store.get_iter(i)
+                        name = self.store.get_value(here, 1)
+                        mmsi = self.name_to_mmsi[name]
+                        if mmsi == ais.mmsi:
+                            latlon = self.latlon(ais.lat, ais.lon)
+                            self.store.set_value(here, 4, latlon)
+            elif ais.type == 5:
+                print "Ship", ais.mmsi
                 self.enter(ais, ais.shipname)
                 self.store.prepend(
                     (ais.type, ais.shipname, ais.callsign, ais.destination, ""))
@@ -226,7 +236,6 @@
                 self.store.prepend(
                     (ais.type, ais.shipname, "(class B)", "", ""))
             elif ais.type == 21:
-                print "I see:", ais
                 self.enter(ais, ais.name)
                 where = self.latlon(ais.lat, ais.lon)
                 self.store.prepend(

_______________________________________________
Gpsd-commit-watch mailing list
Gpsd-commit-watch@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/gpsd-commit-watch
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic