static bt_status_t adapter_status = BT_DEACTIVATED;
static bt_le_status_t adapter_le_status = BT_LE_DEACTIVATED;
static gboolean is_recovery_mode = FALSE;
+static guint core_enable_timer_id;
+
static int bt_status_before[BT_MODE_MAX] = { VCONFKEY_BT_STATUS_OFF, };
static int bt_le_status_before[BT_MODE_MAX] = { VCONFKEY_BT_LE_STATUS_OFF, };
int _bt_core_service_request_adapter(int service_function)
{
- /* busact module is not in platform */
-#ifndef TIZEN_FEATURE_BUSACT
- return BLUETOOTH_ERROR_NONE;
-#else
int ret = -1;
GArray *in_param1 = NULL;
BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
return ret;
-#endif
}
static gboolean __bt_core_check_the_adapter_path(GDBusConnection *conn)
gboolean _bt_core_recover_adapter(void)
{
int ret;
-#ifdef TIZEN_FEATURE_BUSACT
+#if 0
int ret_le;
#endif
BT_INFO_C("Recover bt adapter");
if (_bt_core_get_status() == BT_ACTIVATED) {
_bt_core_set_bt_status(BT_RECOVERY_MODE, 1);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
+#endif
}
if (_bt_core_get_le_status() == BT_LE_ACTIVATED) {
_bt_core_set_bt_le_status(BT_RECOVERY_MODE, 1);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
+#endif
}
ret = _bt_disable_adapter();
{
BT_DBG("+");
+ core_enable_timer_id = 0;
+
_bt_core_init_vconf_value();
return FALSE;
_bt_core_update_status();
- g_timeout_add(200, (GSourceFunc)__bt_core_enable_core_timeout_cb, NULL);
+ if (core_enable_timer_id > 0)
+ g_source_remove(core_enable_timer_id);
+
+ core_enable_timer_id = g_timeout_add(200, (GSourceFunc)__bt_core_enable_core_timeout_cb, NULL);
BT_DBG("-");
return TRUE;
if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status_before_mode) == 0)
_bt_core_set_bt_status(BT_FLIGHT_MODE, bt_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
+#endif
_bt_disable_adapter();
}
if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_le_status_before_mode) == 0)
_bt_core_set_bt_le_status(BT_FLIGHT_MODE, bt_le_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
+#endif
_bt_disable_adapter_le();
}
if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status_before_mode) == 0)
_bt_core_set_bt_status(BT_FLIGHT_MODE, bt_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
+#endif
#ifndef USB_BLUETOOTH
_bt_disable_adapter();
#endif
if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_le_status_before_mode) == 0)
_bt_core_set_bt_le_status(BT_FLIGHT_MODE, bt_le_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
+#endif
#ifndef USB_BLUETOOTH
_bt_disable_adapter_le();
#endif
if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status_before_mode) == 0)
_bt_core_set_bt_status(BT_POWER_SAVING_MODE, bt_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
+#endif
#ifndef USB_BLUETOOTH
_bt_disable_adapter();
#endif
if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_le_status_before_mode) == 0)
_bt_core_set_bt_le_status(BT_POWER_SAVING_MODE, bt_le_status_before_mode);
+#ifdef TIZEN_FEATURE_BUSACT
/* Disable the BT LE */
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
+#endif
#ifndef USB_BLUETOOTH
_bt_disable_adapter_le();
#endif
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("+");
#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 &&