[ITC][wifi][NON-ACR][DPTTIZEN-2751, fixed code for EAP Failed TCs]
authorShobhit Verma <shobhit.v@samsung.com>
Thu, 23 Feb 2017 11:50:15 +0000 (17:20 +0530)
committerShobhit Verma <shobhit.v@samsung.com>
Thu, 23 Feb 2017 11:50:15 +0000 (17:20 +0530)
Change-Id: I3daf4ad862d8e0f79939aab9fbcfaf27aa4ca724
Signed-off-by: Shobhit Verma <shobhit.v@samsung.com>
src/itc/wifi/ITs-wifi-common.c
src/itc/wifi/ITs-wifi-common.h
src/itc/wifi/ITs-wifi-config.c
src/itc/wifi/ITs-wifi-eap.c
src/itc/wifi/ITs-wifi-manager.c

index a40fbdb1cb2309f9a97533c149d61b8819be8e56..8b7c1b2a3f71afa979bbeed9793c19d11b14aa9f 100755 (executable)
@@ -806,142 +806,4 @@ void WifiScanApCallback(wifi_error_e result, void *user_data)
        }
 }
 
-/**
-* @function            WifiFoundEapAPCallback
-* @description         Called when access point is found repeatedly
-* @parameter           pHandle : wifi AP handle, user_data : user data sent to callback
-* @return                      bool
-*/
-bool WifiFoundEapAPCallback(wifi_ap_h pHandle, void* user_data)
-{
-#if DEBUG
-       FPRINTF("[Line : %d][%s]called callback WifiFoundEapAPCallback\\n", __LINE__, API_NAMESPACE);
-#endif
-       g_bForEachCb = true;
-       if ( pHandle != NULL )
-       {
-               FREE_MEMORY(g_pszESSID);
-               char szValueEAP[CONFIG_VALUE_LEN_MAX] = {0,};
-               int nRet = wifi_ap_get_essid(pHandle, &g_pszESSID);
-               if ( nRet == WIFI_ERROR_NONE )
-               {
-                       if ( g_pszESSID != NULL )
-                       {
-#if DEBUG
-                               FPRINTF("[Line : %d][%s] Access Point name in scanned list = %s\\n", __LINE__, API_NAMESPACE, g_pszESSID);
-#endif
-                               if ( true == GetValueFromConfigFile("WIFI_EAPACCESSPOINTNAME", szValueEAP, NULL) )
-                               {
-#if DEBUG
-                                       FPRINTF("[Line : %d][%s] Values Received = %s\\n", __LINE__, API_NAMESPACE, szValueEAP);
-#endif
-                               }
-                               else 
-                               {
-                                       FPRINTF("[Line : %d][%s] GetValueFromConfigFile returned error\\n", __LINE__, API_NAMESPACE);
-                                       return false;
-                               }
-                               int nAPLength = strlen(szValueEAP);
-                               if ( strncmp(g_pszESSID, szValueEAP, nAPLength) == 0 )
-                               {
-                                       nRet = wifi_ap_clone(&g_pEapWifiAPHandle, pHandle);
-                                       if ((nRet == WIFI_ERROR_NONE) && (g_pEapWifiAPHandle != NULL))
-                                       {
-                                               g_bCheckCb = true;
-                                               if ( g_pMainLoop )
-                                               {
-                                                       g_main_loop_quit(g_pMainLoop);
-                                                       g_main_loop_unref(g_pMainLoop);
-                                                       g_pMainLoop = NULL;
-                                               }
-                                               return false;
-                                       }
-                               }
-                       }
-               }
-       }
-       return true;
-}
-
-/**
-* @function            WifiPreConnectConditionForEAP
-* @description         to scan and find the AP
-* @parameter           NA
-* @return                      true for success or false for failure
-*/
-bool WifiPreConnectConditionForEAP()
-{
-       /** If device is already connected to an access point, next time the AP name does not appear in the scanned list
-       so we will have to disconnect it first and then scan
-       But as we are not sure if it will be connected/disconnected at this point we will call disconnect here
-       and ignore the return type */
-
-       int nWifiTimeoutId = -1;
-       bool bIsActive = false;
-
-       int nRet = wifi_is_activated(&bIsActive);
-       if ( bIsActive != true )
-       {
-               g_bCheckCb = false;
-               nRet = wifi_activate(WifiActivatedCallback, NULL);
-               if ( nRet != WIFI_ERROR_NONE )
-               {
-                       FPRINTF("[Line : %d][%s] wifi_activate failed, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
-                       return false;
-               }
-               RUN_POLLING_LOOP;
-               if ( !g_bCheckCb )
-               {
-                       FPRINTF("[Line : %d][%s] WifiActivatedCallback =  callback function not invoked\\n", __LINE__, API_NAMESPACE);
-                       return false;
-               }
-       }
-       g_bCheckCb = false;
-       nRet = wifi_scan(WifiScanRequestCallback, NULL);
-       RUN_POLLING_LOOP;
-       if ( nRet != WIFI_ERROR_NONE )
-       {
-               FPRINTF("[Line : %d][%s] wifi_scan failed, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
-               return false;
-       }
-       if ( !g_bCheckCb )
-       {
-               FPRINTF("[Line : %d][%s] wifi_scan failed inside WifiPreConnectConditionForEAP, error returned = callback function not invoked\\n", __LINE__, API_NAMESPACE);
-               return false;
-       }
-       g_bForEachCb = false;
-       g_bCheckCb = false;
-       nRet = wifi_foreach_found_aps(WifiFoundEapAPCallback, NULL);
-       RUN_POLLING_LOOP;
-       if ( nRet != WIFI_ERROR_NONE )
-       {
-               FPRINTF("[Line : %d][%s] wifi_foreach_found_aps failed, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
-               return false;
-       }
-       if ( !g_bForEachCb )
-       {
-               FPRINTF("[Line : %d][%s] wifi_foreach_found_aps failed inside WifiPreConnectConditionForEAP, error returned = callback function not invoked\\n", __LINE__, API_NAMESPACE);
-               return false;
-       }
-       if ( !g_bCheckCb )
-       {
-               FPRINTF("[Line : %d][%s] WiFi EAP given as input not found in the scanned list\\n", __LINE__, API_NAMESPACE);
-               return false;
-       }
-       g_bCheckCb = false;
-       nRet = wifi_connect(g_pEapWifiAPHandle, WifiConnectedCallback, NULL);
-       if ( nRet != WIFI_ERROR_NONE )
-       {
-               FPRINTF("[Line : %d][%s] wifi_connect failed, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
-               return false;
-       }
-       RUN_POLLING_LOOP;
-       if ( !g_bCheckCb )
-       {
-               FPRINTF("[Line : %d][%s] WifiConnectedCallback =  callback function not invoked\\n", __LINE__, API_NAMESPACE);
-               return false;
-       }
-       return true;
-}
-
 /** @}*/
index 9d5e5a00d81f437bbc23e86ad9f4296e642b4f41..6d04307c6bd619be4e29d677fb167160565363fa 100755 (executable)
@@ -60,6 +60,25 @@ bool g_bWifiCb;
 }\
 }
 
+#define START_TEST_EAP {\
+       FPRINTF("[Line : %d] [wifi_ITC] Starting test : %s\\n", __LINE__,__FUNCTION__);\
+       if ( g_bWifiMismatch == true )\
+{\
+       FPRINTF("[Line : %d][wifi_ITC] Feature support as returned by TCTCheckSystemInfoFeatureSupported() and error code as returned by wifi_initialize() mismatched, Leaving test\\n", __LINE__);\
+       return 1;\
+}\
+       else if ( g_bWifiNotSupported  == true)\
+{\
+       FPRINTF("[Line : %d] [wifi_ITC] wifi feature not supported, Leaving test\\n", __LINE__);\
+       return 0;\
+}\
+else if ( g_bWifiInitialization == false )\
+{\
+       FPRINTF("[Line : %d] [wifi_ITC] wifi fail in startup, Leaving test\\n", __LINE__);\
+       return 1;\
+}\
+}
+
 /*
 if ( !g_bWifiInit )\
 {\
@@ -127,8 +146,6 @@ bool WifiFoundAPCallback(wifi_ap_h pHandle, void* user_data);
 bool WifiPreConnectCondition();
 void WifiScanApCallback(wifi_error_e result, void *user_data);
 bool WifiFoundSpecificAPCallback(wifi_ap_h pHandle, void* user_data);
-bool WifiFoundEapAPCallback(wifi_ap_h pHandle, void* user_data);
-bool WifiPreConnectConditionForEAP();
 
 /** @}*/
 
index f131011b14afcd23cd1af9d06c3a15ad00365528..da4ec60c29df9f05b06f7ad42138fadf1f696b19 100755 (executable)
@@ -192,15 +192,6 @@ int ITc_wifi_config_create_destroy_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nEnumSecuritySize = sizeof(eSecurityType) / sizeof(eSecurityType[0]);
        int nEnumSecurityCounter = 0;
 
@@ -280,15 +271,6 @@ int ITc_wifi_config_clone_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &origin);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( origin == NULL )
@@ -376,15 +358,6 @@ int ITc_wifi_config_save_configuration_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -502,15 +475,6 @@ int ITc_wifi_config_get_name_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -600,15 +564,6 @@ int ITc_wifi_config_get_security_type_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -701,15 +656,6 @@ int ITc_wifi_config_set_get_proxy_address_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -828,15 +774,6 @@ int ITc_wifi_config_set_get_hidden_ap_property_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectCondition() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pszPassphrase);
-               return 1;
-       }
-
-       CHECK_ACCESS_POINT_CLEANUP(g_pWifiAPHandle, FREE_MEMORY(pszPassphrase));
-
        int nRet = wifi_config_create(szValue, pszPassphrase, WIFI_SECURITY_TYPE_NONE, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -906,13 +843,6 @@ int ITc_wifi_config_set_get_eap_anonymous_identity_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -981,13 +911,6 @@ int ITc_wifi_config_set_get_eap_ca_cert_file_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        if ( false == WifiAppendToAppDataPath(CERTIFICATION_PATH, pszCertPath) )
        {
                FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
@@ -1064,13 +987,6 @@ int ITc_wifi_config_set_get_eap_client_cert_file_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        if ( false == WifiAppendToAppDataPath(CERTIFICATION_PATH, pszCertPath) )
        {
                FPRINTF("[Line : %d][%s] unable to get the app data path\\n", __LINE__, API_NAMESPACE);
@@ -1147,13 +1063,6 @@ int ITc_wifi_config_set_get_eap_identity_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -1222,13 +1131,6 @@ int ITc_wifi_config_set_get_eap_type_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -1302,13 +1204,6 @@ int ITc_wifi_config_set_get_eap_auth_type_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -1382,13 +1277,6 @@ int ITc_wifi_config_set_get_eap_subject_match_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        if ( config == NULL )
@@ -1455,13 +1343,6 @@ int ITc_wifi_config_remove_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
-       CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
-
        int nRet = wifi_config_create(szValue, EAPACCESSPOINTPIN, WIFI_SECURITY_TYPE_EAP, &config);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_config_create", WifiGetError(nRet));
        CHECK_HANDLE(config,wifi_config_create);
index 43655c150daf445b5cc40959f6f15a4c10df032c..868d2f21117c93bc40781ce46fe51f564217f1a0 100755 (executable)
@@ -58,19 +58,27 @@ void ITs_wifi_eap_startup(void)
                }
                return;
        }
-
        if ( nRet == WIFI_ERROR_NONE )
        {
 #if DEBUG
                FPRINTF("[Line : %d][%s] wifi_initialize passed\\n", __LINE__, API_NAMESPACE);
 #endif
-
-               g_bWifiInitialization = true;           
+               g_bWifiInitialization = true;
        }
        else 
        {
                FPRINTF("[Line : %d][%s] wifi_initialize failed on startup, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
        }
+       nRet = wifi_ap_create("dongtan", &g_pEapWifiAPHandle);
+       if ( nRet == WIFI_ERROR_NONE )
+       {
+               FPRINTF("[Line : %d][%s] wifi_ap_create passed\\n", __LINE__, API_NAMESPACE);
+       }
+       else 
+       {
+               g_bWifiInitialization = false;
+               FPRINTF("[Line : %d][%s] wifi_ap_create failed on startup, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
+       }
 }
 
 /**
@@ -89,6 +97,19 @@ void ITs_wifi_eap_cleanup(void)
                
        if(g_bWifiInitialization)
        {
+               if(g_pEapWifiAPHandle)
+               {
+                       nRet = wifi_ap_destroy(g_pEapWifiAPHandle);
+                       if ( nRet == WIFI_ERROR_NONE )
+                       {
+                               FPRINTF("[Line : %d][%s] wifi_ap_destroy passed\\n", __LINE__, API_NAMESPACE);
+                       }
+                       else 
+                       {
+                               FPRINTF("[Line : %d][%s] wifi_ap_destroy failed on cleanup, error returned = %s\\n", __LINE__, API_NAMESPACE, WifiGetError(nRet));
+                       }
+               }
+               
                nRet = wifi_deinitialize();
                if ( nRet == WIFI_ERROR_NONE )
                {
@@ -132,19 +153,21 @@ void ITs_wifi_eap_cleanup(void)
 */
 int ITc_wifi_ap_set_get_eap_auth_type_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        wifi_eap_auth_type_e eSetEAPAuthType = WIFI_EAP_AUTH_TYPE_NONE;
        wifi_eap_auth_type_e eFindEAPAuthType;
+       wifi_eap_type_e eSetEAPType = WIFI_EAP_TYPE_TLS;
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_auth_type(g_pEapWifiAPHandle, eSetEAPAuthType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
+
+       nRet = wifi_ap_set_eap_auth_type(g_pEapWifiAPHandle, eSetEAPAuthType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_auth_type", WifiGetError(nRet));
 
        nRet = wifi_ap_get_eap_auth_type(g_pEapWifiAPHandle, &eFindEAPAuthType);
@@ -180,20 +203,19 @@ int ITc_wifi_ap_set_get_eap_auth_type_p(void)
 */
 int ITc_wifi_ap_set_get_eap_type_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        wifi_eap_type_e eSetEAPType = WIFI_EAP_TYPE_TLS;
        wifi_eap_type_e eFindEAPType = -1;
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
+
        nRet = wifi_ap_get_eap_type(g_pEapWifiAPHandle, &eFindEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_get_eap_type", WifiGetError(nRet));
 
@@ -229,7 +251,7 @@ int ITc_wifi_ap_set_get_eap_type_p(void)
 */
 int ITc_wifi_ap_set_get_eap_ca_cert_file_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        char *pszFindCertPath = NULL;
 
@@ -242,14 +264,12 @@ int ITc_wifi_ap_set_get_eap_ca_cert_file_p(void)
 
        wifi_eap_type_e eSetEAPType = WIFI_EAP_TYPE_TLS;
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+       
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
 
        nRet = wifi_ap_set_eap_ca_cert_file(g_pEapWifiAPHandle, pszCertPath);
@@ -298,7 +318,7 @@ int ITc_wifi_ap_set_get_eap_ca_cert_file_p(void)
 */
 int ITc_wifi_ap_set_get_eap_client_cert_file_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        char *pszFindCertPath = NULL;
        wifi_eap_type_e eSetEAPType = WIFI_EAP_TYPE_TLS;
@@ -310,14 +330,12 @@ int ITc_wifi_ap_set_get_eap_client_cert_file_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+       
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
 
        nRet = wifi_ap_set_eap_client_cert_file(g_pEapWifiAPHandle, pszCertPath);
@@ -358,7 +376,7 @@ int ITc_wifi_ap_set_get_eap_client_cert_file_p(void)
 *                                              get path of private key information of EAP\n
 *                                              compare find key path and set key path of certificate\n
 *                                              destroys the handle of access point
-* @apicovered                  wifi_ap_set_eap_private_key_info, wifi_ap_get_eap_private_key_file, wifi_ap_set_eap_type, wifi_ap_destroy
+* @apicovered                  wifi_ap_set_eap_private_key_info, wifi_ap_get_eap_private_key_file, wifi_ap_set_eap_type
 * @passcase                            When wifi_ap_set_eap_private_key_info, wifi_ap_get_eap_private_key_file and supporting apis returns success
 * @failcase                            When wifi_ap_set_eap_private_key_info or wifi_ap_get_eap_private_key_file or supporting apis returns failure
 * @precondition                        Wi-Fi should be initialised and activated
@@ -366,7 +384,7 @@ int ITc_wifi_ap_set_get_eap_client_cert_file_p(void)
 */
 int ITc_wifi_ap_set_get_eap_private_key_info_file_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        char *pszPassword = "1234";
        char *pszFindKeyPath = NULL;
@@ -380,14 +398,12 @@ int ITc_wifi_ap_set_get_eap_private_key_info_file_p(void)
                return 1;
        }
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+       
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
 
        nRet = wifi_ap_get_eap_private_key_file(g_pEapWifiAPHandle, &pstrGetDefaultPath);
@@ -415,11 +431,9 @@ int ITc_wifi_ap_set_get_eap_private_key_info_file_p(void)
 
        FREE_MEMORY(pszFindKeyPath);    
        nRet = wifi_ap_set_eap_private_key_info(g_pEapWifiAPHandle, pstrGetDefaultPath, NULL);
-       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_private_key_info", WifiGetError(nRet), FREE_MEMORY(pstrGetDefaultPath);wifi_ap_destroy(g_pEapWifiAPHandle));
+       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_private_key_info", WifiGetError(nRet), FREE_MEMORY(pstrGetDefaultPath));
        FREE_MEMORY(pstrGetDefaultPath);
-       
-       nRet = wifi_ap_destroy(g_pEapWifiAPHandle);
-       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_destroy", WifiGetError(nRet));
+
        return 0;
 }
 
@@ -447,7 +461,7 @@ int ITc_wifi_ap_set_get_eap_private_key_info_file_p(void)
 */
 int ITc_wifi_ap_set_get_eap_passphrase_p(void)
 {
-       START_TEST;
+       START_TEST_EAP;
 
        char *pszUser = "user";
        char *pszPassword = "1234";
@@ -456,14 +470,12 @@ int ITc_wifi_ap_set_get_eap_passphrase_p(void)
 
        wifi_eap_type_e eSetEAPType = WIFI_EAP_TYPE_TTLS;
 
-       if ( !WifiPreConnectConditionForEAP() )
-       {
-               FPRINTF("[Line : %d][%s] WifiPreConnectConditionForEAP failed\\n", __LINE__, API_NAMESPACE);
-               return 1;
-       }
        CHECK_ACCESS_POINT(g_pEapWifiAPHandle);
 
-       int nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
+       int nRet = wifi_ap_set_security_type(g_pEapWifiAPHandle, WIFI_SECURITY_TYPE_EAP);
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_security_type", WifiGetError(nRet));
+       
+       nRet = wifi_ap_set_eap_type(g_pEapWifiAPHandle, eSetEAPType);
        PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_ap_set_eap_type", WifiGetError(nRet));
 
        nRet = wifi_ap_set_eap_passphrase(g_pEapWifiAPHandle, pszUser, pszPassword);
@@ -501,9 +513,3 @@ int ITc_wifi_ap_set_get_eap_passphrase_p(void)
 
 /** @} */
 /** @} */
-
-
-
-
-
-
index 90511acc8ae6e1399a71fd789662d9bab0301704..c805ce0f87f0d516f603e0abce8ef4ad9aafd54f 100755 (executable)
@@ -562,50 +562,31 @@ int ITc_wifi_connect_disconnect_p(void)
        START_TEST;
 
        int nWifiTimeoutId = -1;
-       char* pstrPassphrase = NULL;
-       pstrPassphrase = calloc(1024, sizeof(char));
        //precondition
        //Creates the access point handle
-       //target api(wifi_connect) is exist in below condition
        if ( !WifiPreConnectCondition() )
        {
                FPRINTF("[Line : %d][%s] WifiPreConnectCondition failed\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pstrPassphrase);
                return 1;
        }
 
        if ( g_pWifiAPHandle == NULL )
        {
                FPRINTF("[Line : %d][%s] Access Point is not found in scanned list\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pstrPassphrase);
-               return 1;
-       }
-
-       if ( true == GetValueFromConfigFile("WIFI_ACCESSPOINTPIN", pstrPassphrase, NULL) )
-       {
-#if DEBUG
-               FPRINTF("[Line : %d][%s] WIFI_ACCESSPOINTPIN Values Received = %s\\n", __LINE__, API_NAMESPACE, pstrPassphrase);
-#endif
-       }
-       else
-       {
-               FPRINTF("[Line : %d][%s] GetValueFromConfigFile returned error\\n", __LINE__, API_NAMESPACE);
-               FREE_MEMORY(pstrPassphrase);
                return 1;
        }
 
        int nRet = wifi_forget_ap(g_pWifiAPHandle);
-       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_forget_ap", WifiGetError(nRet), FREE_MEMORY(pstrPassphrase));
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_forget_ap", WifiGetError(nRet));
                
        g_bCheckCb = false;
        nRet = wifi_disconnect(g_pWifiAPHandle, WiFiDisconnectCallabck, NULL);
        RUN_POLLING_LOOP;
-       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_disconnect", WifiGetError(nRet),wifi_connect(g_pWifiAPHandle, WifiConnectedCallback, NULL); FREE_MEMORY(pstrPassphrase));
+       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_disconnect", WifiGetError(nRet),wifi_connect(g_pWifiAPHandle, WifiConnectedCallback, NULL));
        if ( !g_bCheckCb )
        {
                FPRINTF("[Line : %d][%s] wifi_disconnect failed, error returned = callback not invoked\\n", __LINE__, API_NAMESPACE);
                wifi_connect(g_pWifiAPHandle, WifiConnectedCallback, NULL);
-               FREE_MEMORY(pstrPassphrase);
                return 1;
        }
        
@@ -613,13 +594,12 @@ int ITc_wifi_connect_disconnect_p(void)
        g_bCheckCb = false;
        nRet = wifi_connect(g_pWifiAPHandle, WifiConnectedCallback, NULL);
        RUN_POLLING_LOOP;
-       PRINT_RESULT_CLEANUP(WIFI_ERROR_NONE, nRet, "wifi_connect", WifiGetError(nRet), FREE_MEMORY(pstrPassphrase));
+       PRINT_RESULT(WIFI_ERROR_NONE, nRet, "wifi_connect", WifiGetError(nRet));
        if ( !g_bCheckCb )
        {
                FPRINTF("[Line : %d][%s] wifi_connect returned no error but connected callback not invoked\\n", __LINE__, API_NAMESPACE);               
        }
        
-       FREE_MEMORY(pstrPassphrase);
        return 0;
 }