/*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hocheol Seo <hocheol.seo@samsung.com>
- * Girishashok Joshi <girish.joshi@samsung.com>
- * Chanyeol Park <chanyeol.park@samsung.com>
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int ps_mode_value = 0;
gboolean ret = FALSE;
- retv_if (vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE,
+ retv_if(vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE,
&flight_mode_value) != 0, FALSE);
- retv_if (vconf_get_int(BT_OFF_DUE_TO_POWER_SAVING_MODE,
+ retv_if(vconf_get_int(BT_OFF_DUE_TO_POWER_SAVING_MODE,
&ps_mode_value) != 0, FALSE);
if (flight_mode_value == 1 || ps_mode_value > 0) {
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);
- _bt_disable_adapter();
+#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter();
}
if (adapter_status_le == BT_LE_ACTIVATED) {
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);
- _bt_disable_adapter_le();
+#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter_le();
}
} else {
int flight_mode_value = 0;
_bt_core_get_bt_status(BT_FLIGHT_MODE) != 0) {
_bt_core_set_bt_status(BT_FLIGHT_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER);
- _bt_enable_adapter();
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter();
}
if (adapter_status_le == BT_LE_DEACTIVATED &&
_bt_core_get_bt_le_status(BT_FLIGHT_MODE) != 0) {
_bt_core_set_bt_le_status(BT_FLIGHT_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER_LE);
- _bt_enable_adapter_le();
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter_le();
}
}
}
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);
- _bt_disable_adapter();
+#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter();
}
if (adapter_status_le == BT_LE_ACTIVATED) {
int bt_le_status_before_mode = 0;
+
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);
- _bt_disable_adapter_le();
+#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter_le();
}
} else {
int ps_mode_value = 0;
if (adapter_status == BT_DEACTIVATED && (_bt_core_get_bt_status(BT_POWER_SAVING_MODE) != 0)) {
_bt_core_set_bt_status(BT_POWER_SAVING_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER);
- _bt_enable_adapter();
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter();
}
BT_DBG("BT LE status before Emergency mode() :%d", _bt_core_get_bt_le_status(BT_POWER_SAVING_MODE));
if (adapter_status_le == BT_LE_DEACTIVATED && _bt_core_get_bt_le_status(BT_POWER_SAVING_MODE) != 0) {
_bt_core_set_bt_le_status(BT_POWER_SAVING_MODE, 0);
/* Enable the BT LE */
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER_LE);
- _bt_enable_adapter_le();
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter_le();
}
}
}
-#ifdef TIZEN_BT_FLIGHTMODE_ENABLED
+
static void __bt_core_flight_mode_cb(keynode_t *node, void *data)
{
gboolean flight_mode = FALSE;
__bt_core_handle_adapter_with_flight_mode(flight_mode);
}
-#endif
-#ifndef TIZEN_WEARABLE
+#ifdef ENABLE_TIZEN_2_4
static void __bt_core_power_saving_mode_cb(keynode_t *node, void *data)
{
int power_saving_mode = 0;
void _bt_core_init_vconf_value(void)
{
gboolean flight_mode = FALSE;
+#ifndef ENABLE_TIZEN_2_4
int power_saving_mode = 0;
+#endif
+ int bt_flight_mode = 0;
+ int bt_ps_mode = 0;
_bt_core_handle_flight_mode_noti();
_bt_core_handle_power_saving_mode_noti();
flight_mode = _bt_core_is_flight_mode_enabled();
-#ifndef TIZEN_WEARABLE
- if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_saving_mode) != 0)
- BT_ERR("Fail to get the power_saving_mode status value");
+#ifndef ENABLE_TIZEN_2_4
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_saving_mode) != 0)
+ BT_ERR("Fail to get the power_saving_mode status value");
+ BT_DBG("flight_mode = %d, power_saving_mode = %d", flight_mode, power_saving_mode);
+ }
#endif
BT_DBG("flight_mode = %d, power_saving_mode = %d", flight_mode, power_saving_mode);
+ if (vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE, &bt_flight_mode))
+ BT_ERR("Fail get flight mode value");
+ _bt_core_set_bt_status(BT_FLIGHT_MODE, bt_flight_mode);
+
+ if (vconf_get_int(BT_OFF_DUE_TO_POWER_SAVING_MODE, &bt_ps_mode))
+ BT_ERR("Fail get power saving mode value");
+ _bt_core_set_bt_status(BT_POWER_SAVING_MODE, bt_ps_mode);
+
if (flight_mode == TRUE)
__bt_core_handle_adapter_with_flight_mode(flight_mode);
+#ifndef ENABLE_TIZEN_2_4
else if (power_saving_mode > 0)
__bt_core_handle_adapter_with_power_saving_mode(power_saving_mode);
+#endif
else
BT_ERR("");
}
void _bt_core_handle_flight_mode_noti(void)
{
-#ifdef TIZEN_BT_FLIGHTMODE_ENABLED
int ret;
- BT_DBG("+");
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ BT_DBG("+");
- ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_core_flight_mode_cb, NULL);
- if (ret < 0)
- BT_ERR("Unable to register key handler");
-#else
- BT_DBG("Telephony is disabled");
-#endif
+ ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_core_flight_mode_cb, NULL);
+ if (ret < 0)
+ BT_ERR("Unable to register key handler");
+ } else {
+ BT_DBG("Telephony is disabled");
+ }
}
void _bt_core_handle_power_saving_mode_noti(void)
{
-#ifndef TIZEN_WEARABLE
- int ret;
+ if (TIZEN_PROFILE_WEARABLE)
+ return;
BT_DBG("+");
+#ifdef ENABLE_TIZEN_2_4
+ int ret = 0;
+
ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
(vconf_callback_fn)__bt_core_power_saving_mode_cb, NULL);
-
if (ret < 0)
BT_ERR("Unable to register key handler");
#endif
void _bt_core_unregister_vconf_handler(void)
{
-#ifdef TIZEN_BT_FLIGHTMODE_ENABLED
- vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_core_flight_mode_cb);
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_core_flight_mode_cb);
+ }
-#ifndef TIZEN_WEARABLE
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
- (vconf_callback_fn)__bt_core_power_saving_mode_cb);
+#ifdef ENABLE_TIZEN_2_4
+ if (!TIZEN_PROFILE_WEARABLE) {
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ (vconf_callback_fn)__bt_core_power_saving_mode_cb);
+ }
#endif
return;