BT_CHECK_PARAMETER(service, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(service_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(char_uuid, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_DBG("+");
- system_gconn = _bt_get_system_private_conn();
+ system_gconn = _bt_get_system_common_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_get_system_private_conn();
+ conn = _bt_get_system_common_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_get_system_private_conn();
+ system_gconn = _bt_get_system_common_conn();
value = g_dbus_connection_call_finish(system_gconn, res, &error);
user_info = _bt_get_user_data(BT_COMMON);
GVariant *val, *options;
GVariantBuilder *builder1;
GVariantBuilder *builder2;
- GError *error = NULL;
GDBusConnection *conn;
int i = 0;
guint16 offset = 0;
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED(return);
- conn = _bt_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
builder1 = g_variant_builder_new(G_VARIANT_TYPE("ay"));
(GAsyncReadyCallback)__bluetooth_internal_write_cb,
NULL);
-
- if (error) {
- BT_ERR("Set value Failed: %s", error->message);
- g_clear_error(&error);
- g_variant_builder_unref(builder1);
- return BLUETOOTH_ERROR_INTERNAL;
- }
g_variant_builder_unref(builder1);
g_variant_builder_unref(builder2);
retv_if(length == 0, BLUETOOTH_ERROR_INVALID_PARAM);
BT_CHECK_ENABLED_INTERNAL(return);
- conn = _bt_get_system_private_conn();
+ conn = _bt_get_system_common_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_get_system_private_conn();
+ conn = _bt_get_system_common_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_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_CHECK_PARAMETER(characteristic_handle, return);
BT_CHECK_ENABLED(return);
- g_conn = _bt_get_system_private_conn();
+ g_conn = _bt_get_system_common_conn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
properties_proxy = g_dbus_proxy_new_sync(g_conn,
BT_DBG("+");
- system_gconn = _bt_get_system_private_conn();
+ system_gconn = _bt_get_system_common_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_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
resp_data = g_malloc0(sizeof(bt_gatt_resp_data_t));
BT_DBG("+");
- system_gconn = _bt_get_system_private_conn();
+ system_gconn = _bt_get_system_common_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_get_system_private_conn();
+ conn = _bt_get_system_common_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_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
BT_INFO("Disable CCCD : %s", char_handle);
- conn = _bt_get_system_private_conn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
g_dbus_connection_call_sync(conn,
if (written != length) {
att_result = BLUETOOTH_ERROR_INTERNAL;
BT_ERR("write data failed. ret : %d ", written);
+ if (TIZEN_FEATURE_DA_REFERENCE) {
+ /* If bluetooth_gatt_client_write_channel_watch_cb() is not called
+ * due to a server issue and write request fails,
+ * remove the existing fd from the list and reallocate it.*/
+ GSList *l;
+ for (l = gatt_characteristic_write_list; l != NULL; l = l->next) {
+ bt_gatt_characteristic_write_info_t *info = l->data;
+ if (!info)
+ continue;
+ if (info->write_fd == fd) {
+ gatt_characteristic_write_list = g_slist_remove(gatt_characteristic_write_list, info);
+ break;
+ }
+ }
+ }
}
return att_result;
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return result;
}
+
+BT_EXPORT_API int bluetooth_gatt_client_read_phy(const bluetooth_device_address_t *device_address)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(device_address, return);
+ BT_CHECK_ENABLED(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_GATT_CLIENT_READ_PHY,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result != BLUETOOTH_ERROR_NONE)
+ BT_INFO("GATT Client Read PHY failed result [%d]", result);
+ else
+ BT_INFO("GATT Client Read PHY successful");
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_gatt_client_set_phy(const bluetooth_device_address_t *device_address,
+ int tx_phy, int rx_phy, int phy_options)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(device_address, return);
+ BT_CHECK_ENABLED(return);
+
+ BT_INFO("Set PHY: Tx[%d], Rx[%d], Phy_options[%d]", tx_phy, rx_phy, phy_options);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, device_address, sizeof(bluetooth_device_address_t));
+ g_array_append_vals(in_param2, &tx_phy, sizeof(int));
+ g_array_append_vals(in_param3, &rx_phy, sizeof(int));
+ g_array_append_vals(in_param4, &phy_options, sizeof(int));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_GATT_CLIENT_SET_PHY,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result != BLUETOOTH_ERROR_NONE)
+ BT_INFO("GATT Client Set PHY failed result [%d]", result);
+ else
+ BT_INFO("GATT Client Set PHY successful");
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}