- if (strcasecmp(interface_name, BT_ADAPTER_INTERFACE) == 0) {
- __bt_adapter_property_changed_event(&item_iter,
- dbus_message_get_path(msg));
- } else if (strcasecmp(interface_name, BT_DEVICE_INTERFACE) == 0) {
- __bt_device_property_changed_event(&item_iter,
- dbus_message_get_path(msg));
- } else if (strcasecmp(interface_name,
- BT_OBEX_TRANSFER_INTERFACE) == 0) {
- __bt_obex_property_changed_event(&item_iter,
- dbus_message_get_path(msg));
- } else if (strcasecmp(interface_name,
- BT_MEDIA_CONTROL_INTERFACE) == 0) {
- __bt_handle_media_control_event(&item_iter,
- dbus_message_get_path(msg));
- } else if (strcasecmp(interface_name,
- BT_NETWORK_CLIENT_INTERFACE) == 0) {
- __bt_handle_network_client_event(&item_iter,
- dbus_message_get_path(msg));
- } else {
- BT_DBG("No bluez interface");
+ if (wait_list == NULL) {
+ g_free(address);
+ g_free(profile_uuid);
+ return;
+ }
+
+ if (((wait_list->type == BT_AUDIO_ALL) &&
+ (wait_list->ag_flag == TRUE)) ||
+ (wait_list->type == BT_AUDIO_A2DP) ||
+ (wait_list->disconnection_type == BT_AUDIO_A2DP)) {
+ bluetooth_device_address_t device_address;
+ _bt_convert_addr_string_to_type(
+ device_address.addr,
+ wait_list->address);
+
+ _bt_audio_connect(wait_list->req_id,
+ wait_list->type,
+ &device_address,
+ wait_list->out_param1);
+ }
+ } else if (strcmp(profile_uuid, AVRCP_TARGET_UUID) == 0) {
+
+ if (state == BT_PROFILE_STATE_CONNECTED) {
+ int event = BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED;
+ char connected_address[BT_ADDRESS_STRING_SIZE + 1];
+ bluetooth_device_address_t device_address;
+ gboolean connected;
+ param = g_variant_new("(is)", result, address);
+ _bt_send_event(BT_AVRCP_CONTROL_EVENT, event,
+ param);
+ connected = _bt_is_headset_type_connected(
+ BT_AVRCP,
+ connected_address);
+ if (connected) {
+ if (g_strcmp0(connected_address,
+ address) != 0) {
+ _bt_convert_addr_string_to_type(
+ device_address.addr,
+ connected_address);
+ _bt_audio_disconnect(0,
+ BT_AVRCP,
+ &device_address, NULL);
+ }
+ }
+ BT_DBG("device Path: %s", path);
+ _bt_add_headset_to_list(BT_AVRCP,
+ BT_STATE_CONNECTED, address);
+ } else if (state == BT_PROFILE_STATE_DISCONNECTED) {
+ int event = BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED;
+ param = g_variant_new("(is)", result, address);
+ _bt_send_event(BT_AVRCP_CONTROL_EVENT, event,
+ param);
+ /* Remove data from the connected list */
+ _bt_remove_headset_from_list(BT_AVRCP, address);
+ }
+ } else if (strcasecmp(profile_uuid, A2DP_SOURCE_UUID) == 0) {
+ if (state == BT_PROFILE_STATE_CONNECTED) {
+ int event = BLUETOOTH_EVENT_AV_SOURCE_CONNECTED;
+ BT_INFO("A2DP Source is connected");
+ _bt_send_event(BT_A2DP_SOURCE_EVENT, event,
+ g_variant_new("(is)", result, address));
+ } else if (state == BT_PROFILE_STATE_DISCONNECTED) {
+ int event = BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED;
+ BT_INFO("A2DP Source Disconnected");
+ _bt_send_event(BT_A2DP_SOURCE_EVENT, event,
+ g_variant_new("(is)", result, address));
+ }
+ } else if ((strcmp(profile_uuid, HID_UUID) == 0) &&
+ ((state == BT_PROFILE_STATE_CONNECTED) ||
+ (state == BT_PROFILE_STATE_DISCONNECTED))) {
+ int event;
+ if (state == BT_PROFILE_STATE_CONNECTED)
+ event = BLUETOOTH_HID_CONNECTED;
+ else
+ event = BLUETOOTH_HID_DISCONNECTED;
+ param = g_variant_new("(is)", result, address);
+ _bt_send_event(BT_HID_EVENT, event,
+ param);
+
+ if (state == BT_PROFILE_STATE_CONNECTED)
+ __bt_set_device_values(TRUE,
+ VCONFKEY_BT_DEVICE_HID_CONNECTED);
+ else
+ __bt_set_device_values(FALSE,
+ VCONFKEY_BT_DEVICE_HID_CONNECTED);
+ }
+ g_free(address);
+ g_free(profile_uuid);
+ } else if (strcasecmp(member, "AdvReport") == 0) {
+
+ bt_remote_le_dev_info_t *le_dev_info = NULL;
+ char *buffer = NULL;
+ int buffer_len = 0;
+ bt_le_adv_info_t *adv_info = NULL;
+ GVariant *value = NULL;
+ ret_if(_bt_is_le_scanning() == FALSE);
+
+ le_dev_info = g_malloc0(sizeof(bt_remote_le_dev_info_t));
+
+ g_variant_get(msg, "(syyii@ay)", &le_dev_info->address,
+ &le_dev_info->addr_type,
+ &le_dev_info->adv_type,
+ &le_dev_info->rssi,
+ &le_dev_info->adv_data_len,
+ &value);
+ buffer_len = g_variant_get_size(value);
+ if (buffer_len > 0)
+ buffer = (char *)g_variant_get_data(value);
+
+ le_dev_info->adv_data = g_memdup(buffer, buffer_len);
+
+ if (_bt_get_le_scan_type() == BT_LE_PASSIVE_SCAN) {
+ _bt_send_scan_result_event(le_dev_info, NULL);
+ _bt_free_le_device_info(le_dev_info);
+ g_variant_unref(value);
+ return;
+ }
+
+ if (le_dev_info->adv_type != BT_LE_ADV_SCAN_RSP) { /* ADV_IND */
+ adv_info = g_malloc0(sizeof(bt_le_adv_info_t));
+ adv_info->addr = g_strdup(le_dev_info->address);
+ adv_info->data_len = le_dev_info->adv_data_len;
+ adv_info->data = g_malloc0(le_dev_info->adv_data_len);
+ memcpy(adv_info->data, le_dev_info->adv_data,
+ le_dev_info->adv_data_len);
+
+ __bt_add_adv_ind_info(adv_info);
+
+ } else { /* SCAN_RSP */
+ adv_info = __bt_get_adv_ind_info(le_dev_info->address);
+ if (adv_info) {
+ _bt_send_scan_result_event(le_dev_info, adv_info);
+ __bt_del_adv_ind_info(le_dev_info->address);
+ }
+ }
+ _bt_free_le_device_info(le_dev_info);
+ g_variant_unref(value);