BT_CHECK_PARAMETER(service, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
service_handle,
BT_PROPERTIES_INTERFACE,
BT_CHECK_PARAMETER(service_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
service_handle,
BT_PROPERTIES_INTERFACE,
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
char_handle,
BT_PROPERTIES_INTERFACE,
BT_CHECK_PARAMETER(char_uuid, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
service_handle,
BT_PROPERTIES_INTERFACE,
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
descriptor_handle,
BT_PROPERTIES_INTERFACE,
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
BT_CHECK_PARAMETER(chr, return);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
resp_data = g_malloc0(sizeof(bt_gatt_resp_data_t));
int att_ecode = 0;
bt_gatt_resp_data_t *resp_data = user_data;
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED_INTERNAL(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
const gchar *key;
char_descriptor_type_t desc_type = TYPE_NONE;
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
char_handle,
BT_PROPERTIES_INTERFACE,
BT_CHECK_PARAMETER(characteristic_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_gdbus_get_system_gconn();
+ g_conn = _bt_get_system_private_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
- G_DBUS_PROXY_FLAGS_NONE, NULL,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL,
BT_BLUEZ_NAME,
characteristic_handle,
BT_PROPERTIES_INTERFACE,
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
BT_CHECK_PARAMETER(desc, return);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
resp_data = g_malloc0(sizeof(bt_gatt_resp_data_t));
BT_DBG("+");
- system_gconn = _bt_gdbus_get_system_gconn();
+ system_gconn = _bt_get_system_private_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
BT_INFO_C("### Enable CCCD : %s [%s]", char_handle + 15, svc_name);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
BT_INFO("Disable CCCD : %s", char_handle);
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_private_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
if (len > 0 && len < chr_info->mtu) {
bt_gatt_char_property_t char_val;
- BT_INFO("FD io sending value changed %x %x %x %x %x %x %x %d \n", buffer[0], buffer[1], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], len);
+ BT_INFO("FD io sending value changed %x %x %x %x %x %x %x %zd \n", buffer[0], buffer[1], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], len);
memcpy(char_val.prop.uuid, chr_info->UUID, 16);
memcpy(char_val.value, buffer, len);
char_val.val_len = len;
- memcpy(char_val.address, chr_info->adress, 18);
+ memcpy(char_val.address, chr_info->address, 18);
event_info = _bt_event_get_cb_data(BT_GATT_CLIENT_EVENT);
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;
}
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)
{
chr_info->notify_fd = fd;
chr_info->id = id;
chr_info->mtu = mtu;
- g_strlcpy(chr_info->adress, address, 18);
+ g_strlcpy(chr_info->address, address, 18);
memcpy(chr_info->UUID, uuid, 16);
channel = g_io_channel_unix_new(fd);
+
+ chr_info->io_channel = channel;
+
g_io_channel_set_encoding(channel, NULL, NULL);
g_io_channel_set_buffered(channel, FALSE);
- g_io_channel_set_close_on_unref(channel, FALSE);
+ g_io_channel_set_close_on_unref(channel, TRUE);
g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP),
+
+ chr_info->watch_id = g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP),
bluetooth_gatt_client_notify_channel_watch_cb, chr_info);
return chr_info;
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);
- close(chr_info->notify_fd);
+ if (chr_info->watch_id > 0)
+ g_source_remove(chr_info->watch_id);
+
+ if (chr_info->io_channel) {
+ g_io_channel_shutdown(chr_info->io_channel, TRUE, NULL);
+ g_io_channel_unref(chr_info->io_channel);
+ }
+
+ gatt_characteristic_notify_list = g_slist_remove(gatt_characteristic_notify_list, chr_info);
+
+ g_free(chr_info);
+
return result;
}
+#endif
/* ASync Function, result expected in callback from bt-service */
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;
if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("Fail to send request");
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
- } else if (NULL == out_fd_list) {
- BT_ERR("out_fd_list is NULL");
-
- } else {
-
- int *fd_list_array;
- int len = 0;
- int mtu;
- int fd = -1;;
-
- if (!out_fd_list)
- return BLUETOOTH_ERROR_INTERNAL;
-
- fd_list_array = g_unix_fd_list_steal_fds(out_fd_list, &len);
- BT_INFO("Num fds in fd_list is : %d, fd_list[0]: %d", len, fd_list_array[0]);
- fd = fd_list_array[0];
- mtu = g_array_index(out_param, int, 0);
+ }
- chr_info = bluetooth_gatt_client_create_watch_io(fd, char_handle->instance_id, mtu, (char *)address, char_handle->uuid);
+ if (is_indicate == false) {
+ if (NULL == out_fd_list) {
+ BT_ERR("out_fd_list is NULL");
+ result = BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ int *fd_list_array;
+ int len = 0;
+ int mtu;
+ int fd = -1;
+
+ fd_list_array = g_unix_fd_list_steal_fds(out_fd_list, &len);
+ BT_INFO("Num fds in fd_list is : %d, fd_list[0]: %d", len, fd_list_array[0]);
+ fd = fd_list_array[0];
+ mtu = g_array_index(out_param, int, 0);
- gatt_characteristic_notify_list = g_slist_append(gatt_characteristic_notify_list, chr_info);
+ chr_info = bluetooth_gatt_client_create_watch_io(fd, char_handle->instance_id, mtu, (char *)address, char_handle->uuid);
- g_free(fd_list_array);
- g_object_unref(out_fd_list);
+ gatt_characteristic_notify_list = g_slist_append(gatt_characteristic_notify_list, chr_info);
+ g_free(fd_list_array);
+ g_object_unref(out_fd_list);
+ }
}
/*result = _bt_send_request(BT_BLUEZ_SERVICE,
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;