From: hyunuktak Date: Tue, 1 Sep 2015 06:28:13 +0000 (+0900) Subject: Modify how to check the supported feature X-Git-Tag: submit/tizen/20150908.040635^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F47668%2F1;p=platform%2Fcore%2Fapi%2Fwifi.git Modify how to check the supported feature Signed-off-by: hyunuktak Change-Id: Id1cd5e1d410d25c1cf194b490a2bf76aa076009e --- diff --git a/include/net_wifi_private.h b/include/net_wifi_private.h index 8f3c072..c0c7848 100755 --- a/include/net_wifi_private.h +++ b/include/net_wifi_private.h @@ -40,16 +40,9 @@ extern "C" { #if !defined TIZEN_TV #define CHECK_FEATURE_SUPPORTED(feature_name) \ do { \ - bool feature_supported = FALSE; \ - if (!system_info_get_platform_bool(feature_name, &feature_supported)) { \ - if (feature_supported == FALSE) { \ - LOGE("%s feature is disabled", feature_name); \ - return WIFI_ERROR_NOT_SUPPORTED; \ - } \ - } else { \ - LOGE("Error - Feature getting from System Info"); \ - return WIFI_ERROR_OPERATION_FAILED; \ - } \ + int rv = _wifi_check_feature_supported(feature_name); \ + if( rv != WIFI_ERROR_NONE ) \ + return rv; \ } while(0) #else #define CHECK_FEATURE_SUPPORTED(feature_name) @@ -125,6 +118,8 @@ wifi_connection_state_e _wifi_convert_to_ap_state(net_state_type_t state); guint _wifi_callback_add(GSourceFunc func, gpointer user_data); void _wifi_callback_cleanup(void); +int _wifi_check_feature_supported(const char *feature_name); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/libnetwork.c b/src/libnetwork.c index 7ff72c5..113145c 100755 --- a/src/libnetwork.c +++ b/src/libnetwork.c @@ -65,6 +65,8 @@ static __thread struct _wifi_cb_s wifi_callbacks = { 0, }; static __thread struct _profile_list_s profile_iterator = { 0, NULL }; static __thread struct _profile_list_s specific_profile_iterator = {0, NULL}; static __thread char specific_profile_essid[NET_WLAN_ESSID_LEN + 1] = { 0, }; +static __thread bool is_feature_checked = false; +static __thread bool feature_supported = false; static __thread GSList *managed_idler_list = NULL; bool _wifi_is_init(void) @@ -1330,3 +1332,28 @@ void _wifi_callback_cleanup(void) g_slist_free(managed_idler_list); managed_idler_list = NULL; } + +int _wifi_check_feature_supported(const char *feature_name) +{ + if(is_feature_checked) { + if(!feature_supported) { + LOGE("%s feature is disabled", feature_name); + return WIFI_ERROR_NOT_SUPPORTED; + } + } + else { + if (!system_info_get_platform_bool(feature_name, &feature_supported)) { + is_feature_checked = true; + if (!feature_supported) { + LOGE("%s feature is disabled", feature_name); + return WIFI_ERROR_NOT_SUPPORTED; + } + } + else { + LOGE("Error - Feature getting from System Info"); + return WIFI_ERROR_OPERATION_FAILED; + } + } + + return WIFI_ERROR_NONE; +}