linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors.
@ 2016-09-20 13:12 Francois Beaufort
  0 siblings, 0 replies; 5+ messages in thread
From: Francois Beaufort @ 2016-09-20 13:12 UTC (permalink / raw)
  To: linux-bluetooth

Francois Beaufort (1):
  client: Show UUIDs when listing services, characteristics and
    descriptors.

 client/gatt.c | 75 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 28 deletions(-)

-- 
2.10.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors.
@ 2016-09-20 13:13 Francois Beaufort
  2016-09-20 13:13 ` Francois Beaufort
  0 siblings, 1 reply; 5+ messages in thread
From: Francois Beaufort @ 2016-09-20 13:13 UTC (permalink / raw)
  To: linux-bluetooth

Francois Beaufort (1):
  client: Show UUIDs when listing services, characteristics and
    descriptors.

 client/gatt.c | 75 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 28 deletions(-)

-- 
2.10.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors.
  2016-09-20 13:13 Francois Beaufort
@ 2016-09-20 13:13 ` Francois Beaufort
  0 siblings, 0 replies; 5+ messages in thread
From: Francois Beaufort @ 2016-09-20 13:13 UTC (permalink / raw)
  To: linux-bluetooth

Example output after this patch:

[bluetooth]# connect 7B:3F:2C:2B:D0:06
Attempting to connect to 7B:3F:2C:2B:D0:06
[CHG] Device 7B:3F:2C:2B:D0:06 Connected: yes
Connection successful
[NEW] Primary Service
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001/char0002
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[NEW] Primary Service
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028
        0000180f-0000-1000-8000-00805f9b34fb
        Battery Service
[NEW] Characteristic
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029
        00002a19-0000-1000-8000-00805f9b34fb
        Battery Level
[NEW] Descriptor
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029/desc002b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 ServicesResolved: yes
---
 client/gatt.c | 75 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 28 deletions(-)

diff --git a/client/gatt.c b/client/gatt.c
index fee1cf9..e6159bc 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -72,16 +72,23 @@ static void print_service(GDBusProxy *proxy, const char *description)
 	dbus_message_iter_get_basic(&iter, &primary);
 
 	text = uuidstr_to_str(uuid);
-	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				primary ? "Primary" : "Secondary",
-				g_dbus_proxy_get_path(proxy),
-				text);
+	if (!text) {
+		rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					primary ? "Primary" : "Secondary",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	} else {
+		rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					primary ? "Primary" : "Secondary",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
+	}
 }
 
 void gatt_add_service(GDBusProxy *proxy)
@@ -115,15 +122,21 @@ static void print_characteristic(GDBusProxy *proxy, const char *description)
 	dbus_message_iter_get_basic(&iter, &uuid);
 
 	text = uuidstr_to_str(uuid);
-	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				g_dbus_proxy_get_path(proxy),
-				text);
+	if (!text) {
+		rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	} else {
+		rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
+	}
 }
 
 static gboolean characteristic_is_child(GDBusProxy *characteristic)
@@ -183,15 +196,21 @@ static void print_descriptor(GDBusProxy *proxy, const char *description)
 	dbus_message_iter_get_basic(&iter, &uuid);
 
 	text = uuidstr_to_str(uuid);
-	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				g_dbus_proxy_get_path(proxy),
-				text);
+	if (!text) {
+		rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	} else {
+		rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
+	}
 }
 
 static gboolean descriptor_is_child(GDBusProxy *characteristic)
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors.
@ 2016-09-20 14:00 Francois Beaufort
  2016-09-20 14:57 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 5+ messages in thread
From: Francois Beaufort @ 2016-09-20 14:00 UTC (permalink / raw)
  To: linux-bluetooth

Example output after this patch:

[bluetooth]# connect 7B:3F:2C:2B:D0:06
Attempting to connect to 7B:3F:2C:2B:D0:06
[CHG] Device 7B:3F:2C:2B:D0:06 Connected: yes
Connection successful
[NEW] Primary Service
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001/char0002
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[NEW] Primary Service
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028
        0000180f-0000-1000-8000-00805f9b34fb
        Battery Service
[NEW] Characteristic
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029
        00002a19-0000-1000-8000-00805f9b34fb
        Battery Level
[NEW] Descriptor
        /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029/desc002b
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
[CHG] Device 7B:3F:2C:2B:D0:06 ServicesResolved: yes
---
 client/gatt.c | 66 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 25 deletions(-)

diff --git a/client/gatt.c b/client/gatt.c
index fee1cf9..37f222d 100644
--- a/client/gatt.c
+++ b/client/gatt.c
@@ -73,15 +73,21 @@ static void print_service(GDBusProxy *proxy, const char *description)
 
 	text = uuidstr_to_str(uuid);
 	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				primary ? "Primary" : "Secondary",
-				g_dbus_proxy_get_path(proxy),
-				text);
+		rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					primary ? "Primary" : "Secondary",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	else
+		rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					primary ? "Primary" : "Secondary",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
 }
 
 void gatt_add_service(GDBusProxy *proxy)
@@ -116,14 +122,19 @@ static void print_characteristic(GDBusProxy *proxy, const char *description)
 
 	text = uuidstr_to_str(uuid);
 	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				g_dbus_proxy_get_path(proxy),
-				text);
+		rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	else
+		rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
 }
 
 static gboolean characteristic_is_child(GDBusProxy *characteristic)
@@ -184,14 +195,19 @@ static void print_descriptor(GDBusProxy *proxy, const char *description)
 
 	text = uuidstr_to_str(uuid);
 	if (!text)
-		text = uuid;
-
-	rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
-				description ? "[" : "",
-				description ? : "",
-				description ? "] " : "",
-				g_dbus_proxy_get_path(proxy),
-				text);
+		rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid);
+	else
+		rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n\t%s\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					g_dbus_proxy_get_path(proxy),
+					uuid, text);
 }
 
 static gboolean descriptor_is_child(GDBusProxy *characteristic)
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors.
  2016-09-20 14:00 [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors Francois Beaufort
@ 2016-09-20 14:57 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2016-09-20 14:57 UTC (permalink / raw)
  To: Francois Beaufort; +Cc: linux-bluetooth@vger.kernel.org

Hi Francois,

On Tue, Sep 20, 2016 at 5:00 PM, Francois Beaufort
<beaufort.francois@gmail.com> wrote:
> Example output after this patch:
>
> [bluetooth]# connect 7B:3F:2C:2B:D0:06
> Attempting to connect to 7B:3F:2C:2B:D0:06
> [CHG] Device 7B:3F:2C:2B:D0:06 Connected: yes
> Connection successful
> [NEW] Primary Service
>         /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001
>         00001801-0000-1000-8000-00805f9b34fb
>         Generic Attribute Profile
> [NEW] Characteristic
>         /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0001/char0002
>         00002a05-0000-1000-8000-00805f9b34fb
>         Service Changed
> [NEW] Primary Service
>         /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028
>         0000180f-0000-1000-8000-00805f9b34fb
>         Battery Service
> [NEW] Characteristic
>         /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029
>         00002a19-0000-1000-8000-00805f9b34fb
>         Battery Level
> [NEW] Descriptor
>         /org/bluez/hci0/dev_7B_3F_2C_2B_D0_06/service0028/char0029/desc002b
>         00002902-0000-1000-8000-00805f9b34fb
>         Client Characteristic Configuration
> [CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001800-0000-1000-8000-00805f9b34fb
> [CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 00001801-0000-1000-8000-00805f9b34fb
> [CHG] Device 7B:3F:2C:2B:D0:06 UUIDs: 0000180f-0000-1000-8000-00805f9b34fb
> [CHG] Device 7B:3F:2C:2B:D0:06 ServicesResolved: yes
> ---
>  client/gatt.c | 66 +++++++++++++++++++++++++++++++++++++----------------------
>  1 file changed, 41 insertions(+), 25 deletions(-)
>
> diff --git a/client/gatt.c b/client/gatt.c
> index fee1cf9..37f222d 100644
> --- a/client/gatt.c
> +++ b/client/gatt.c
> @@ -73,15 +73,21 @@ static void print_service(GDBusProxy *proxy, const char *description)
>
>         text = uuidstr_to_str(uuid);
>         if (!text)
> -               text = uuid;
> -
> -       rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
> -                               description ? "[" : "",
> -                               description ? : "",
> -                               description ? "] " : "",
> -                               primary ? "Primary" : "Secondary",
> -                               g_dbus_proxy_get_path(proxy),
> -                               text);
> +               rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       primary ? "Primary" : "Secondary",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid);
> +       else
> +               rl_printf("%s%s%s%s Service\n\t%s\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       primary ? "Primary" : "Secondary",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid, text);
>  }
>
>  void gatt_add_service(GDBusProxy *proxy)
> @@ -116,14 +122,19 @@ static void print_characteristic(GDBusProxy *proxy, const char *description)
>
>         text = uuidstr_to_str(uuid);
>         if (!text)
> -               text = uuid;
> -
> -       rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
> -                               description ? "[" : "",
> -                               description ? : "",
> -                               description ? "] " : "",
> -                               g_dbus_proxy_get_path(proxy),
> -                               text);
> +               rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid);
> +       else
> +               rl_printf("%s%s%sCharacteristic\n\t%s\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid, text);
>  }
>
>  static gboolean characteristic_is_child(GDBusProxy *characteristic)
> @@ -184,14 +195,19 @@ static void print_descriptor(GDBusProxy *proxy, const char *description)
>
>         text = uuidstr_to_str(uuid);
>         if (!text)
> -               text = uuid;
> -
> -       rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
> -                               description ? "[" : "",
> -                               description ? : "",
> -                               description ? "] " : "",
> -                               g_dbus_proxy_get_path(proxy),
> -                               text);
> +               rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid);
> +       else
> +               rl_printf("%s%s%sDescriptor\n\t%s\n\t%s\n\t%s\n",
> +                                       description ? "[" : "",
> +                                       description ? : "",
> +                                       description ? "] " : "",
> +                                       g_dbus_proxy_get_path(proxy),
> +                                       uuid, text);
>  }
>
>  static gboolean descriptor_is_child(GDBusProxy *characteristic)
> --
> 2.10.0

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-20 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-20 14:00 [PATCH BlueZ] client: Show UUIDs when listing services, characteristics and descriptors Francois Beaufort
2016-09-20 14:57 ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2016-09-20 13:13 Francois Beaufort
2016-09-20 13:13 ` Francois Beaufort
2016-09-20 13:12 Francois Beaufort

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).