diff mbox series

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

Message ID 20230323103835.571037-10-simon.mikuda@streamunlimited.com (mailing list archive)
State New, archived
Headers show
Series gatt-db fix + btgatt-client features | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:LINE_SPACING: Missing a blank line after declarations #94: FILE: tools/btgatt-client.c:381: + uint16_t start = 0x0001, end = 0xFFFF; + if (handle) { /github/workspace/src/src/13185483.patch total: 0 errors, 1 warnings, 15 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/13185483.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.
tedd_an/GitLint success Gitlint PASS

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)