Skip to contentSkip to conversation

doc/gatt-api: Mention available examples

PATCH Applied Luiz Augusto von Dentz 1 participant 4 messages Aug 2, 2016 – Aug 4, 2016 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/3 doc/gatt-api: Mention available examples

From: Luiz Augusto von Dentz <[email protected]>

---
 doc/gatt-api.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/gatt-api.txt +9 -0
index f2f3d89..fd4bdd5 100644
@@ -307,6 +307,15 @@ unregister the service. Similarly, if the application disconnects from the bus,
 all of its registered services will be automatically unregistered.
 InterfacesAdded signals will be ignored.
 
+Examples:
+	- Client
+		test/example-gatt-client
+		client/bluetoothctl
+	- Server
+		test/example-gatt-server
+		tools/gatt-service
+
+
 Service		org.bluez
 Interface	org.bluez.GattManager1
 Object path	[variable prefix]/{hci0,hci1,...}
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 2/3 test/example-gatt-client: Add more comments

From: Luiz Augusto von Dentz <[email protected]>

This adds more comments what the example is doing.

---
 test/example-gatt-client | 3 +++
 1 file changed, 3 insertions(+)
test/example-gatt-client +3 -0
index 4d1df2f..b4bbaa9 100755
@@ -193,14 +193,17 @@ def main():
     om = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, '/'), DBUS_OM_IFACE)
     om.connect_to_signal('InterfacesRemoved', interfaces_removed_cb)
 
+    print('Getting objects...')
     objects = om.GetManagedObjects()
     chrcs = []
 
+    # List characteristics found
     for path, interfaces in objects.items():
         if GATT_CHRC_IFACE not in interfaces.keys():
             continue
         chrcs.append(path)
 
+    # List sevices found
     for path, interfaces in objects.items():
         if GATT_SERVICE_IFACE not in interfaces.keys():
             continue
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH 3/3 test/example-gatt-server: Add more comments

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds more comments what the example is doing.

---
 test/example-gatt-server | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
test/example-gatt-server +14 -0
index 84905f3..44ceb70 100755
@@ -42,6 +42,9 @@ class FailedException(dbus.exceptions.DBusException):
 
 
 class Application(dbus.service.Object):
+    """
+    org.bluez.GattApplication1 interface implementation
+    """
     def __init__(self, bus):
         self.path = '/'
         self.services = []
@@ -74,6 +77,9 @@ class Application(dbus.service.Object):
 
 
 class Service(dbus.service.Object):
+    """
+    org.bluez.GattService1 interface implementation
+    """
     PATH_BASE = '/org/bluez/example/service'
 
     def __init__(self, bus, index, uuid, primary):
@@ -121,6 +127,9 @@ class Service(dbus.service.Object):
 
 
 class Characteristic(dbus.service.Object):
+    """
+    org.bluez.GattCharacteristic1 interface implementation
+    """
     def __init__(self, bus, index, uuid, flags, service):
         self.path = service.path + '/char' + str(index)
         self.bus = bus
@@ -195,6 +204,9 @@ class Characteristic(dbus.service.Object):
 
 
 class Descriptor(dbus.service.Object):
+    """
+    org.bluez.GattDescriptor1 interface implementation
+    """
     def __init__(self, bus, index, uuid, flags, characteristic):
         self.path = characteristic.path + '/desc' + str(index)
         self.bus = bus
@@ -636,6 +648,8 @@ def main():
 
     mainloop = GObject.MainLoop()
 
+    print('Registering GATT application...')
+
     service_manager.RegisterApplication(app.get_path(), {},
                                     reply_handler=register_app_cb,
                                     error_handler=register_app_error_cb)
Signature · 1 line
2.7.4
author maintainer Applied
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi,

Quoted 27 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

---
 doc/gatt-api.txt | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/gatt-api.txt +9 -1
index f2f3d89..fd4bdd5 100644
@@ -307,6 +307,15 @@ unregister the service. Similarly, if the application disconnects from the bus,
 all of its registered services will be automatically unregistered.
 InterfacesAdded signals will be ignored.
 
+Examples:
+       - Client
+               test/example-gatt-client
+               client/bluetoothctl
+       - Server
+               test/example-gatt-server
+               tools/gatt-service
+
+
 Service                org.bluez
 Interface      org.bluez.GattManager1
 Object path    [variable prefix]/{hci0,hci1,...}
--
Quoted 1 line

2.7.4

Applied.

Signature · 1 line
Luiz Augusto von Dentz