diff options
author | Wootak Jung <wootak.jung@samsung.com> | 2024-03-08 08:35:40 +0900 |
---|---|---|
committer | Wootak Jung <wootak.jung@samsung.com> | 2024-03-08 11:39:41 +0900 |
commit | ec0d53e364291ced79e53d95ee42cba27e090ab5 (patch) | |
tree | 3727ef43f08425049c0bb9e1c6a79c756935d4e5 /src/gatt-client.c | |
parent | a0d1d0c7aa401be39beb2d7fa385ff4da8b6ea10 (diff) | |
download | bluez-ec0d53e364291ced79e53d95ee42cba27e090ab5.tar.gz bluez-ec0d53e364291ced79e53d95ee42cba27e090ab5.tar.bz2 bluez-ec0d53e364291ced79e53d95ee42cba27e090ab5.zip |
gatt-client: Add debug logsaccepted/tizen/7.0/unified/20240308.120333
Change-Id: Id46df448a9bf77b00ae6168dd04b0e4f38fa3ebe
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r-- | src/gatt-client.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c index 0759b098..50f775a4 100644 --- a/src/gatt-client.c +++ b/src/gatt-client.c @@ -1502,6 +1502,10 @@ static void notify_client_disconnect(DBusConnection *conn, void *user_data) queue_remove(chrc->notify_clients, client); queue_remove(chrc->service->client->all_notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. length: %d", queue_length(chrc->notify_clients)); + DBG("Removed client from all_notify_clients. length: %d", queue_length(chrc->service->client->all_notify_clients)); +#endif update_notifying(chrc); @@ -1608,6 +1612,10 @@ static void register_notify_cb(uint16_t att_ecode, void *user_data) if (att_ecode) { queue_remove(chrc->notify_clients, client); queue_remove(chrc->service->client->all_notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. length: %d", queue_length(chrc->notify_clients)); + DBG("Removed client from all_notify_clients. length: %d", queue_length(chrc->service->client->all_notify_clients)); +#endif notify_client_free(client); create_notify_reply(op, false, att_ecode); @@ -1658,6 +1666,9 @@ static void register_notify_io_cb(uint16_t att_ecode, void *user_data) if (att_ecode) { queue_remove(chrc->notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. length: %d", queue_length(chrc->notify_clients)); +#endif notify_client_free(client); return; } @@ -1677,8 +1688,18 @@ static void notify_io_destroy(void *data) { struct notify_client *client = data; +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("notify_io destroyed. length: %d", queue_length(client->chrc->notify_clients)); + if (queue_remove(client->chrc->notify_clients, client)) { + DBG("Removed client from notify_clients. length: %d", queue_length(client->chrc->notify_clients)); + notify_client_unref(client); + } else { + DBG("Failed to remove client"); + } +#else if (queue_remove(client->chrc->notify_clients, client)) notify_client_unref(client); +#endif } static DBusMessage *characteristic_acquire_notify(DBusConnection *conn, @@ -1728,6 +1749,10 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn, } queue_push_tail(chrc->notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Registered noti with id: %d", client->notify_id); + DBG("Added client to notify_clients. length: %d", queue_length(chrc->notify_clients)); +#endif #ifndef TIZEN_FEATURE_BLUEZ_MODIFY chrc->notify_io = new0(struct sock_io, 1); @@ -1774,6 +1799,10 @@ static DBusMessage *characteristic_start_notify(DBusConnection *conn, queue_push_tail(chrc->notify_clients, client); queue_push_tail(chrc->service->client->all_notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Added client to notify_clients. length: %d", queue_length(chrc->notify_clients)); + DBG("Added client to all_notify_clients. length: %d", queue_length(chrc->service->client->all_notify_clients)); +#endif /* * If the device is currently not connected, return success. We will @@ -1801,14 +1830,25 @@ static DBusMessage *characteristic_start_notify(DBusConnection *conn, chrc->value_handle, register_notify_cb, notify_cb, op, async_dbus_op_free); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + if (client->notify_id) { + DBG("Registered noti with id: %d", client->notify_id); + return NULL; + } +#else if (client->notify_id) return NULL; +#endif async_dbus_op_free(op); fail: queue_remove(chrc->notify_clients, client); queue_remove(chrc->service->client->all_notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. length: %d", queue_length(chrc->notify_clients)); + DBG("Removed client from all_notify_clients. length: %d", queue_length(chrc->service->client->all_notify_clients)); +#endif /* Directly free the client */ notify_client_free(client); @@ -1836,6 +1876,11 @@ static DBusMessage *characteristic_stop_notify(DBusConnection *conn, return btd_error_failed(msg, "No notify session started"); queue_remove(chrc->service->client->all_notify_clients, client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. length: %d", queue_length(chrc->notify_clients)); + DBG("Removed client from all_notify_clients. length: %d", queue_length(chrc->service->client->all_notify_clients)); + DBG("Unregister noti with id: %d", client->notify_id); +#endif bt_gatt_client_unregister_notify(gatt, client->notify_id); update_notifying(chrc); @@ -1971,6 +2016,9 @@ static void characteristic_free(void *data) } queue_destroy(chrc->notify_clients, remove_client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Destroyed notify_clients. length: %d", queue_length(chrc->notify_clients)); +#endif att = bt_gatt_client_get_att(gatt); if (att) @@ -2056,6 +2104,11 @@ static struct characteristic *characteristic_create( chrc, NULL); DBG("Exported GATT characteristic: %s", chrc->path); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + char uuid_str[MAX_LEN_UUID_STR + 1]; + bt_uuid_to_string(&uuid, uuid_str, sizeof(uuid_str)); + DBG("- uuid: %s", uuid_str); +#endif return chrc; } @@ -2576,6 +2629,10 @@ static void register_notify(void *data, void *user_data) queue_remove(notify_client->chrc->notify_clients, notify_client); queue_remove(client->all_notify_clients, notify_client); +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Removed client from notify_clients. lenth: %d", queue_length(notify_client->chrc->notify_clients)); + DBG("Removed client from all_notify_clients. length: %d", queue_length(client->all_notify_clients)); +#endif notify_client_free(notify_client); } @@ -2821,6 +2878,10 @@ static void clear_notify_id(void *data, void *user_data) { struct notify_client *client = data; +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + DBG("Unregister noti with id: %d", client->notify_id); + bt_gatt_client_unregister_notify(client->chrc->service->client->gatt, client->notify_id); +#endif client->notify_id = 0; } |