self.newap = 0
self.newaps = False
self.aps = {}
+ self.oldpos = {}
def start ( self , timeout=5000 , writelog=False ) :
self.scan_timeout = timeout
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]
dest_x , dest_y = self.gps2pix( coords , ( center_x , center_y ) )
pixmap.draw_rectangle(gc, True , dest_x , dest_y , radius , radius )
+ def line( self , pixmap , start , coords , colorname ) :
+
+ center_x , center_y = self.center()
+
+ gc = pixmap.new_gc()
+ gc.foreground = pixmap.get_colormap().alloc_color( colorname )
+
+ src_x , src_y = self.gps2pix( start , ( center_x , center_y ) )
+ dest_x , dest_y = self.gps2pix( coords , ( center_x , center_y ) )
+ dist = math.sqrt( (dest_x-src_x)**2 + (dest_y-src_y)**2 )
+ pixmap.draw_line(gc , src_x , src_y , dest_x , dest_y )
+
def plot_APs( self ) :
pixmap,mask = self.get_pixbuf().render_pixmap_and_mask()
if self.newaps :
pointsize += 2
self.map.plot( pixmap , ( float(self.info[4]) , float(self.info[5]) ) , "red" , pointsize )
- for ap in self.aps.values() :
- self.map.plot( pixmap , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" , 1 )
+ for mac,ap in self.aps.iteritems() :
+ if self.oldpos.get( mac ) :
+ self.map.line( pixmap , self.oldpos[mac] , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" )
+ self.map.plot( pixmap , ( ap[1]/ap[0] , ap[2]/ap[0] ) , "green" , 2 )
self.map.get_pixbuf().get_from_drawable( pixmap , pixmap.get_colormap() , 0, 0 , 0 , 0 , self.map.win_x, self.map.win_y )
self.map.show()