_bt_convert_addr_type_to_string(addr, address->addr);
- if (!_bt_is_service_connected(addr, BT_AUDIO_A2DP_SOURCE)) {
- BT_ERR("A2DP Disconnected for addr[%s], but it is already disconnected..", addr);
- return;
- }
/* Set VCONF status for A2DP Disconnection */
_bt_set_device_values(FALSE, VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED);
/* This means, AV Disconnect request has successfully passed, and real disconnect is completed */
BT_INFO("Neither AV Connect or AV Disconnect request is found..means, AV Profile is disconnected");
+ /*
+ * TODO: Below logic is not required for BT_AUDIO_CONNECT/BT_AUDIO_DISCONNECT.
+ * But if Tizen supports a device with A2DP Sink and HFP both profiles (BT_AUDIO_HFP_SOURCE)
+ * then below logic will be required for corresponding connect/disconnect function
+ */
+#if 0
req_info = _bt_get_request_info_data(BT_AUDIO_CONNECT, addr);
if (req_info == NULL) {
BT_INFO("Audio Connect All request is also Not found..");
BT_INFO("Pending connect is Not found..");
}
}
+#endif
goto check_wait_device;
} else {
BT_ERR("AV Connect request has failed.."); /* DBUS return needed */
result = BLUETOOTH_ERROR_INTERNAL;
+
+ /* Delete waiting device data if present for this device */
+ wait_device = _bt_get_audio_wait_data();
+ if (wait_device && strncasecmp(wait_device->address, addr, BT_ADDRESS_STRING_SIZE) == 0) {
+ _bt_rel_wait_data();
+ goto dbus_return;
+ }
+
goto check_wait_device;
}
} else {
connected = _bt_is_headset_type_connected(BT_AUDIO_A2DP, connected_address);
if (connected) {
+ BT_INFO("connected_address: %s", connected_address);
if (g_strcmp0(connected_address, addr) != 0) {
_bt_convert_addr_string_to_type(
device_address.addr,
_bt_convert_addr_type_to_string(addr, address->addr);
- if (!_bt_is_service_connected(addr, BT_AUDIO_A2DP)) {
- BT_ERR("A2DP Disconnected for addr[%s], but it is already disconnected..", addr);
- return;
- }
/* Set VCONF status for A2DP Disconnection */
_bt_set_device_values(FALSE, VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED);
} else {
BT_INFO("Pending connect is Not found..");
}
+
+ /* Delete waiting device data if present for this device */
+ wait_device = _bt_get_audio_wait_data();
+ if (wait_device && strncasecmp(wait_device->address, addr, BT_ADDRESS_STRING_SIZE) == 0) {
+ _bt_rel_wait_data();
+ goto dbus_return;
+ }
}
goto check_wait_device;
} else {
BT_ERR("AV Connect request has failed.."); /* DBUS return needed */
result = BLUETOOTH_ERROR_INTERNAL;
+ /* Delete waiting device data if present for this device */
+ wait_device = _bt_get_audio_wait_data();
+ if (wait_device && strncasecmp(wait_device->address, addr, BT_ADDRESS_STRING_SIZE) == 0) {
+ _bt_rel_wait_data();
+ goto dbus_return;
+ }
+
goto check_wait_device;
}
} else {
goto dbus_return;
}
+ BT_INFO("type: %d, ag_flag: %d, disconnection_type: %d", wait_device->type,
+ wait_device->ag_flag, wait_device->disconnection_type);
if (((wait_device->type == BT_AUDIO_ALL) &&
- (wait_device->ag_flag == TRUE)) ||
- (wait_device->type == BT_AUDIO_A2DP) ||
- (wait_device->disconnection_type == BT_AUDIO_A2DP)) {
+ (wait_device->ag_flag == TRUE)) ||
+ (wait_device->type == BT_AUDIO_A2DP) ||
+ (wait_device->disconnection_type & BT_AUDIO_A2DP)) {
if (g_strcmp0(wait_device->address, addr) != 0) {
BT_INFO("Trigger connect for the waiting device [%s], audio type [%d]",
wait_device->address, wait_device->type);
int value = BLUETOOTH_ERROR_NONE;
BT_DBG("Already connected headset addr [%s] connected headset type [0x%x] current dev conn type [0x%x]",
connected_address, connected_device->type, current_conn_type);
- if (connected_device->type == BT_AUDIO_ALL) {
- if (current_conn_type == BT_AUDIO_A2DP_SOURCE) {
- disconn_type = BT_AUDIO_A2DP;
- } else {
- disconn_type = connected_device->type & current_conn_type;
- }
- } else if (connected_device->type == BT_AUDIO_HFP_SOURCE) {
- if (current_conn_type == BT_AUDIO_A2DP) {
- disconn_type = BT_AUDIO_A2DP_SOURCE;
- } else {
- disconn_type = connected_device->type & current_conn_type;
- }
- } else {
- disconn_type = connected_device->type;
- }
+ disconn_type = connected_device->type & current_conn_type;
BT_DBG("Attempt disconnection of Type [0x%x] of already connected device" , disconn_type);
value = _bt_audio_disconnect(disconn_type, &device_address);
BT_ERR("No audio service connected");
return BLUETOOTH_ERROR_NOT_CONNECTED;
}
+ } else if (type == BT_AUDIO_HFP_SOURCE) {
+ if (_bt_is_service_connected(address, BT_AUDIO_A2DP_SOURCE)) {
+ type = BT_AUDIO_A2DP_SOURCE;
+ } else if (_bt_is_service_connected(address, BT_AUDIO_HSP)) {
+ type = BT_AUDIO_HSP;
+ } else {
+ BT_ERR("No audio service connected");
+ return BLUETOOTH_ERROR_NOT_CONNECTED;
+ }
}
value = __bt_is_headset_disconnecting(type);
typedef enum {
BT_AUDIO_HSP = 0x01, /* HSP Connection */
BT_AUDIO_A2DP = 0x02, /* A2DP Source Connection, remote device is A2DP Sink */
- BT_AUDIO_ALL = 0x03, /* HSP and A2DP Source Connection */
+ BT_AUDIO_ALL = 0x03, /* HSP and A2DP Source Connection (BT_AUDIO_HSP and BT_AUDIO_A2DP) */
BT_AVRCP_TARGET = 0x04, /* AVRCP Target Connection to remote AVRCP controller */
BT_AVRCP = 0x08, /* AVRCP ctrl Connection to remote AVRCP target */
BT_AUDIO_A2DP_SOURCE = 0x10, /* A2DP Sink Connection, remote device is A2DP Source */
- BT_AUDIO_HFP_SOURCE = 0x20 /* HSP and A2DP Sink Connection */
+ BT_AUDIO_HFP_SOURCE = 0x11 /* HSP and A2DP Sink Connection (BT_AUDIO_HSP and BT_AUDIO_A2DP_SOURCE)*/
} bt_audio_type_t;
typedef enum {