Include a configuration setting to specify the interval among wireless scans
[wifihood] / wifiscanner / wifiscanner
index 42e12e6..424c3f4 100755 (executable)
@@ -8,18 +8,18 @@ try :
 except :
     hildon = False
 
-def global_start(button, scanner):
-    scanner.start()
+def global_start(button, scanner, config):
+    scanner.start( config.scan_period )
     if button._id :
         button.disconnect( button._id )
-    button._id = button.connect("clicked", global_stop, scanner)
+    button._id = button.connect("clicked", global_stop, scanner, config)
     button.set_label("Switch GPS Off")
 
-def global_stop(button, scanner):
+def global_stop(button, scanner, config):
     scanner.stop()
     if button._id :
         button.disconnect( button._id )
-    button._id = button.connect("clicked", global_start, scanner)
+    button._id = button.connect("clicked", global_start, scanner, config)
     button.set_label("Switch GPS On")
 
 def enable_agps(button):
@@ -43,14 +43,14 @@ def stop_scan(button, scanner):
     button.set_label("Start scanning")
 
 
-class scanner ( wifimap.Scanner ) :
+class scanner ( wifimap.ReplayScanner ) :
 
     def scan ( self ) :
-        wifimap.Scanner.scan( self )
+        wifimap.ReplayScanner.scan( self )
         self.report()
 
     def report ( self ) :
-        self.status.set_label( wifimap.Scanner.report(self) )
+        self.status.set_label( wifimap.ReplayScanner.report(self) )
         start, end = self.buffer.get_bounds()
         self.buffer.delete( start , end )
         for mac,rss in self.scanlist.iteritems() :
@@ -107,7 +107,7 @@ class AbstractWifiscanner :
 
         # Buttons creation
         button = self.Button( "Switch GPS On")
-        button._id = button.connect("clicked", global_start, _scanner)
+        button._id = button.connect("clicked", global_start, _scanner, self.map.config)
         buttons.pack_start(button, expand=False)
 
         button_scan = self.Button( "Start scanning")