Handling characteristics properties Indicate and Notify functionality 31/188131/2
authorAvichal Agarwal <avichal.a@samsung.com>
Fri, 31 Aug 2018 12:45:00 +0000 (18:15 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Fri, 7 Sep 2018 06:10:54 +0000 (06:10 +0000)
A bool flag is forwarded  to bt-api to differentiate between
notify and indicate property.

Change-Id: I7a496e928ce425345555ef947293736720b7168d
Signed-off-by: Avichal Agarwal <avichal.a@samsung.com>
src/bluetooth-gatt.c

index df158d0..7e071bd 100644 (file)
@@ -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));