+ value = __bt_is_headset_connected(type, request_id, address);
+
+ if (value == BLUETOOTH_ERROR_ALREADY_CONNECT) {
+ return BLUETOOTH_ERROR_ALREADY_CONNECT;
+ } else if (value == BLUETOOTH_ERROR_NOT_CONNECTED) {
+ value = __bt_is_headset_connecting(type);
+ if (value != BLUETOOTH_ERROR_NONE) {
+ result = BLUETOOTH_ERROR_IN_PROGRESS;
+ goto fail;
+ }
+ _bt_headset_set_local_connection(TRUE);
+ ret = _bt_connect_profile(address, uuid,
+ __bt_audio_request_cb, func_data);
+
+ if (ret != BLUETOOTH_ERROR_NONE) {
+ BT_ERR("_bt_connect_profile Error");
+ _bt_headset_set_local_connection(FALSE);
+ g_free(func_data->address);
+ g_free(func_data);
+ return ret;
+ }
+
+ /* Add data to the connected list */
+ _bt_add_headset_to_list(type, BT_STATE_CONNECTING, address);
+ } else if (value == BLUETOOTH_ERROR_IN_PROGRESS) {
+ return BLUETOOTH_ERROR_IN_PROGRESS;
+ }
+
+ if (out_param1)
+ g_array_free(out_param1, TRUE);
+
+ return BLUETOOTH_ERROR_NONE;
+fail:
+ if (out_param1 != NULL)
+ g_array_append_vals(out_param1, address,
+ BT_ADDRESS_STR_LEN);
+
+ return result;
+}
+
+int _bt_audio_disconnect(int request_id, int type,
+ bluetooth_device_address_t *device_address,
+ GArray *out_param1)
+{
+ int result = BLUETOOTH_ERROR_NONE;
+ char address[BT_ADDRESS_STRING_SIZE] = { 0 };
+ bt_audio_function_data_t *func_data;
+ GDBusProxy *adapter_proxy;
+ GDBusConnection *g_conn;
+ GList *node;
+ int ret;
+ char *uuid;
+ int value = BLUETOOTH_ERROR_NONE;
+
+ BT_CHECK_PARAMETER(device_address, return);