}
g_free(uuid_value);
}
- } else if (strcasecmp(key, "ManufacturerDataLen") == 0) {
+ } else if (strcasecmp(key, "LegacyManufacturerDataLen") == 0) {
g_variant_get(val, "q", &dev_info->manufacturer_data_len);
if (dev_info->manufacturer_data_len > BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX) {
BT_ERR("manufacturer_data_len is too long(len = %d)", dev_info->manufacturer_data_len);
if (dev_info->manufacturer_data_len == 0)
dev_info->manufacturer_data = g_strdup("");
- } else if (strcasecmp(key, "ManufacturerData") == 0) {
+ } else if (strcasecmp(key, "LegacyManufacturerData") == 0) {
int i = 0;
int len = 0;
GVariantIter *value_iter;
BT_DBG("-");
}
+gboolean __bt_handle_is_flight_mode_enabled(void)
+{
+#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
+ int is_flight_mode = 0;
+ int ret = -1;
+
+ ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight_mode);
+ if (ret != 0)
+ BT_ERR("vconf_get_bool failed");
+
+ return (is_flight_mode == 0) ? FALSE : TRUE;
+#else
+ return FALSE;
+#endif
+}
+
void _bt_handle_adapter_event(GVariant *msg, const char *member)
{
BT_DBG("+");
param);
g_free(address);
} else if (strcasecmp(member, BT_HARDWARE_ERROR) == 0) {
- BT_ERR_C("Hardware error received from BLUEZ");
+ 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");
+ BT_ERR_C("### Tx timeout error received from BLUEZ");
/* Don't add the recovery logic into platform */
#if 0
_bt_recover_adapter();
GError *err = NULL;
char *property = NULL;
GVariant *param = NULL;
+
g_variant_iter_init(&value_iter, msg);
while ((g_variant_iter_loop(&value_iter, "{sv}", &property, &val))) {
BT_INFO("Property %s", property);
if (strcasecmp(property, "Discovering") == 0) {
gboolean discovering = FALSE;
+
+ if (_bt_adapter_get_status() != BT_ACTIVATED)
+ return;
+
g_variant_get(val, "b", &discovering);
/* Send event to application */
BT_DBG("Discovering %d", discovering);
} else if (strcasecmp(property, "LEDiscovering") == 0) {
gboolean le_discovering = FALSE;
+ if (_bt_adapter_get_status() != BT_ACTIVATED ||
+ _bt_adapter_get_le_status() != BT_LE_ACTIVATED)
+ return;
+
g_variant_get(val, "b", &le_discovering);
/* Send event to application */
if (le_discovering == TRUE) {
#else
if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_state) == 0 &&
bt_state != VCONFKEY_BT_STATUS_OFF) {
- _bt_disable_adapter();
+ if (__bt_handle_is_flight_mode_enabled() == FALSE)
+ _bt_disable_adapter();
+ else
+ _bt_handle_adapter_removed();
}
#endif
if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_state) == 0 &&
g_variant_iter_init(&value_iter, msg);
char_handle = g_strdup(path);
while ((g_variant_iter_loop(&value_iter, "{sv}", &property, &val))) {
- BT_INFO("Property %s", property);
+ BT_DBG("Property %s", property);
ret_if(property == NULL);
if (strcasecmp(property, "Notifying") == 0) {
gboolean property_flag = FALSE;
g_variant_get(val, "b", &property_flag);
- if (property_flag == TRUE)
- BT_DBG("notifying is enabled");
- else
- BT_DBG("notifying is disabled");
+ BT_INFO("Notifying is %s", property_flag ? "enabled" : "disabled");
} else if (strcasecmp(property, "ChangedValue") == 0) {
int len = 0;
GByteArray *gp_byte_array = NULL;
gboolean connected = FALSE;
char *address;
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
g_variant_get(msg, "(b)", &connected);
}
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
ret_if(_bt_is_device_creating() == TRUE);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
g_variant_get(msg, "(y)", &addr_type);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
- dev_name = _bt_get_bonded_device_name(address);
+ dev_name = _bt_get_device_name(address);
_bt_convert_addr_string_to_secure_string(secure_address, address);
BT_INFO("Address : %s Type : %d", secure_address, addr_type);
!addr_type ? dev_name : secure_address);
g_free(dev_name);
+ if (addr_type)
+ _bt_add_le_connected_dev_info(address);
+
_bt_logging_connection(TRUE, addr_type);
param = g_variant_new("(isy)", result, address, addr_type);
/*Send event to application*/
result = disc_reason;
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
0x02 BDADDR_LE_RANDOM */
_bt_convert_addr_string_to_secure_string(secure_address, address);
BT_INFO("Address : %s Type : %d", secure_address, addr_type);
- BT_ERR_C("### Disconnected [%s] [%d : %s] [%s]", !addr_type ? "BREDR" : "LE",
- disc_reason, _bt_convert_disc_reason_to_string(disc_reason),
- !addr_type ? dev_name : secure_address);
+ BT_ERR_C("### Disconnected [%s] [%s] [%d : %s]", !addr_type ? "BREDR" : "LE",
+ !addr_type ? dev_name : secure_address,
+ disc_reason, _bt_convert_disc_reason_to_string(disc_reason));
g_free(dev_name);
_bt_headset_set_local_connection(FALSE);
_bt_logging_connection(FALSE, addr_type);
- if (!addr_type) {
+ if (addr_type)
+ _bt_remove_le_connected_dev_info(address);
+ else {
#ifdef TIZEN_BT_A2DP_SINK_AUTO_CONNECT
{
int bt_device_state = VCONFKEY_BT_DEVICE_NONE;
g_variant_get(msg, "(si)", &profile_uuid, &state);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
_bt_convert_addr_string_to_type(bd_addr.addr, address);
_bt_convert_addr_string_to_secure_string(secure_address, address);
- BT_DBG("Address: %s", secure_address);
- BT_DBG("Profile UUID: %s", profile_uuid);
- BT_DBG("State: %d", state);
+ BT_INFO_C("[%s] state: %s, addr: %s",
+ _bt_convert_uuid_to_string(profile_uuid),
+ _bt_convert_profile_state_to_string(state), secure_address);
if ((strcmp(profile_uuid, A2DP_SINK_UUID) == 0) &&
(state == BT_PROFILE_STATE_CONNECTED)) {
ret_if(_bt_is_le_scanning() == FALSE);
le_dev_info = g_malloc0(sizeof(bt_remote_le_dev_info_t));
- if (le_dev_info == NULL)
- return;
- g_variant_get(msg, "(syyii@ay)", &le_dev_info->address,
+ 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);
+ if (value == NULL) {
+ _bt_free_le_device_info(le_dev_info);
+ return;
+ }
+
_bt_convert_device_path_to_address(path, le_dev_info->address);
buffer_len = g_variant_get_size(value);
if (le_dev_info->adv_type != BT_LE_ADV_SCAN_RSP) { /* ADV_IND */
adv_info = g_malloc0(sizeof(bt_le_adv_info_t));
- if (adv_info == NULL) {
- _bt_free_le_device_info(le_dev_info);
- g_variant_unref(value);
- return;
- }
-
adv_info->addr = g_strdup(le_dev_info->address);
adv_info->addr_type = le_dev_info->addr_type;
adv_info->rssi = le_dev_info->rssi;
adv_info->data_len = le_dev_info->adv_data_len;
adv_info->data = g_malloc0(le_dev_info->adv_data_len);
- if (adv_info->data) {
- memcpy(adv_info->data, le_dev_info->adv_data,
- le_dev_info->adv_data_len);
- }
+ memcpy(adv_info->data, le_dev_info->adv_data,
+ le_dev_info->adv_data_len);
if (__bt_add_adv_ind_info(adv_info) == 0) {
adv_info->timer_id = g_timeout_add(1000,
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,
/* Set the headset name */
if (connected == TRUE)
- name = _bt_get_bonded_device_name(address);
+ name = _bt_get_device_name(address);
else
name = g_strdup("");
g_variant_get(value, "b", &property_flag);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
- if (address == NULL)
- return;
_bt_convert_device_path_to_address(path, address);
_bt_convert_addr_string_to_type(bd_addr.addr, address);
bt_cache_info_t *cache_info;
bt_remote_dev_info_t *dev_info;
- ret_if(_bt_is_discovering() == FALSE &&
- _bt_is_le_scanning() == FALSE);
+ if (_bt_is_discovering() == FALSE &&
+ _bt_is_le_scanning() == FALSE) {
+ g_variant_unref(value);
+ return;
+ }
cache_info = g_malloc0(sizeof(bt_cache_info_t));
- ret_if(cache_info == NULL);
dev_info = g_malloc0(sizeof(bt_remote_dev_info_t));
- if (dev_info == NULL) {
- __bt_free_cache_info(cache_info);
- return;
- }
cache_info->dev_info = dev_info;
}
if (strcasecmp(name, BT_BLUEZ_NAME) == 0) {
- BT_DBG("Bluetoothd is terminated");
+ BT_INFO_C("### Bluetoothd is terminated");
if (_bt_adapter_get_status() == BT_ACTIVATED)
_bt_disable_cb();
_bt_handle_adapter_removed();
__bt_devices_list_free();
+ _bt_service_adapter_le_deinit();
}
_bt_obex_server_check_allocation(&value);
_bt_rfcomm_server_check_termination(name);
}
+ /* Reset connection interval */
+ _bt_remove_all_le_conn_param_info(name);
+
/* Stop advertising started by terminated process */
_bt_stop_advertising_by_terminated_process(name);
+
/* Stop LE Scan */
_bt_stop_le_scan(name);
+
g_free(name);
g_free(previous);
g_free(current);
BT_DBG("-");
}
-