Revise APIs to scan specific AP 86/40186/1
authorhyunuktak <hyunuk.tak@samsung.com>
Mon, 1 Jun 2015 02:22:59 +0000 (11:22 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Mon, 1 Jun 2015 02:23:19 +0000 (11:23 +0900)
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: I246a41b57322a7fc5a6d4efd9969ecd1886f5edd

include/net_wifi_private.h
include/wifi.h
packaging/capi-network-wifi.spec
src/libnetwork.c
src/net_wifi.c
test/wifi_test.c

index de59fd2..3ce51d7 100644 (file)
@@ -64,11 +64,11 @@ int _wifi_libnet_get_wifi_device_state(wifi_device_state_e *device_state);
 int _wifi_libnet_get_wifi_state(wifi_connection_state_e* connection_state);
 int _wifi_libnet_get_intf_name(char** name);
 int _wifi_libnet_scan_request(wifi_scan_finished_cb callback, void *user_data);
-int _wifi_libnet_scan_hidden_ap(const char *essid,
-                                       wifi_scan_finished_cb callback, void *user_data);
+int _wifi_libnet_scan_specific_ap(const char *essid, wifi_scan_finished_cb callback, void *user_data);
 int _wifi_libnet_get_connected_profile(wifi_ap_h *ap);
 int _wifi_libnet_foreach_found_aps(wifi_found_ap_cb callback, void *user_data);
-int _wifi_libnet_foreach_found_hidden_aps(wifi_found_ap_cb callback, void *user_data);
+int _wifi_libnet_foreach_found_specific_aps(wifi_found_ap_cb callback, void *user_data);
+
 int _wifi_libnet_open_profile(wifi_ap_h ap_h, wifi_connected_cb callback, void *user_data);
 int _wifi_libnet_close_profile(wifi_ap_h ap_h, wifi_disconnected_cb callback, void *user_data);
 int _wifi_libnet_connect_with_wps_pbc(wifi_ap_h ap,
index 2932e63..51ccdbe 100644 (file)
@@ -258,7 +258,9 @@ typedef void* wifi_ap_h;
  * @return  @c true to continue with the next iteration of the loop, \n
  *         otherwise @c false to break out of the loop
  * @pre  wifi_foreach_found_aps() will invoke this callback.
+ * @pre  wifi_foreach_found_specific_aps() will invoke this callback.
  * @see  wifi_foreach_found_aps()
+ * @see  wifi_foreach_found_specific_aps()
  */
 typedef bool(*wifi_found_ap_cb)(wifi_ap_h ap, void *user_data);
 
@@ -536,18 +538,25 @@ int wifi_get_network_interface_name(char** name);
 int wifi_scan(wifi_scan_finished_cb callback, void *user_data);
 
 /**
-* @brief Starts hidden ap scan, asynchronously.
-* @param[in] essid     The essid of hidden ap
-* @param[in] callback  The callback function to be called
-* @param[in] user_data The user data passed to the callback function
-* @return 0 on success, otherwise negative error value.
-* @retval #WIFI_ERROR_NONE  Successful
-* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
-* @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
-* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
-* @post This function invokes wifi_scan_finished_cb().
-*/
-int wifi_scan_hidden_ap(const char* essid, wifi_scan_finished_cb callback, void* user_data);
+ * @brief Starts specific ap scan, asynchronously.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.set \n
+ *               %http://tizen.org/privilege/network.get
+ * @remark This API needs both privileges.
+ * @param[in] essid     The essid of hidden ap
+ * @param[in] callback  The callback function to be called
+ * @param[in] user_data The user data passed to the callback function
+ * @return 0 on success, otherwise negative error value.
+ * @retval #WIFI_ERROR_NONE  Successful
+ * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #WIFI_ERROR_INVALID_OPERATION  Invalid operation
+ * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #WIFI_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #WIFI_ERROR_NOT_SUPPORTED   Not supported
+ * @post This function invokes wifi_scan_finished_cb().
+ */
+int wifi_scan_specific_ap(const char* essid, wifi_scan_finished_cb callback, void* user_data);
 
 /**
  * @brief Gets the handle of the connected access point.
@@ -584,16 +593,22 @@ int wifi_get_connected_ap(wifi_ap_h* ap);
 int wifi_foreach_found_aps(wifi_found_ap_cb callback, void *user_data);
 
 /**
-* @brief Gets the result of hidden ap scan.
-* @param[in] callback  The callback to be called
-* @param[in] user_data The user data passed to the callback function
-* @return 0 on success, otherwise negative error value.
-* @retval #WIFI_ERROR_NONE  Successful
-* @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
-* @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
-* @post This function invokes wifi_found_ap_cb().
-*/
-int wifi_foreach_found_hidden_aps(wifi_found_ap_cb callback, void* user_data);
+ * @brief Gets the result of specific ap scan.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ * @param[in] callback  The callback to be called
+ * @param[in] user_data The user data passed to the callback function
+ * @return 0 on success, otherwise negative error value.
+ * @retval #WIFI_ERROR_NONE  Successful
+ * @retval #WIFI_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #WIFI_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #WIFI_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #WIFI_ERROR_NOT_SUPPORTED   Not supported
+ * @post This function invokes wifi_found_ap_cb().
+ * @see wifi_scan_specific_ap()
+ */
+int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* user_data);
 
 /**
  * @brief Connects the access point asynchronously.
index b450167..4be7754 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-network-wifi
 Summary:    Network Wi-Fi library in TIZEN C API
-Version:    0.1.2_28
+Version:    0.1.2_29
 Release:    1
 Group:      System/Network
 License:    Apache-2.0
index 2f57249..403a451 100755 (executable)
@@ -30,8 +30,8 @@ struct _wifi_cb_s {
        void *bg_scan_user_data;
        wifi_scan_finished_cb scan_request_cb;
        void *scan_request_user_data;
-       wifi_scan_finished_cb scan_hidden_ap_cb;
-       void *scan_hidden_ap_user_data;
+       wifi_scan_finished_cb specific_scan_cb;
+       void *specific_scan_user_data;
        wifi_connection_state_changed_cb connection_state_cb;
        void *connection_state_user_data;
        wifi_activated_cb activated_cb;
@@ -62,8 +62,9 @@ struct managed_idle_data {
 
 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 GSList *managed_idler_list = NULL;
-static __thread struct _profile_list_s hidden_profile_iterator = {0, NULL};
 
 bool _wifi_is_init(void)
 {
@@ -196,33 +197,35 @@ static int __libnet_update_profile_iterator(void)
        return WIFI_ERROR_NONE;
 }
 
-static void __libnet_update_hidden_profile_iterator(GSList *ap_list)
+static void __libnet_update_specific_profile_iterator(GSList *ap_list)
 {
-       int count;
-       GSList *list = ap_list;
+    int count=0;
+    GSList *list = ap_list;
 
-       for (count = 0; list; list = list->next)
+    for (count = 0; list; list = list->next) {
                count++;
+    }
 
        if (count == 0) {
                WIFI_LOG(WIFI_INFO, "No hidden AP found\n");
                return;
        }
 
-       hidden_profile_iterator.count = count;
-       hidden_profile_iterator.profiles = g_try_new0(net_profile_info_t, count);
+       specific_profile_iterator.count = count;
+       specific_profile_iterator.profiles = g_try_new0(net_profile_info_t, count);
 
        list = ap_list;
        for (count = 0; list; list = list->next) {
-               net_wifi_connection_info_t *ap = list->data;
-               net_profile_info_t *profile = &hidden_profile_iterator.profiles[count];
+               struct ssid_scan_bss_info_t *ap = (struct ssid_scan_bss_info_t *)list->data;
+               net_profile_info_t *profile = &specific_profile_iterator.profiles[count];
+
+               g_strlcpy(profile->ProfileInfo.Wlan.essid, ap->ssid, NET_WLAN_ESSID_LEN+1);
+               profile->ProfileInfo.Wlan.security_info.sec_mode = ap->security;
 
-               g_strlcpy(profile->ProfileInfo.Wlan.essid, ap->essid, NET_WLAN_ESSID_LEN+1);
-               profile->ProfileInfo.Wlan.security_info.sec_mode = ap->security_info.sec_mode;
                count++;
        }
 
-       WIFI_LOG(WIFI_INFO, "Hidden AP count : %d\n", count);
+       WIFI_LOG(WIFI_INFO, "Specific AP count : %d\n", count);
 }
 
 static void __libnet_convert_profile_info_to_wifi_info(net_wifi_connection_info_t *wifi_info,
@@ -331,7 +334,7 @@ static void __libnet_power_on_off_cb(net_event_info_t *event_cb, bool is_request
                        WIFI_LOG(WIFI_INFO, "Wi-Fi power off");
                        state = WIFI_DEVICE_STATE_DEACTIVATED;
                        __libnet_clear_profile_list(&profile_iterator);
-                       __libnet_clear_profile_list(&hidden_profile_iterator);
+                       __libnet_clear_profile_list(&specific_profile_iterator);
                } else {
                        WIFI_LOG(WIFI_ERROR, "Error Wi-Fi state %d", *wifi_state);
                        error_code = WIFI_ERROR_OPERATION_FAILED;
@@ -375,24 +378,24 @@ static void __libnet_scan_cb(net_event_info_t *event_cb)
                wifi_callbacks.bg_scan_cb(error_code, wifi_callbacks.bg_scan_user_data);
 }
 
-static void __libnet_hidden_scan_cb(net_event_info_t *event_cb)
+static void __libnet_specific_scan_cb(net_event_info_t *event_cb)
 {
        wifi_error_e error_code = WIFI_ERROR_NONE;
 
-       __libnet_clear_profile_list(&hidden_profile_iterator);
+       __libnet_clear_profile_list(&specific_profile_iterator);
 
        if (event_cb->Error != NET_ERR_NONE) {
-               WIFI_LOG(WIFI_ERROR, "Hidden scan failed!, Error [%d]\n", event_cb->Error);
+               WIFI_LOG(WIFI_ERROR, "Specific scan failed!, Error [%d]\n", event_cb->Error);
                error_code = WIFI_ERROR_OPERATION_FAILED;
        } else if (event_cb->Data) {
-               GSList *ap_list = event_cb->Data;
-               __libnet_update_hidden_profile_iterator(ap_list);
+               GSList *ap_list = (GSList *)event_cb->Data;
+               __libnet_update_specific_profile_iterator(ap_list);
        }
 
-       if (wifi_callbacks.scan_hidden_ap_cb) {
-               wifi_callbacks.scan_hidden_ap_cb(error_code, wifi_callbacks.scan_hidden_ap_user_data);
-               wifi_callbacks.scan_hidden_ap_cb = NULL;
-               wifi_callbacks.scan_hidden_ap_user_data = NULL;
+       if (wifi_callbacks.specific_scan_cb) {
+               wifi_callbacks.specific_scan_cb(error_code, wifi_callbacks.specific_scan_user_data);
+               wifi_callbacks.specific_scan_cb = NULL;
+               wifi_callbacks.specific_scan_user_data = NULL;
        }
 }
 
@@ -530,11 +533,11 @@ static void __libnet_evt_cb(net_event_info_t *event_cb, void *user_data)
                __libnet_scan_cb(event_cb);
                break;
        case NET_EVENT_SPECIFIC_SCAN_RSP:
-               WIFI_LOG(WIFI_INFO, "Got Wi-Fi hidden scan RSP\n");
+               WIFI_LOG(WIFI_INFO, "Got Wi-Fi specific scan RSP\n");
                break;
        case NET_EVENT_SPECIFIC_SCAN_IND:
-               WIFI_LOG(WIFI_INFO, "Got Wi-Fi hidden scan IND\n");
-               __libnet_hidden_scan_cb(event_cb);
+               WIFI_LOG(WIFI_INFO, "Got Wi-Fi specific scan IND\n");
+               __libnet_specific_scan_cb(event_cb);
                break;
        case NET_EVENT_WIFI_POWER_RSP:
                is_requested = true;
@@ -566,7 +569,7 @@ bool _wifi_libnet_deinit(void)
                return false;
 
        __libnet_clear_profile_list(&profile_iterator);
-       __libnet_clear_profile_list(&hidden_profile_iterator);
+       __libnet_clear_profile_list(&specific_profile_iterator);
        g_slist_free_full(ap_handle_list, g_free);
        ap_handle_list = NULL;
        memset(&wifi_callbacks, 0, sizeof(struct _wifi_cb_s));
@@ -637,8 +640,8 @@ bool _wifi_libnet_check_ap_validity(wifi_ap_h ap_h)
        for (i = 0; i < profile_iterator.count; i++)
                if (ap_h == &profile_iterator.profiles[i]) return true;
 
-       for (i = 0; i < hidden_profile_iterator.count; i++)
-               if (ap_h == &hidden_profile_iterator.profiles[i]) return true;
+       for (i = 0; i < specific_profile_iterator.count; i++)
+               if (ap_h == &specific_profile_iterator.profiles[i]) return true;
 
        return false;
 }
@@ -774,16 +777,20 @@ int _wifi_libnet_scan_request(wifi_scan_finished_cb callback, void *user_data)
        return WIFI_ERROR_OPERATION_FAILED;
 }
 
-int _wifi_libnet_scan_hidden_ap(const char *essid,
-                                       wifi_scan_finished_cb callback, void *user_data)
+int _wifi_libnet_scan_specific_ap(const char *essid,
+                                       wifi_scan_finished_cb callback, void *user_data)
 {
        int rv;
        rv = net_specific_scan_wifi(essid);
 
        if (rv == NET_ERR_NONE) {
-               wifi_callbacks.scan_hidden_ap_cb = callback;
-               wifi_callbacks.scan_hidden_ap_user_data = user_data;
+               g_strlcpy(specific_profile_essid, essid, NET_WLAN_ESSID_LEN+1);
+               wifi_callbacks.specific_scan_cb = callback;
+               wifi_callbacks.specific_scan_user_data = user_data;
                return WIFI_ERROR_NONE;
+       } else if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied");
+               return WIFI_ERROR_PERMISSION_DENIED;
        } else if (rv == NET_ERR_INVALID_OPERATION)
                return WIFI_ERROR_INVALID_OPERATION;
 
@@ -848,19 +855,37 @@ int _wifi_libnet_foreach_found_aps(wifi_found_ap_cb callback, void *user_data)
        return WIFI_ERROR_NONE;
 }
 
-int _wifi_libnet_foreach_found_hidden_aps(wifi_found_ap_cb callback, void *user_data)
+int _wifi_libnet_foreach_found_specific_aps(wifi_found_ap_cb callback, void *user_data)
 {
        int i, rv;
 
-       if (hidden_profile_iterator.count == 0) {
-               WIFI_LOG(WIFI_INFO, "There is no hidden APs.");
+       if (specific_profile_iterator.count == 0) {
+               WIFI_LOG(WIFI_WARN, "There is no specific APs");
+
+               rv = __libnet_update_profile_iterator();
+               if (rv == NET_ERR_ACCESS_DENIED) {
+                       WIFI_LOG(WIFI_ERROR, "Access denied");
+                       return WIFI_ERROR_PERMISSION_DENIED;
+               }
+
+               if (profile_iterator.count == 0) {
+                       WIFI_LOG(WIFI_WARN, "There is no APs");
+                       return WIFI_ERROR_NONE;
+               }
+
+               for (i = 0; i < profile_iterator.count; i++) {
+                       if (!g_strcmp0(specific_profile_essid,
+                                               profile_iterator.profiles[i].ProfileInfo.Wlan.essid)) {
+                               rv = callback((wifi_ap_h)(&profile_iterator.profiles[i]), user_data);
+                               if (rv == false) break;
+                       }
+               }
                return WIFI_ERROR_NONE;
        }
 
-       for (i =0; i < hidden_profile_iterator.count; i++) {
-               rv = callback((wifi_ap_h)(&hidden_profile_iterator.profiles[i]), user_data);
-               if (rv == false)
-                       break;
+       for (i = 0; i < specific_profile_iterator.count; i++) {
+               rv = callback((wifi_ap_h)(&specific_profile_iterator.profiles[i]), user_data);
+               if (rv == false) break;
        }
 
        return WIFI_ERROR_NONE;
index a17d7b6..837b30d 100755 (executable)
@@ -192,23 +192,24 @@ EXPORT_API int wifi_scan(wifi_scan_finished_cb callback, void* user_data)
        return rv;
 }
 
-EXPORT_API int wifi_scan_hidden_ap(const char* essid, wifi_scan_finished_cb callback, void* user_data)
+EXPORT_API int wifi_scan_specific_ap(const char* essid, wifi_scan_finished_cb callback, void* user_data)
 {
        int rv;
 
-       if (callback == NULL) {
-               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+       if (essid == NULL || callback == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Invalid parameter");
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
        if (_wifi_is_init() == false) {
                WIFI_LOG(WIFI_ERROR, "Not initialized");
+
                return WIFI_ERROR_INVALID_OPERATION;
        }
 
-       rv = _wifi_libnet_scan_hidden_ap(essid, callback, user_data);
+       rv = _wifi_libnet_scan_specific_ap(essid, callback, user_data);
        if (rv != WIFI_ERROR_NONE)
-               WIFI_LOG(WIFI_ERROR, "Error!! Wi-Fi hidden scan failed.\n");
+               WIFI_LOG(WIFI_ERROR, "Wi-Fi hidden scan failed.\n");
 
        return rv;
 }
@@ -238,17 +239,14 @@ EXPORT_API int wifi_foreach_found_aps(wifi_found_ap_cb callback, void* user_data
        return _wifi_libnet_foreach_found_aps(callback, user_data);
 }
 
-EXPORT_API int wifi_foreach_found_hidden_aps(wifi_found_ap_cb callback, void* user_data)
+EXPORT_API int wifi_foreach_found_specific_aps(wifi_found_ap_cb callback, void* user_data)
 {
        if (callback == NULL) {
-               WIFI_LOG(WIFI_ERROR, "Wrong Parameter Passed\n");
+               WIFI_LOG(WIFI_ERROR, "Invalid parameter");
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
-       if (_wifi_libnet_foreach_found_hidden_aps(callback, user_data) != WIFI_ERROR_NONE)
-               return WIFI_ERROR_OPERATION_FAILED;
-
-       return WIFI_ERROR_NONE;
+       return _wifi_libnet_foreach_found_specific_aps(callback, user_data);
 }
 
 EXPORT_API int wifi_connect(wifi_ap_h ap, wifi_connected_cb callback, void* user_data)
index 2640e89..d908984 100644 (file)
@@ -95,46 +95,6 @@ static void __test_scan_request_callback(wifi_error_e error_code, void* user_dat
                        __test_convert_error_to_string(error_code));
 }
 
-static bool __test_found_hidden_aps_callback(wifi_ap_h ap, void *user_data)
-{
-       int rv;
-       char *ap_name;
-       wifi_security_type_e sec_type;
-
-       rv = wifi_ap_get_essid(ap, &ap_name);
-       if (rv != WIFI_ERROR_NONE) {
-               printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
-               return false;
-       }
-
-       printf("AP name : %s\n", ap_name);
-
-       if (wifi_ap_get_security_type(ap, &sec_type) == WIFI_ERROR_NONE)
-               printf("Security type : %d\n", sec_type);
-       else
-               printf("Fail to get Security type\n");
-
-       g_free(ap_name);
-       return true;
-}
-
-static void __test_scan_hidden_ap_callback(wifi_error_e error_code, void* user_data)
-{
-       int rv;
-
-       printf("Hidden scan Completed from scan request, error code : %s\n",
-                       __test_convert_error_to_string(error_code));
-
-       if (error_code != WIFI_ERROR_NONE)
-               return;
-
-       rv = wifi_foreach_found_hidden_aps(__test_found_hidden_aps_callback, NULL);
-       if (rv != WIFI_ERROR_NONE) {
-               printf("Fail to get hidden AP(can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
-               return;
-       }
-}
-
 static void __test_connection_state_callback(wifi_connection_state_e state, wifi_ap_h ap, void* user_data)
 {
        int rv = 0;
@@ -814,6 +774,110 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
        return true;
 }
 
+static bool __test_found_specific_aps_callback(wifi_ap_h ap, void *user_data)
+{
+       printf("Found specific ap Completed\n");
+
+       int rv;
+       char *ap_name = NULL;
+       wifi_security_type_e security_type = WIFI_SECURITY_TYPE_NONE;
+
+       rv = wifi_ap_get_essid(ap, &ap_name);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
+               return -1;
+       }
+       printf("[AP name] : %s\n", ap_name);
+
+       rv = wifi_ap_get_security_type(ap, &security_type);
+       if (rv == WIFI_ERROR_NONE)
+               printf("[Security type] : %d\n", security_type);
+       else {
+               printf("Fail to get Security type\n");
+               g_free(ap_name);
+               return false;
+       }
+
+       switch(security_type) {
+       case WIFI_SECURITY_TYPE_WEP :
+       case WIFI_SECURITY_TYPE_WPA_PSK :
+       case WIFI_SECURITY_TYPE_WPA2_PSK :
+               {
+                       char passphrase[100];
+                       printf("Input passphrase for %s : ", ap_name);
+                       rv = scanf("%99s", passphrase);
+
+                       rv = wifi_ap_set_passphrase(ap, passphrase);
+                       if (rv != WIFI_ERROR_NONE) {
+                               printf("Fail to set passphrase : %s\n", __test_convert_error_to_string(rv));
+                               g_free(ap_name);
+                               return false;
+                       }
+               }
+               break;
+       case WIFI_SECURITY_TYPE_EAP :
+               {
+                       char input_str1[100];
+                       printf("Input user name for %s : ", ap_name);
+                       rv = scanf("%99s", input_str1);
+
+                       char input_str2[100];
+                       printf("Input password for %s : ", ap_name);
+                       rv = scanf("%99s", input_str2);
+
+                       rv = wifi_ap_set_eap_passphrase(ap, input_str1, input_str2);
+                       if (rv != WIFI_ERROR_NONE) {
+                               printf("Fail to set eap passphrase : %s\n", __test_convert_error_to_string(rv));
+                               g_free(ap_name);
+                               return false;
+                       }
+
+                       char *inputed_name = NULL;
+                       bool is_pass_set;
+                       rv = wifi_ap_get_eap_passphrase(ap, &inputed_name, &is_pass_set);
+                       if (rv != WIFI_ERROR_NONE) {
+                               printf("Fail to get eap passphrase : %s\n", __test_convert_error_to_string(rv));
+                               g_free(ap_name);
+                               return false;
+                       }
+
+                       printf("name : %s, is password set : %s\n", inputed_name, is_pass_set ? "TRUE" : "FALSE");
+                       g_free(inputed_name);
+               }
+               break;
+       case WIFI_SECURITY_TYPE_NONE :
+       default :
+               break;
+       }
+
+       rv = wifi_connect(ap, __test_connected_callback, NULL);
+       if (rv != WIFI_ERROR_NONE)
+               printf("Fail to connection request [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
+       else
+               printf("Success to connection request [%s]\n", ap_name);
+
+       g_free(ap_name);
+       return true;
+}
+
+static void __test_scan_specific_ap_callback(wifi_error_e error_code, void* user_data)
+{
+       int rv;
+
+       printf("Specific scan Completed from scan request, error code : %s\n",
+                       __test_convert_error_to_string(error_code));
+
+       if (error_code != WIFI_ERROR_NONE)
+               return;
+
+       rv = wifi_foreach_found_specific_aps(__test_found_specific_aps_callback, user_data);
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Fail to get specific AP(can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
+               return;
+       }
+}
+
+
 int test_wifi_init(void)
 {
        int rv = wifi_initialize();
@@ -1045,6 +1109,27 @@ int test_connect_ap(void)
        return 1;
 }
 
+int test_connect_specific_ap(void)
+{
+       int rv;
+       char ap_name[33];
+
+       printf("Input a part of specific AP name to connect : ");
+       rv = scanf("%32s", ap_name);
+       if (rv <= 0)
+               return -1;
+
+       rv = wifi_scan_specific_ap(ap_name, __test_scan_specific_ap_callback, NULL);
+
+       if (rv != WIFI_ERROR_NONE) {
+               printf("Scan request failed [%s]\n", __test_convert_error_to_string(rv));
+               return -1;
+       }
+
+       printf("Scan specific AP request succeeded\n");
+       return 1;
+}
+
 int test_disconnect_ap(void)
 {
        int rv = 0;
@@ -1212,27 +1297,6 @@ int test_get_ap_info(void)
        return 1;
 }
 
-int test_scan_hidden_ap(void)
-{
-       int rv;
-       char ap_name[33];
-
-       printf("Input a part of hidden AP name to find : ");
-       rv = scanf("%32s", ap_name);
-       if (rv <= 0)
-               return -1;
-
-       rv = wifi_scan_hidden_ap(ap_name, __test_scan_hidden_ap_callback, NULL);
-
-       if (rv != WIFI_ERROR_NONE) {
-               printf("Scan request failed [%s]\n", __test_convert_error_to_string(rv));
-               return -1;
-       }
-
-       printf("Scan hidden AP succeeded\n");
-       return 1;
-}
-
 int main(int argc, char **argv)
 {
        GMainLoop *mainloop;
@@ -1287,8 +1351,8 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("g       - Set & connect EAP\n");
                printf("h       - Set IP method type\n");
                printf("i       - Set Proxy method type\n");
-               printf("j       - Get AP info\n");
-               printf("k       - Scan hidden AP\n");
+               printf("j       - Get Ap info\n");
+               printf("k       - Connect Specific AP\n");
                printf("0       - Exit \n");
 
                printf("ENTER  - Show options menu.......\n");
@@ -1353,7 +1417,7 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                rv = test_get_ap_info();
                break;
        case 'k':
-               rv = test_scan_hidden_ap();
+               rv = test_connect_specific_ap();
                break;
        default:
                break;
@@ -1362,7 +1426,7 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
        if (rv == 1)
                printf("Operation succeeded!\n");
        else
-               printf("Operation filed!\n");
+               printf("Operation failed!\n");
 
        return TRUE;
 }