10 class Scanner ( gps.GPSObject ) :
12 def __init__ ( self , widget=None , ifname="wlan0" ) :
13 gps.GPSObject.__init__( self , widget )
14 self.osso_context = osso.Context("wifi_scanner", "2.0", False)
18 osso_rpc = osso.Rpc(self.osso_context)
19 scan_out = osso_rpc.rpc_run("org.javiplx.wifiscan", "/org/javiplx/wifiscan", "org.javiplx.wifiscan", "start")
20 osso.SystemNote(self.osso_context).system_note_infoprint("WifiScand started")
23 osso_rpc = osso.Rpc(self.osso_context)
24 scan_out = osso_rpc.rpc_run("org.javiplx.wifiscan", "/org/javiplx/wifiscan", "org.javiplx.wifiscan", "stop")
25 osso.SystemNote(self.osso_context).system_note_infoprint("WifiScand stopped")
28 osso_rpc = osso.Rpc(self.osso_context)
30 scan_out = osso_rpc.rpc_run("org.javiplx.wifiscan", "/org/javiplx/wifiscan", "org.javiplx.wifiscan", "scan", wait_reply = True)
31 except Exception , ex :
32 osso.SystemNote(self.osso_context).system_note_infoprint("Exception scanning %s" % ex )
34 #osso.SystemNote(self.osso_context).system_note_infoprint("Found %d APs" % len(scan_out.split()) )
36 for net in scan_out.split() :
37 items = net.rsplit(":", 1)
38 out_str += " %s %s" % ( items[0] , items[1] )
40 # Use osso or hildon for notes ???
41 osso.SystemNote(self.osso_context).system_note_infoprint("Found %d APs" % len(scan_out) )
42 # hildon.hildon_banner_show_information( self._parent , "icon_path" , "Found %d APs" % len(scan_out) )
44 fd = open( "/home/user/MyDocs/wiscan_gui.info" , 'a' )
45 fd.write( "%s %s%s\n" % ( time.time() , self.gps_info , out_str ) )
48 loclist = open( "/home/user/MyDocs/location.info" , 'a' )
49 loclist.write ( "%s\n" % ( self.satellites ,) )
52 # osso.SystemNote(self.osso_context).system_note_infoprint("Found Cell : %s" % ( self.cell_info ,) )
53 celllist = open( "/home/user/MyDocs/cell.info" , 'a' )
54 celllist.write ( "%s\n" % ( self.cell_info ,) )
60 gobject.type_register(Scanner)