Created
April 7, 2020 23:08
-
-
Save dlech/a6f1a6fd910f4858eebd6bb84cc00436 to your computer and use it in GitHub Desktop.
ev3dev-stretch D-Bus BlueZ example
This file contains 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
#!/usr/bin/env python3 | |
# ev3dev-stretch | |
# https://github.com/bluez/bluez/blob/5.43/doc/gatt-api.txt | |
# https://developer.gnome.org/gio/2.50/GDBusProxy.html | |
import gi | |
# gi.require_version("GLib", "2.0") | |
# gi.require_version("GObject", "2.0") | |
gi.require_version("Gio", "2.0") | |
# from gi.repository import GLib | |
# from gi.repository import GObject | |
from gi.repository import Gio | |
object_manager = Gio.DBusObjectManagerClient.new_for_bus_sync( | |
Gio.BusType.SYSTEM, | |
Gio.DBusObjectManagerClientFlags.NONE, | |
"org.bluez", | |
"/", | |
) | |
for obj in object_manager.get_objects(): | |
# device = obj.get_interface("org.bluez.Device1") | |
# if not device: | |
# continue | |
# print(device.get_cached_property("Alias")) | |
char = obj.get_interface("org.bluez.GattCharacteristic1") | |
if not char: | |
continue | |
print(char.get_cached_property("UUID")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment