Small improvements on dbus testing program
[wifihood] / wifiscand / do_dbus
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SessionBus()
6
7 object_path = "/org/javiplx/wifiscan"
8 object_name = "org.javiplx.wifiscan"
9
10 proxy = bus.get_object( object_name , object_path )
11
12 proxy.wakeup()
13
14 if proxy.start() == "Interface initialized" :
15     fps = {}
16
17     scan = proxy.scan()
18     if scan :
19         for fingerprint in scan.split(" ") :
20             items = fingerprint.split(":")
21             rssi = int( items.pop() )
22             if rssi != -256 :
23                 fps["".join(items)] = rssi
24     print len(fps),fps
25 else :
26     print "Interface initialization failed"
27
28 proxy.stop()
29