Handle geocoordinates in logscanner
authorjaviplx <javiplx@gmail.com>
Mon, 11 Oct 2010 17:05:46 +0000 (17:05 +0000)
committerjaviplx <javiplx@gmail.com>
Mon, 11 Oct 2010 17:05:46 +0000 (17:05 +0000)
git-svn-id: file:///svnroot/wifihood/trunk@50 c51dfc6a-5949-4919-9c8e-f207a149c383

wifiscanner/logscanner
wifiscanner/wifimap/wifiscan.py

index 022b50c..d66d989 100755 (executable)
@@ -11,8 +11,12 @@ def main ( scanner , filename ) :
         gps_info = line[:-1].split(None,11)
         tstamp = float(gps_info.pop(0))
         scan_out = gps_info.pop()
+        latlon = None
+        if gps_info[0] == "FIX" :
+                scanner.ngps += 1
+                latlon = ( float(gps_info[4]) , float(gps_info[5]) , float(gps_info[6]) )
         scanner.nscan +=1
-        scanner.store_logscan( tstamp , scan_out )
+        scanner.store_logscan( tstamp , scan_out , latlon )
         print "%d gps\t%d scan\t%d fp\t%d ap\t%d total ap" % ( scanner.ngps , scanner.nscan , scanner.nfp , scanner.newap , scanner.db.nrows() )
     fd.close()
 
index b35d7f0..6dcd3f5 100644 (file)
@@ -81,7 +81,7 @@ class Scanner ( gps.GPSObject ) :
                 self.db.add( items[0] , int(items[1]) , timestamp )
         return out_str
 
-    def store_logscan ( self , timestamp , scan_out ) :
+    def store_logscan ( self , timestamp , scan_out , gps_info=None ) :
         nets = scan_out.split()
         while nets :
             self.nfp += 1
@@ -93,10 +93,10 @@ class Scanner ( gps.GPSObject ) :
                 max_rss = int(items[1])
                 if stored[0] > max_rss :
                     max_rss = stored[0]
-                self.db.update( items[0] , max_rss , timestamp )
+                self.db.update( items[0] , max_rss , timestamp , gps_info )
             else :
                 self.newap += 1
-                self.db.add( items[0] , int(items[1]) , timestamp )
+                self.db.add( items[0] , int(items[1]) , timestamp , gps_info )
 
     def write_logs ( self , timestamp , out_str ) :
             fd = open( os.path.join( conf.homedir , "wiscan_gui.info" ) , 'a' )