Last active
December 6, 2016 15:29
-
-
Save infirit/d7750963235267cd3d41 to your computer and use it in GitHub Desktop.
GDBus bluez adapter example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from gi.repository import Gio, GLib, GObject | |
| proxy = Gio.DBusProxy.new_sync( | |
| Gio.bus_get_sync(Gio.BusType.SYSTEM), | |
| Gio.DBusProxyFlags.NONE, | |
| None, | |
| 'org.bluez', | |
| '/org/bluez/hci0', | |
| 'org.freedesktop.DBus.Properties') | |
| def on_property_changed(proxy, sender, signal_name, param): | |
| interface = param[0] | |
| key, value = param[1].popitem() | |
| path = proxy.get_object_path() | |
| print('Got key "%s" with value "%s" on interface "%s" on path "%s"' % (key, value, interface, path)) | |
| sig = proxy.connect("g-signal", on_property_changed) | |
| print(proxy.Get("(ss)", "org.bluez.Adapter1", "Alias")) | |
| loop = GObject.MainLoop() | |
| loop.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment