blob: 7db46a1b96f3871180c8d9649254998acdb770ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def adapter_added(path):
print "Adapter with path %s added" % (path)
def adapter_removed(path):
print "Adapter with path %s removed" % (path)
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
'org.bluez.Manager')
manager.connect_to_signal("AdapterAdded", adapter_added,
dbus_interface="org.bluez.Manager")
manager.connect_to_signal("AdapterRemoved", adapter_removed,
dbus_interface="org.bluez.Manager")
mainloop = gobject.MainLoop()
mainloop.run()
|