static gboolean a2dp_init_pending = FALSE;
-
/* Adapter default states */
static bt_status_t adapter_state = BT_DEACTIVATED;
static bt_adapter_discovery_state_t adapter_discovery_state = ADAPTER_DISCOVERY_STOPPED;
if (discoverable_mode == BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE) {
ret = _bt_stop_visibility_timer();
+ if (BLUETOOTH_ERROR_NONE != ret)
+ BT_ERR("_bt_stop_visibility_timer failed");
if (!TIZEN_PROFILE_WEARABLE) {
if (vconf_set_int(BT_FILE_VISIBLE_TIME, -1) != 0)
BT_ERR("Set vconf failed");
}
} else if (discoverable_mode == BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE) {
ret = _bt_start_visibility_timer(timeout);
+ if (BLUETOOTH_ERROR_NONE != ret)
+ BT_ERR("_bt_start_visibility_timer failed");
} else {
ret = _bt_stop_visibility_timer();
+ if (BLUETOOTH_ERROR_NONE != ret)
+ BT_ERR("_bt_stop_visibility_timer failed");
}
BT_DBG("-");
int _bt_init_profiles()
{
int ret;
+ BT_INFO("+");
/*TODO: Init bluetooth profiles */
ret = _bt_hidhost_initialize();
if (ret != BLUETOOTH_ERROR_NONE)
BT_ERR("_bt_gatt_init Failed");
+ /* Initialize HF Client */
+ ret = _bt_audio_initialize(BT_HFP_MODULE);
+ if (ret != BLUETOOTH_ERROR_NONE)
+ BT_ERR("_bt_audio_initialize(BT_HFP_MODULE) Failed");
+
return BLUETOOTH_ERROR_NONE;
}
BT_INFO("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
{
BT_INFO("__bt_adapter_post_set_enabled>>");
- if (!TIZEN_PROFILE_TV) {
- __bt_set_visible_mode();
-
- /* add the vconf noti handler */
- if (0 != vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
- (vconf_callback_fn)__bt_phone_name_changed_cb, NULL))
- BT_ERR("DEVICE_NAME key changed notification registration failed");
-
- __bt_set_local_name();
- } else {
+ if (TIZEN_PROFILE_TV || !headed_plugin_info->plugin_headed_enabled) {
if (BLUETOOTH_ERROR_NONE != _bt_set_discoverable_mode(
BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0))
BT_ERR("Fail to set discoverable mode");
+ } else {
+ __bt_set_visible_mode();
}
+ /* add the vconf noti handler */
+ if (0 != vconf_notify_key_changed(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
+ (vconf_callback_fn)__bt_phone_name_changed_cb, NULL))
+ BT_ERR("DEVICE_NAME key changed notification registration failed");
+
+ __bt_set_local_name();
+
/* Get All properties */
if (OAL_STATUS_SUCCESS != adapter_get_properties())
BT_ERR("adapter_get_properties failed");
BT_ERR("vconf_ignore_key_changed failed");
}
+ /* bt-service should be terminated when BT is off */
+ if (!TIZEN_FEATURE_BT_USB_DONGLE) {
+ /* TODO: Implement to check if it is the recovery mode or not */
+ _bt_reliable_terminate_service(NULL);
+ }
+
return FALSE;
}
}
}
+int _bt_set_adapter_request_state(int enable)
+{
+ return oal_set_adapter_request_state(enable);
+}
+
+int _bt_set_le_request_state(int enable)
+{
+ return oal_set_le_request_state(enable);
+}
+
static int __bt_adapter_state_handle_request(gboolean enable)
{
int result = BLUETOOTH_ERROR_NONE;
case ADAPTER_DISCOVERY_STARTING: {
BT_INFO("Adapter is currently in discovery starting state, state [%d]",
adapter_discovery_state);
- if (enable) {
- return BLUETOOTH_ERROR_IN_PROGRESS;
- } else {
- result = adapter_stop_inquiry();
- if (result != OAL_STATUS_SUCCESS) {
- BT_ERR("Discover stop failed: %d", result);
- result = BLUETOOTH_ERROR_INTERNAL;
- } else {
- BT_ERR("Stop Discovery Triggered successfully");
- __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STOPPING);
- result = BLUETOOTH_ERROR_NONE;
- }
- }
+
+ result = enable ? BLUETOOTH_ERROR_IN_PROGRESS :
+ BLUETOOTH_ERROR_DEVICE_BUSY;
+
break;
}
case ADAPTER_DISCOVERY_STOPPED: {
case ADAPTER_DISCOVERY_STOPPING: {
BT_INFO("Adapter is currently in discovery stopping state, state [%d]",
adapter_discovery_state);
- if (!enable)
- return BLUETOOTH_ERROR_NOT_IN_OPERATION;
- else {
- BT_DBG("max_resp: %u, duration: %u, cod: 0x%X", max_response, duration, mask);
- if (!is_custom)
- result = adapter_start_inquiry(duration);
- else
- result = adapter_start_custom_inquiry(role);
- if (result != OAL_STATUS_SUCCESS) {
- BT_ERR("Start Discovery failed: %d", result);
- result = BLUETOOTH_ERROR_INTERNAL;
- } else {
- BT_ERR("Start Discovery Triggered successfully");
- __bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STARTING);
- result = BLUETOOTH_ERROR_NONE;
- }
- }
+
+ result = enable ? BLUETOOTH_ERROR_DEVICE_BUSY :
+ BLUETOOTH_ERROR_NOT_IN_OPERATION;
+
break;
}
default:
if (vconf_set_int(VCONFKEY_BT_DEVICE, VCONFKEY_BT_DEVICE_NONE) != 0)
BT_ERR("Set vconf failed\n");
- _bt_cancel_queued_transfers();
_bt_adapter_set_status(BT_DEACTIVATED);
__bt_adapter_update_discovery_status(ADAPTER_DISCOVERY_STOPPED);