From 2ff089ee829315785cf7e7c5080d83b38631f965 Mon Sep 17 00:00:00 2001 From: Avichal Agarwal Date: Fri, 31 Aug 2018 18:15:00 +0530 Subject: [PATCH] Handling characteristics properties Indicate and Notify functionality A bool flag is forwarded to bt-api to differentiate between notify and indicate property. Change-Id: I7a496e928ce425345555ef947293736720b7168d Signed-off-by: Avichal Agarwal --- src/bluetooth-gatt.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index df158d0..7e071bd 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -4247,6 +4247,7 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, { int ret; bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)characteristic; + gboolean is_indicate = false; #ifdef TIZEN_GATT_CLIENT bt_gatt_handle_property_t svc_handle; @@ -4284,6 +4285,9 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, BT_INFO("Characteristic properties [%d] charc UUID [%s]", chr->properties, chr->uuid); + if (chr->properties & BT_GATT_PROPERTY_INDICATE) + is_indicate = true; + if (chr->properties & (BT_GATT_PROPERTY_NOTIFY | BT_GATT_PROPERTY_INDICATE)) { @@ -4293,7 +4297,8 @@ int bt_gatt_client_set_characteristic_value_changed_cb(bt_gatt_h characteristic, &svc_handle, &chr_handle, client_s->client_id, - TRUE)); + TRUE, + is_indicate)); #else bt_get_uuid_name(svc->uuid, &name); ret = _bt_get_error_code(bluetooth_gatt_watch_characteristics( @@ -4326,7 +4331,7 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi { int ret; bt_gatt_characteristic_s *chr = (bt_gatt_characteristic_s *)characteristic; - + gboolean is_indicate = false;; #ifdef TIZEN_GATT_CLIENT bt_gatt_handle_property_t svc_handle; bt_gatt_handle_property_t chr_handle; @@ -4351,6 +4356,10 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi __bt_string_to_uuid_hex(chr->uuid, chr_handle.uuid); chr_handle.instance_id = chr->instance_id; #endif + + if (chr->properties & BT_GATT_PROPERTY_INDICATE) + is_indicate = true; + if (chr->properties & (BT_GATT_PROPERTY_NOTIFY | BT_GATT_PROPERTY_INDICATE)) { #ifdef TIZEN_GATT_CLIENT @@ -4359,7 +4368,8 @@ int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristi &svc_handle, &chr_handle, client_s->client_id, - FALSE)); + FALSE, + is_indicate)); #else ret = _bt_get_error_code( bluetooth_gatt_unwatch_characteristics(chr->path)); -- 2.7.4