_bt_audio_connect(pdata->req_id,
BT_AUDIO_A2DP,
&device_address,
- pdata->out_param);
+ NULL);
g_free(pdata->address);
g_free(pdata);
}
if (func_data->pending != BT_PENDING_NONE && g_error == NULL) {
-
bluetooth_device_address_t device_address;
_bt_convert_addr_string_to_type(device_address.addr,
func_data->address);
pdata = g_new0(bt_audio_function_data_t, 1);
pdata->req_id = func_data->req_id;
- pdata->out_param = func_data->out_param;
pdata->address = strdup(func_data->address);
pdata->pending = func_data->pending;
} else
goto check_req_info;
} else {
-
if (_bt_is_service_connected(func_data->address
, BT_AUDIO_HSP)) {
_bt_audio_disconnect(func_data->req_id,
- BT_AUDIO_HSP,
- &device_address,
- func_data->out_param);
+ BT_AUDIO_HSP, &device_address, NULL);
} else
goto check_req_info;
}
_bt_convert_addr_string_to_type(device_address.addr,
g_wait_data->address);
_bt_audio_connect(g_wait_data->req_id, g_wait_data->type,
- &device_address, g_wait_data->out_param1);
+ &device_address, NULL);
}
/* Event will be sent by the event reciever */
#endif
static int __bt_is_headset_connected(int type, int req_id,
- const char *address, GArray *out_param1)
+ const char *address)
{
gboolean connected = FALSE;
char connected_address[BT_ADDRESS_STRING_SIZE + 1];
g_wait_data->req_id = req_id;
g_wait_data->type = type;
g_wait_data->ag_flag = FALSE;
- g_wait_data->out_param1 = out_param1;
/* Set disconnection type */
__bt_set_headset_disconnection_type(connected_address);
return value;
}
-
-
static int __bt_is_headset_connecting(int type)
{
bt_connected_headset_data_t *connected_device = NULL;
return BLUETOOTH_ERROR_NONE;
}
-
int __bt_is_headset_disconnecting(int type)
{
bt_connected_headset_data_t *connected_device = NULL;
node = g_list_first(g_connected_list);
while (node != NULL) {
connected_device = node->data;
- if (connected_device->device_state == BT_STATE_DISCONNECTING) {
+ if (connected_device->device_state == BT_STATE_DISCONNECTING)
return BLUETOOTH_ERROR_CONNECTION_BUSY;
- }
+
node = g_list_next(node);
}
return BLUETOOTH_ERROR_NONE;
}
-
void _bt_set_audio_wait_data_flag(gboolean flag)
{
BT_DBG("_bt_set_audio_wait_data_flag \n");
GDBusProxy *adapter_proxy;
GDBusConnection *g_conn;
int ret;
- char *uuid;
+ char *uuid = NULL;
int value = BLUETOOTH_ERROR_NONE;
bt_audio_function_data_t *func_data;
guint hfp_hs_restricted = 0x0; /* set default "allowed" */
adapter_proxy = _bt_get_adapter_proxy();
retv_if(adapter_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_conn = _bt_get_system_gconn();
+ g_conn = _bt_gdbus_get_system_gconn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data->req_id = request_id;
func_data->type = type;
func_data->pending = BT_PENDING_NONE;
- func_data->out_param = out_param1;
result = _bt_get_restrict_profile(device_address, RESTRICTED_PROFILE_HFP_HS, &hfp_hs_restricted);
if (result != BLUETOOTH_ERROR_NONE)
}
BT_INFO("Connecting to service %s", uuid);
- value = __bt_is_headset_connected(type, request_id, address, out_param1);
+ value = __bt_is_headset_connected(type, request_id, address);
if (value == BLUETOOTH_ERROR_ALREADY_CONNECT) {
return BLUETOOTH_ERROR_ALREADY_CONNECT;
return BLUETOOTH_ERROR_IN_PROGRESS;
}
+ if (out_param1)
+ g_array_free(out_param1, TRUE);
+
return BLUETOOTH_ERROR_NONE;
fail:
- g_array_append_vals(out_param1, address,
- BT_ADDRESS_STR_LEN);
+ if (out_param1 != NULL)
+ g_array_append_vals(out_param1, address,
+ BT_ADDRESS_STR_LEN);
return result;
}
adapter_proxy = _bt_get_adapter_proxy();
retv_if(adapter_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_conn = _bt_get_system_gconn();
+ g_conn = _bt_gdbus_get_system_gconn();
retv_if(g_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
_bt_convert_addr_type_to_string(address, device_address->addr);
func_data->address = g_strdup(address);
func_data->req_id = request_id;
func_data->pending = BT_PENDING_NONE;
- func_data->out_param = out_param1;
func_data->type = type;
switch (type) {
}
_bt_add_headset_to_list(type, BT_STATE_DISCONNECTING, address);
+ if (out_param1)
+ g_array_free(out_param1, TRUE);
+
return BLUETOOTH_ERROR_NONE;
fail:
if (out_param1 != NULL)
bt_function_data_t *func_data;
GDBusProxy *adapter_proxy;
GDBusConnection *g_conn;
+ gboolean connected = FALSE;
int ret;
char *uuid;
goto fail;
}
- g_conn = _bt_get_system_gconn();
+ g_conn = _bt_gdbus_get_system_gconn();
if (g_conn == NULL) {
result = BLUETOOTH_ERROR_INTERNAL;
goto fail;
}
+ /* Check if HF is connected or not */
+ result = _bt_is_device_connected(device_address, BT_PROFILE_CONN_HFG, &connected);
+ if (connected == TRUE) {
+ BT_ERR("HF is already connected");
+ result = BLUETOOTH_ERROR_ALREADY_CONNECT;
+ goto fail;
+ }
+
func_data = g_malloc0(sizeof(bt_function_data_t));
/* Fix : NULL_RETURNS */
if (func_data == NULL) {
return ret;
}
g_free(uuid);
+ if (out_param1)
+ g_array_free(out_param1, TRUE);
+
return BLUETOOTH_ERROR_NONE;
fail:
if (out_param1 != NULL)
goto fail;
}
- g_conn = _bt_get_system_gconn();
+ g_conn = _bt_gdbus_get_system_gconn();
if (g_conn == NULL) {
result = BLUETOOTH_ERROR_INTERNAL;
goto fail;
return ret;
}
g_free(uuid);
+ if (out_param1)
+ g_array_free(out_param1, TRUE);
+
return BLUETOOTH_ERROR_NONE;
fail:
if (out_param1 != NULL)
BT_DBG("+\n");
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
BT_DBG("Content Protection status = [%d]", status);
g_dbus_error_strip_remote_error(err);
BT_INFO("Auto_connect_request Dbus Call Error: %s", err->message);
- if (strcmp("Host is down", err->message))
- {
+ if (strcmp("Host is down", err->message)) {
BT_INFO("Fail reason is not 'Host Down'. Terminate auto connect");
_bt_audio_stop_auto_connect();
vconf_set_str(BT_LAST_CONNECTED_DEVICE, "");
BT_INFO("Start auto connection after linkloss");
result = _bt_service_set_alarm(BT_AUTO_CONNECT_TIMEOUT_AFTER_LINKLOSS,
__bt_auto_connect_alarm_cb, NULL, &alarm_id);
- if (result != BLUETOOTH_ERROR_NONE) {
+ if (result != BLUETOOTH_ERROR_NONE)
g_timeout_add(500, (GSourceFunc)__bt_audio_alarm_retry_cb, NULL);
- } else {
+ else
auto_connect_timer.alarm_id = alarm_id;
- }
+
} else {
BT_INFO("Start auto connection after BT activated");
result = _bt_service_set_alarm(BT_AUTO_CONNECT_TIMEOUT_AFTER_BT_ACTIVATED,