2023-03-23 10:44:58

by Simon Mikuda

[permalink] [raw]
Subject: [PATCH BlueZ 9/9] btgatt-client: Implement filter service by start handle

---
tools/btgatt-client.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

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