X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=wifiscanner%2Fwifimap%2Freplay.py;h=a0ccd461fa7a9d5c4406d32ac49043a6cbe282cc;hb=759aacbbfcca9659b56081eaf37dbeaf235a397f;hp=3d3113dd59c69d99b12eba718a51b98cd7b6fc49;hpb=63eb5c0f5f36d0033906b4aa397816fb5efd48eb;p=wifihood diff --git a/wifiscanner/wifimap/replay.py b/wifiscanner/wifimap/replay.py index 3d3113d..a0ccd46 100644 --- a/wifiscanner/wifimap/replay.py +++ b/wifiscanner/wifimap/replay.py @@ -1,5 +1,4 @@ -import config import db import gobject @@ -8,10 +7,9 @@ import os class ReplayScanner ( gobject.GObject ) : - def __init__ ( self , ifname="wlan0" ) : + def __init__ ( self , conf , ifname="wlan0" ) : gobject.GObject.__init__( self ) self.scan_timeout = 0 - conf = config.Configuration( 'scanner' ) self.db = db.database( os.path.join( conf.homedir , "wifireplay.db" ) ) # Values specific to replaying @@ -28,14 +26,15 @@ class ReplayScanner ( gobject.GObject ) : # Values to be set by wireless scans self.scanlist = {} - self.tstamp = 0 self.nscan = 0 self.nfp = 0 # Values from the Scanner object + self.tstamp = 0 self.newap = 0 self.newaps = False self.aps = {} + self.oldpos = {} def start ( self , timeout=5000 , writelog=False ) : self.scan_timeout = timeout @@ -86,6 +85,8 @@ class ReplayScanner ( gobject.GObject ) : if not self.aps.has_key( mac ) : self.aps[ mac ] = [ 0 , 0 , 0 ] self.db.add( mac , max_rss , self.tstamp , self.info[4:] ) + if self.aps[mac][0] != 0 : + self.oldpos[mac] = self.aps[mac][1] / self.aps[mac][0] , self.aps[mac][2] / self.aps[mac][0] self.aps[mac][0] += 1 self.aps[mac][1] += self.info[4] self.aps[mac][2] += self.info[5]