linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] gatt-client: Add read-only handles to dbus
@ 2023-07-28  4:49 Simon Mikuda
  2023-07-28  6:18 ` [BlueZ] " bluez.test.bot
  2023-07-28 22:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Mikuda @ 2023-07-28  4:49 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

This can be usefull when mapping names for services and characteristics
to their handle numbers.
---
 doc/gatt-api.txt  |  3 +++
 src/gatt-client.c | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/doc/gatt-api.txt b/doc/gatt-api.txt
index 5042c5470..f29308aec 100644
--- a/doc/gatt-api.txt
+++ b/doc/gatt-api.txt
@@ -51,6 +51,7 @@ Properties	string UUID [read-only]
 			services of this service.
 
 		uint16 Handle [read-write, optional] (Server Only)
+		              [read-only] (Client Only)
 
 			Service handle. When available in the server it
 			would attempt to use to allocate into the database
@@ -291,6 +292,7 @@ Properties	string UUID [read-only]
 				"authorize"
 
 		uint16 Handle [read-write, optional] (Server Only)
+		              [read-only] (Client Only)
 
 			Characteristic handle. When available in the server it
 			would attempt to use to allocate into the database
@@ -380,6 +382,7 @@ Properties	string UUID [read-only]
 				"authorize"
 
 		uint16 Handle [read-write, optional] (Server Only)
+		              [read-only] (Client Only)
 
 			Characteristic handle. When available in the server it
 			would attempt to use to allocate into the database
diff --git a/src/gatt-client.c b/src/gatt-client.c
index a54d65e30..60a21e3f6 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -137,6 +137,17 @@ static bool uuid_cmp(const bt_uuid_t *uuid, uint16_t u16)
 	return bt_uuid_cmp(uuid, &uuid16) == 0;
 }
 
+static gboolean descriptor_get_handle(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct service *desc = data;
+	uint16_t handle = desc->start_handle;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &handle);
+
+	return TRUE;
+}
+
 static gboolean descriptor_get_uuid(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
@@ -635,6 +646,7 @@ static DBusMessage *descriptor_write_value(DBusConnection *conn,
 }
 
 static const GDBusPropertyTable descriptor_properties[] = {
+	{ "Handle", "q", descriptor_get_handle },
 	{ "UUID", "s", descriptor_get_uuid },
 	{ "Characteristic", "o", descriptor_get_characteristic, },
 	{ "Value", "ay", descriptor_get_value, NULL, descriptor_value_exists },
@@ -713,6 +725,17 @@ static void unregister_descriptor(void *data)
 							GATT_DESCRIPTOR_IFACE);
 }
 
+static gboolean characteristic_get_handle(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct characteristic *chrc = data;
+	uint16_t handle = chrc->handle;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &handle);
+
+	return TRUE;
+}
+
 static gboolean characteristic_get_uuid(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
@@ -1660,6 +1683,7 @@ static DBusMessage *characteristic_stop_notify(DBusConnection *conn,
 }
 
 static const GDBusPropertyTable characteristic_properties[] = {
+	{ "Handle", "q", characteristic_get_handle },
 	{ "UUID", "s", characteristic_get_uuid, NULL, NULL },
 	{ "Service", "o", characteristic_get_service, NULL, NULL },
 	{ "Value", "ay", characteristic_get_value, NULL,
@@ -1821,6 +1845,17 @@ static void unregister_characteristic(void *data)
 						GATT_CHARACTERISTIC_IFACE);
 }
 
+static gboolean service_get_handle(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct service *service = data;
+	uint16_t handle = service->start_handle;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &handle);
+
+	return TRUE;
+}
+
 static gboolean service_get_uuid(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
@@ -1884,6 +1919,7 @@ static gboolean service_get_includes(const GDBusPropertyTable *property,
 }
 
 static const GDBusPropertyTable service_properties[] = {
+	{ "Handle", "q", service_get_handle },
 	{ "UUID", "s", service_get_uuid },
 	{ "Device", "o", service_get_device },
 	{ "Primary", "b", service_get_primary },
-- 
2.34.1


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

* RE: [BlueZ] gatt-client: Add read-only handles to dbus
  2023-07-28  4:49 [PATCH BlueZ] gatt-client: Add read-only handles to dbus Simon Mikuda
@ 2023-07-28  6:18 ` bluez.test.bot
  2023-07-28 22:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-07-28  6:18 UTC (permalink / raw)
  To: linux-bluetooth, simon.mikuda

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=770395

---Test result---

Test Summary:
CheckPatch                    FAIL      0.75 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      27.78 seconds
BluezMake                     PASS      1023.54 seconds
MakeCheck                     PASS      12.48 seconds
MakeDistcheck                 PASS      160.47 seconds
CheckValgrind                 PASS      262.36 seconds
CheckSmatch                   PASS      348.72 seconds
bluezmakeextell               PASS      106.00 seconds
IncrementalBuild              PASS      889.17 seconds
ScanBuild                     PASS      1096.73 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ] gatt-client: Add read-only handles to dbus
WARNING:TYPO_SPELLING: 'usefull' may be misspelled - perhaps 'useful'?
#76: 
This can be usefull when mapping names for services and characteristics
            ^^^^^^^

/github/workspace/src/src/13331197.patch total: 0 errors, 1 warnings, 93 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13331197.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth


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

* Re: [PATCH BlueZ] gatt-client: Add read-only handles to dbus
  2023-07-28  4:49 [PATCH BlueZ] gatt-client: Add read-only handles to dbus Simon Mikuda
  2023-07-28  6:18 ` [BlueZ] " bluez.test.bot
@ 2023-07-28 22:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-07-28 22:50 UTC (permalink / raw)
  To: Simon Mikuda; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 28 Jul 2023 06:49:44 +0200 you wrote:
> This can be usefull when mapping names for services and characteristics
> to their handle numbers.
> ---
>  doc/gatt-api.txt  |  3 +++
>  src/gatt-client.c | 36 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 39 insertions(+)

Here is the summary with links:
  - [BlueZ] gatt-client: Add read-only handles to dbus
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=cda5549f2475

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-07-28 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  4:49 [PATCH BlueZ] gatt-client: Add read-only handles to dbus Simon Mikuda
2023-07-28  6:18 ` [BlueZ] " bluez.test.bot
2023-07-28 22:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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).