Modify how to check the supported feature 68/47668/1 accepted/tizen/mobile/20150908.073842 accepted/tizen/tv/20150908.073920 accepted/tizen/wearable/20150908.073902 submit/tizen/20150908.040635
authorhyunuktak <hyunuk.tak@samsung.com>
Tue, 1 Sep 2015 06:28:13 +0000 (15:28 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Tue, 8 Sep 2015 01:02:40 +0000 (10:02 +0900)
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: Id1cd5e1d410d25c1cf194b490a2bf76aa076009e

include/net_wifi_private.h
src/libnetwork.c

index 8f3c072f9a65af20d5c697e361707e3a4d9ae6c2..c0c7848c64b781e689e0e10cfc913ae3d69dff65 100755 (executable)
@@ -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 */
index 7ff72c5e7d5b462e0447b84d2c5d3534320e0184..113145c6ff1ad70690807e50d3a64aedc7547faf 100755 (executable)
@@ -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;
+}