diff mbox series

[BlueZ,9/9] btgatt-client: Implement filter service by start handle

Message ID 20230323103835.571037-10-simon.mikuda@streamunlimited.com
State New
Headers show
Series gatt-db fix + btgatt-client features | expand

Commit Message

Simon Mikuda March 23, 2023, 10:38 a.m. UTC
---
 tools/btgatt-client.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index b7a23ac9b..629063d5c 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -377,8 +377,13 @@  static void print_services_by_uuid(const bt_uuid_t *uuid)
 
 static void print_services_by_handle(uint16_t handle)
 {
-	/* TODO: Filter by handle */
-	gatt_db_foreach_service(cli->db, NULL, print_service, cli);
+	uint16_t start = 0x0001, end = 0xFFFF;
+	if (handle) {
+		start = handle;
+		end = handle;
+	}
+	gatt_db_foreach_service_in_range(cli->db, NULL, print_service, NULL,
+			start, end);
 }
 
 static void ready_cb(bool success, uint8_t att_ecode, void *user_data)