static GList *p_cache_list = NULL;
static guint event_id;
+static guint session_reinit_timer;
guint nap_connected_device_count = 0;
static guint hid_connected_device_count = 0;
static GList *p_adv_ind_list = NULL;
retv_if(!addr, NULL);
bt_le_adv_info_t *adv_info = NULL;
GList *current = g_list_first((GList *)p_adv_ind_list);
- while(current && current->data) {
+ while (current && current->data) {
adv_info = (bt_le_adv_info_t *)current->data;
if (adv_info && !g_strcmp0(adv_info->addr, addr))
return adv_info;
} else if (strcasecmp(key, "UUIDs") == 0) {
char **uuid_value;
gsize size = 0;
- int i =0;
+ int i = 0;
size = g_variant_get_size(val);
if (size > 0) {
bt_remote_dev_info_t *dev_info)
{
char *path = NULL;
- GVariant *optional_param;
+ GVariant *optional_param = NULL;
GVariantIter iter;
GVariant *child;
char *interface_name = NULL;
&path, &optional_param);
g_variant_iter_init(&iter, optional_param);
+ retv_if(optional_param == NULL, FALSE);
+
while ((child = g_variant_iter_next_value(&iter))) {
g_variant_get(child, "{&s@a{sv}}", &interface_name, &inner_iter);
if (g_strcmp0(interface_name, BT_DEVICE_INTERFACE) == 0) {
}
}
g_variant_unref(inner_iter);
- g_variant_unref(child);
+ g_variant_unref(child);
}
- if (optional_param)
- g_variant_unref(optional_param);
+
+ g_variant_unref(optional_param);
return FALSE;
}
g_free(address);
} else if (strcasecmp(member, BT_HARDWARE_ERROR) == 0) {
BT_ERR_C("Hardware error received from BLUEZ");
+/* Don't add the recovery logic into platform */
+#if 0
_bt_recover_adapter();
+#endif
} else if (strcasecmp(member, BT_TX_TIMEOUT_ERROR) == 0) {
BT_ERR_C("Tx timeout error received from BLUEZ");
+/* Don't add the recovery logic into platform */
+#if 0
_bt_recover_adapter();
+#endif
}
BT_DBG("-");
}
*/
_bt_obex_check_pending_transfer(address);
_bt_opp_client_is_sending(&sending);
- if(sending == TRUE)
+ if (sending == TRUE)
_bt_opp_client_check_pending_transfer(address);
}
param = g_variant_new("(isy)", result, address, addr_type);
_bt_audio_connect(wait_list->req_id,
wait_list->type,
&device_address,
- wait_list->out_param1);
+ NULL);
}
} else if (strcmp(profile_uuid, AVRCP_TARGET_UUID) == 0) {
_bt_audio_connect(wait_list->req_id,
wait_list->type,
&device_address,
- wait_list->out_param1);
+ NULL);
/* Now free the wait list */
_bt_rel_wait_data();
}
event,
param);
g_free(address);
- }
+ } else if (strcasecmp(member, "iBeaconReport") == 0) {
+ bt_remote_ibeacon_dev_info_t *ibeacon_dev_info = NULL;
+
+ ret_if(_bt_is_le_scanning() == FALSE);
+ ibeacon_dev_info = g_malloc0(sizeof(bt_remote_ibeacon_dev_info_t));
+ if (ibeacon_dev_info == NULL)
+ return;
+
+ g_variant_get(msg, "(syuusuuy)", &ibeacon_dev_info->address,
+ &ibeacon_dev_info->addr_type,
+ &ibeacon_dev_info->company_id,
+ &ibeacon_dev_info->ibeacon_type,
+ &ibeacon_dev_info->uuid,
+ &ibeacon_dev_info->major_id,
+ &ibeacon_dev_info->minor_id,
+ &ibeacon_dev_info->measured_power);
+ _bt_send_ibeacon_scan_result_event(ibeacon_dev_info);
+ g_free(ibeacon_dev_info);
+ }
}
void __bt_set_audio_values(gboolean connected, char *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);
+ &device_address, NULL);
_bt_rel_wait_data();
} else if (event == BLUETOOTH_EVENT_AG_CONNECTED) {
/* Add data to the connected list */
_bt_audio_connect(wait_list->req_id,
wait_list->type,
&device_address,
- wait_list->out_param1);
+ NULL);
}
g_free(address);
} else if (strcasecmp(value, "Connected") == 0) {
return BLUETOOTH_ERROR_NONE;
}
+gboolean __bt_reinit_obexd_receiver(gpointer user_data)
+{
+ static int retry_cnt = 0;
+ int result = BLUETOOTH_ERROR_NONE;
+
+ BT_DBG("+");
+
+ result = __bt_init_obexd_receiver();
+ if (result != BLUETOOTH_ERROR_NONE) {
+ /* 20 ms * 50 = 10 seconds. During 10 seconds fail to initialize,
+ then it is not the timing issue. Just can't use the session bus connection */
+ if (retry_cnt > 100) {
+ BT_ERR("Fail to init obexd receiver by 50 times.");
+ retry_cnt = 0;
+ session_reinit_timer = 0;
+ return FALSE;
+ }
+ retry_cnt++;
+ BT_DBG("Retry to initialize the obexd receiver");
+ return TRUE;
+ }
+
+ retry_cnt = 0;
+ session_reinit_timer = 0;
+
+ BT_DBG("-");
+
+ return FALSE;
+}
+
/* To receive the event from bluez */
int _bt_init_service_event_receiver(void)
{
retv_if(result != BLUETOOTH_ERROR_NONE, result);
result = __bt_init_obexd_receiver();
- if (result != BLUETOOTH_ERROR_NONE)
+ if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("Fail to init obexd receiver");
+ /* Try to re-initialize obexd receiver in the timer */
+ if (session_reinit_timer > 0)
+ g_source_remove(session_reinit_timer);
+
+ session_reinit_timer = g_timeout_add(BT_SESSION_BUS_GET_TIMEOUT,
+ (GSourceFunc)__bt_reinit_obexd_receiver, NULL);
+ }
+
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;