From c7100727242b9e5dcfebf812b30296febc350d1d Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Mon, 8 Apr 2024 15:26:48 +0200 Subject: [PATCH] TODO: RemoveMe --- dbus/gattlib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbus/gattlib.c b/dbus/gattlib.c index e98d500..be7fc92 100644 --- a/dbus/gattlib.c +++ b/dbus/gattlib.c @@ -905,6 +905,8 @@ static void add_characteristics_from_service(struct _gattlib_connection_backend* continue; } + GATTLIB_LOG(GATTLIB_DEBUG, "- count %d with characteristic %s\n", *count, object_path); + characteristic_list[*count].handle = handle; characteristic_list[*count].value_handle = handle; characteristic_list[*count].properties = 0; @@ -981,7 +983,9 @@ int gattlib_discover_char_range(gattlib_connection_t* connection, uint16_t start g_object_unref(interface); count_max++; + GATTLIB_LOG(GATTLIB_DEBUG, "- count_max %d with %s\n", count_max, object_path); } + GATTLIB_LOG(GATTLIB_DEBUG, "count_max:%d\n", count_max); gattlib_characteristic_t* characteristic_list = calloc(count_max * sizeof(gattlib_characteristic_t), 1); if (characteristic_list == NULL) { @@ -995,7 +999,7 @@ int gattlib_discover_char_range(gattlib_connection_t* connection, uint16_t start const char* object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object)); GDBusInterface *interface = g_dbus_object_manager_get_interface(device_manager, object_path, "org.bluez.GattService1"); - if (!interface) { + if (interface == NULL) { // Check if this DBUS Path is actually the Battery interface. In this case, // we add a fake characteristic for the battery. interface = g_dbus_object_manager_get_interface(device_manager, object_path, "org.bluez.Battery1"); @@ -1010,6 +1014,7 @@ int gattlib_discover_char_range(gattlib_connection_t* connection, uint16_t start "00002a19-0000-1000-8000-00805f9b34fb", MAX_LEN_UUID_STR + 1, &characteristic_list[count].uuid); + GATTLIB_LOG(GATTLIB_DEBUG, "- count with (battery) %s\n", object_path); count++; }