X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-core%2Fbt-core-noti-handler.c;h=9fdca7ff4c9ada41a45ce6b3cf57b58b8f24c63a;hb=5d4fceb6764b266b0be5b0a0357b7ec1de561103;hp=9231efa28961d36f67303b925b24d65cdff72006;hpb=a0fcd47abb69b57c43e4af8ca703ea78bbb80001;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-core/bt-core-noti-handler.c b/bt-core/bt-core-noti-handler.c index 9231efa..9fdca7f 100644 --- a/bt-core/bt-core-noti-handler.c +++ b/bt-core/bt-core-noti-handler.c @@ -53,100 +53,6 @@ static gboolean __bt_off_cause_conflict_check(void) return ret; } -static void __bt_core_handle_adapter_with_flight_mode(gboolean flight_mode) -{ - bt_status_t adapter_status; - bt_le_status_t adapter_status_le; - - adapter_status = _bt_core_get_status(); - adapter_status_le = _bt_core_get_le_status(); - - BT_INFO("bt status %d, le status %d", adapter_status, adapter_status_le); - if (flight_mode == TRUE) { - BT_INFO_C("Flight mode on. Turn off BT"); - - if (adapter_status == BT_ACTIVATING || adapter_status_le == BT_LE_ACTIVATING) { - BT_INFO("BT adapter is activating. Turn off BT after activation"); - _bt_set_flightmode_request(TRUE); - return; - } - if (adapter_status != BT_ACTIVATED && adapter_status_le != BT_LE_ACTIVATED) { - BT_INFO("No need to control bt status"); - return; - } - - if (vconf_set_int(BT_OFF_DUE_TO_FLIGHT_MODE, 1) != 0) - BT_ERR("Set vconf failed"); - - if (adapter_status == BT_ACTIVATED) { - int bt_status_before_mode = 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); -#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_FLIGHT_MODE, bt_le_status_before_mode); - -#ifdef TIZEN_FEATURE_BUSACT - _bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE); -#endif - if (!TIZEN_FEATURE_BT_USB_DONGLE) - _bt_disable_adapter_le(); - } - } else { - int flight_mode_value = 0; - - BT_INFO_C("Flight mode off. Turn on BT"); - - if (adapter_status == BT_DEACTIVATING || adapter_status_le == BT_LE_DEACTIVATING) { - BT_INFO("BT adapter is activating. Turn off BT after activation"); - _bt_set_flightmode_request(TRUE); - return; - } - if (adapter_status != BT_DEACTIVATED && adapter_status_le != BT_LE_DEACTIVATED) { - BT_INFO("No need to control bt status"); - return; - } - - if (vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE, &flight_mode_value)) - BT_ERR("Fail get flight mode value"); - - if (flight_mode_value == 0) - return; - - if (vconf_set_int(BT_OFF_DUE_TO_FLIGHT_MODE, 0) != 0) - BT_ERR("Set vconf failed"); - - ret_if(__bt_off_cause_conflict_check()); - - if (adapter_status == BT_DEACTIVATED && - _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); - 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); - if (!TIZEN_FEATURE_BT_USB_DONGLE) - _bt_enable_adapter_le(); - } - } -} - static void __bt_core_handle_adapter_with_power_saving_mode(int power_saving_mode) { bt_status_t adapter_status; @@ -219,24 +125,6 @@ static void __bt_core_handle_adapter_with_power_saving_mode(int power_saving_mod } } -static void __bt_core_flight_mode_cb(keynode_t *node, void *data) -{ - gboolean flight_mode = FALSE; - int type; - - BT_DBG("key = %s", vconf_keynode_get_name(node)); - - type = vconf_keynode_get_type(node); - if (type != VCONF_TYPE_BOOL) { - BT_ERR("Invaild vconf key type : %d", type); - return; - } - - flight_mode = vconf_keynode_get_bool(node); - - __bt_core_handle_adapter_with_flight_mode(flight_mode); -} - #ifdef ENABLE_TIZEN_2_4 static void __bt_core_power_saving_mode_cb(keynode_t *node, void *data) { @@ -266,7 +154,7 @@ void _bt_core_init_vconf_value(void) int bt_flight_mode = 0; int bt_ps_mode = 0; - _bt_core_handle_flight_mode_noti(); + //_bt_core_handle_flight_mode_noti(); _bt_core_handle_power_saving_mode_noti(); flight_mode = _bt_core_is_flight_mode_enabled(); @@ -287,31 +175,12 @@ void _bt_core_init_vconf_value(void) 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) + 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) -{ - int ret; - - 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 } void _bt_core_handle_power_saving_mode_noti(void) @@ -332,18 +201,11 @@ void _bt_core_handle_power_saving_mode_noti(void) void _bt_core_unregister_vconf_handler(void) { - if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) { - vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, - (vconf_callback_fn)__bt_core_flight_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; }