Disable GATT Client fd based function
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-gatt-client.c
index 44d80fc..87819c4 100755 (executable)
@@ -2235,6 +2235,7 @@ static gboolean  bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio,
        return TRUE;
 }
 
+#ifndef TIZEN_FEATURE_BT_GATT_CLIENT_FD_DISABLE
 static bt_gatt_characteristic_notify_info_t * bluetooth_gatt_client_get_characteristic_notify_info(unsigned  char *handle , int id)
 {
        GSList *l;
@@ -2246,6 +2247,7 @@ static bt_gatt_characteristic_notify_info_t * bluetooth_gatt_client_get_characte
        }
        return NULL;
 }
+#endif
 
 static bt_gatt_characteristic_notify_info_t *  bluetooth_gatt_client_create_watch_io(int fd, int id, int mtu, char * address, unsigned char *uuid)
 {
@@ -2289,6 +2291,7 @@ BT_EXPORT_API int bluetooth_gatt_client_watch_characteristics(
        BT_CHECK_PARAMETER(service_handle, return);
        BT_CHECK_PARAMETER(char_handle, return);
 
+#ifndef TIZEN_FEATURE_BT_GATT_CLIENT_FD_DISABLE
        chr_info = bluetooth_gatt_client_get_characteristic_notify_info(char_handle->uuid , char_handle->instance_id);
        if (chr_info && !is_notify) {
                BT_INFO("Already CCCD enabled. fd %d", chr_info->notify_fd);
@@ -2296,6 +2299,7 @@ BT_EXPORT_API int bluetooth_gatt_client_watch_characteristics(
                close(chr_info->notify_fd);
                return result;
        }
+#endif
 
        /* ASync Function, result expected in callback from bt-service */
 
@@ -2318,6 +2322,16 @@ BT_EXPORT_API int bluetooth_gatt_client_watch_characteristics(
        g_array_append_vals(in_param3, &is_notify, sizeof(gboolean));
        g_array_append_vals(in_param4, &is_indicate, sizeof(gboolean));
 
+#ifdef TIZEN_FEATURE_BT_GATT_CLIENT_FD_DISABLE
+       result = _bt_send_request(BT_BLUEZ_SERVICE,
+                       BT_GATT_WATCH_CHARACTERISTIC,
+                       in_param1, in_param2, in_param3, in_param4, &out_param);
+
+       BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+       BT_INFO("Result [%d]", result);
+       return result;
+#endif
 
        GUnixFDList *out_fd_list = NULL;
 
@@ -2577,6 +2591,10 @@ BT_EXPORT_API int bluetooth_gatt_client_write_characteristic_value_by_type(
        g_array_append_vals(in_param2, data, sizeof(bluetooth_gatt_att_data_t));
        g_array_append_vals(in_param3, &write_type, sizeof(bluetooth_gatt_write_type_e));
 
+#ifdef TIZEN_FEATURE_BT_GATT_CLIENT_FD_DISABLE
+       goto done;
+#endif
+
        if (write_type == BLUETOOTH_GATT_TYPE_WRITE_NO_RESPONSE) {
                int fd = -1;
                int mtu = 0;