2 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <sys/socket.h>
27 #include <sys/ioctl.h>
31 #include <tizen_error.h>
33 #define LOG_RED "\033[0;31m"
34 #define LOG_GREEN "\033[0;32m"
35 #define LOG_BROWN "\033[0;33m"
36 #define LOG_BLUE "\033[0;34m"
37 #define LOG_END "\033[0;m"
39 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
41 static const char *__test_convert_error_to_string(wifi_error_e err_type)
46 case WIFI_ERROR_INVALID_PARAMETER:
47 return "INVALID_PARAMETER";
48 case WIFI_ERROR_OUT_OF_MEMORY:
49 return "OUT_OF_MEMORY";
50 case WIFI_ERROR_INVALID_OPERATION:
51 return "INVALID_OPERATION";
52 case WIFI_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
53 return "ADDRESS_FAMILY_NOT_SUPPORTED";
54 case WIFI_ERROR_OPERATION_FAILED:
55 return "OPERATION_FAILED";
56 case WIFI_ERROR_NO_CONNECTION:
57 return "NO_CONNECTION";
58 case WIFI_ERROR_NOW_IN_PROGRESS:
59 return "NOW_IN_PROGRESS";
60 case WIFI_ERROR_ALREADY_EXISTS:
61 return "ALREADY_EXISTS";
62 case WIFI_ERROR_OPERATION_ABORTED:
63 return "OPERATION_ABORTED";
64 case WIFI_ERROR_DHCP_FAILED:
66 case WIFI_ERROR_INVALID_KEY:
68 case WIFI_ERROR_NO_REPLY:
70 case WIFI_ERROR_SECURITY_RESTRICTED:
71 return "SECURITY_RESTRICTED";
72 case WIFI_ERROR_PERMISSION_DENIED:
73 return "PERMISSION_DENIED";
74 case WIFI_ERROR_NOT_SUPPORTED:
75 return "NOT_SUPPORTED";
81 static void __test_device_state_callback(wifi_device_state_e state, void* user_data)
83 printf("Device state changed callback");
85 if (state == WIFI_DEVICE_STATE_ACTIVATED)
86 printf(", state : Activated\n");
88 printf(", state : Deactivated\n");
91 static void __test_bg_scan_completed_callback(wifi_error_e error_code, void* user_data)
93 printf("Background Scan Completed, error code : %s\n",
94 __test_convert_error_to_string(error_code));
97 static void __test_scan_request_callback(wifi_error_e error_code, void* user_data)
99 if (user_data != NULL)
100 printf("user_data : %s\n", (char *)user_data);
102 printf("Scan Completed from scan request, error code : %s\n",
103 __test_convert_error_to_string(error_code));
106 static void __test_connection_state_callback(wifi_connection_state_e state, wifi_ap_h ap, void* user_data)
109 char *ap_name = NULL;
111 printf("Connection state changed callback");
114 case WIFI_CONNECTION_STATE_CONNECTED:
115 printf(", state : Connected");
117 case WIFI_CONNECTION_STATE_ASSOCIATION:
118 printf(", state : Association");
120 case WIFI_CONNECTION_STATE_CONFIGURATION:
121 printf(", state : Configuration");
123 case WIFI_CONNECTION_STATE_DISCONNECTED:
124 printf(", state : Disconnected");
126 case WIFI_CONNECTION_STATE_FAILURE:
127 printf(", state : Failure");
130 printf(", state : Unknown");
133 rv = wifi_ap_get_essid(ap, &ap_name);
134 if (rv != WIFI_ERROR_NONE)
135 printf(", Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
137 printf(", AP name : %s\n", ap_name);
142 static void __test_activated_callback(wifi_error_e result, void* user_data)
144 if (result == WIFI_ERROR_NONE)
145 printf("Wi-Fi Activation Succeeded\n");
147 printf("Wi-Fi Activation Failed! error : %s\n", __test_convert_error_to_string(result));
150 static void __test_deactivated_callback(wifi_error_e result, void* user_data)
152 if (result == WIFI_ERROR_NONE)
153 printf("Wi-Fi Deactivation Succeeded\n");
155 printf("Wi-Fi Deactivation Failed! error : %s\n", __test_convert_error_to_string(result));
158 static void __test_connected_callback(wifi_error_e result, void* user_data)
160 if (result == WIFI_ERROR_NONE)
161 printf("Wi-Fi Connection Succeeded\n");
163 printf("Wi-Fi Connection Failed! error : %s\n", __test_convert_error_to_string(result));
166 static void __test_disconnected_callback(wifi_error_e result, void* user_data)
168 if (result == WIFI_ERROR_NONE)
169 printf("Wi-Fi Disconnection Succeeded\n");
171 printf("Wi-Fi Disconnection Failed! error : %s\n", __test_convert_error_to_string(result));
174 static void __test_rssi_level_callback(wifi_rssi_level_e rssi_level, void* user_data)
176 printf("RSSI level changed callback, level = %d\n", rssi_level);
179 static const char* __test_print_state(wifi_connection_state_e state)
182 case WIFI_CONNECTION_STATE_FAILURE:
184 case WIFI_CONNECTION_STATE_DISCONNECTED:
185 return "Disconnected";
186 case WIFI_CONNECTION_STATE_ASSOCIATION:
187 return "Association";
188 case WIFI_CONNECTION_STATE_CONNECTED:
190 case WIFI_CONNECTION_STATE_CONFIGURATION:
191 return "Configuration";
197 static bool __test_compare_ap_name(const char *ap_name, const char *ap_name_part)
199 int ap_name_len = strlen(ap_name);
200 int ap_name_part_len = strlen(ap_name_part);
202 if (strncmp(ap_name, ap_name_part,
203 ap_name_len > ap_name_part_len ? ap_name_len : ap_name_part_len) == 0)
209 static bool __test_found_ap_callback(wifi_ap_h ap, void *user_data)
212 char *ap_name = NULL;
213 wifi_connection_state_e state;
215 rv = wifi_ap_get_essid(ap, &ap_name);
216 if (rv != WIFI_ERROR_NONE) {
217 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
221 rv = wifi_ap_get_connection_state(ap, &state);
222 if (rv != WIFI_ERROR_NONE) {
223 printf("Fail to get State [%s]\n", __test_convert_error_to_string(rv));
228 printf("AP name : %s, state : %s\n", ap_name, __test_print_state(state));
234 static bool __test_found_connect_ap_callback(wifi_ap_h ap, void *user_data)
237 char *ap_name = NULL;
238 char *ap_name_part = (char*)user_data;
240 rv = wifi_ap_get_essid(ap, &ap_name);
241 if (rv != WIFI_ERROR_NONE) {
242 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
246 if (__test_compare_ap_name(ap_name, ap_name_part)) {
247 bool required = false;
249 if (wifi_ap_is_passphrase_required(ap, &required) == WIFI_ERROR_NONE)
250 printf("Passphrase required : %s\n", required ? "TRUE" : "FALSE");
252 printf("Fail to get Passphrase required\n");
255 char passphrase[100];
256 printf("Input passphrase for %s : ", ap_name);
257 rv = scanf("%99s", passphrase);
259 rv = wifi_ap_set_passphrase(ap, passphrase);
260 if (rv != WIFI_ERROR_NONE) {
261 printf("Fail to set passphrase : %s\n", __test_convert_error_to_string(rv));
267 rv = wifi_connect(ap, __test_connected_callback, NULL);
268 if (rv != WIFI_ERROR_NONE)
269 printf("Fail to connection request [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
271 printf("Success to connection request [%s]\n", ap_name);
281 static bool __test_found_connect_wps_callback(wifi_ap_h ap, void *user_data)
284 char *ap_name = NULL;
285 char *ap_name_part = (char*)user_data;
287 rv = wifi_ap_get_essid(ap, &ap_name);
288 if (rv != WIFI_ERROR_NONE) {
289 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
293 if (__test_compare_ap_name(ap_name, ap_name_part)) {
297 printf("%s - Input WPS method (1:PBC, 2:PIN) :\n", ap_name);
298 rv = scanf("%9d", &user_sel);
302 rv = wifi_connect_by_wps_pbc(ap, __test_connected_callback, NULL);
305 printf("Input PIN code :\n");
306 rv = scanf("%31s", pin);
307 rv = wifi_connect_by_wps_pin(ap, pin, __test_connected_callback, NULL);
310 printf("Invalid input!\n");
315 if (rv != WIFI_ERROR_NONE)
316 printf("Fail to connection request [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
318 printf("Success to connection request [%s]\n", ap_name);
328 static bool __test_found_disconnect_ap_callback(wifi_ap_h ap, void *user_data)
331 char *ap_name = NULL;
332 char *ap_name_part = (char*)user_data;
334 rv = wifi_ap_get_essid(ap, &ap_name);
335 if (rv != WIFI_ERROR_NONE) {
336 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
340 if (__test_compare_ap_name(ap_name, ap_name_part)) {
341 rv = wifi_disconnect(ap, __test_disconnected_callback, NULL);
342 if (rv != WIFI_ERROR_NONE)
343 printf("Fail to disconnection reqeust %s : [%s]\n", ap_name, __test_convert_error_to_string(rv));
345 printf("Success to disconnection request %s\n", ap_name);
355 static bool __test_found_forget_ap_callback(wifi_ap_h ap, void *user_data)
358 char *ap_name = NULL;
359 char *ap_name_part = (char*)user_data;
361 rv = wifi_ap_get_essid(ap, &ap_name);
362 if (rv != WIFI_ERROR_NONE) {
363 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
367 if (__test_compare_ap_name(ap_name, ap_name_part)) {
368 rv = wifi_forget_ap(ap);
369 if (rv != WIFI_ERROR_NONE)
370 printf("Fail to forget [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
372 printf("Success to forget [%s]\n", ap_name);
382 static bool __test_found_eap_ap_callback(wifi_ap_h ap, void *user_data)
385 char *ap_name = NULL;
386 char *ap_name_part = (char*)user_data;
388 rv = wifi_ap_get_essid(ap, &ap_name);
389 if (rv != WIFI_ERROR_NONE) {
390 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
394 if (__test_compare_ap_name(ap_name, ap_name_part)) {
395 wifi_security_type_e type;
397 if (wifi_ap_get_security_type(ap, &type) == WIFI_ERROR_NONE)
398 printf("Security type : %d\n", type);
400 printf("Fail to get Security type\n");
402 if (type != WIFI_SECURITY_TYPE_EAP) {
407 char input_str1[100];
408 printf("Input user name for %s : ", ap_name);
409 rv = scanf("%99s", input_str1);
411 char input_str2[100];
412 printf("Input password for %s : ", ap_name);
413 rv = scanf("%99s", input_str2);
415 rv = wifi_ap_set_eap_passphrase(ap, input_str1, input_str2);
416 if (rv != WIFI_ERROR_NONE) {
417 printf("Fail to set eap passphrase : %s\n", __test_convert_error_to_string(rv));
422 char *inputed_name = NULL;
424 rv = wifi_ap_get_eap_passphrase(ap, &inputed_name, &is_pass_set);
425 if (rv != WIFI_ERROR_NONE) {
426 printf("Fail to get eap passphrase : %s\n", __test_convert_error_to_string(rv));
431 printf("name : %s, is password set : %s\n", inputed_name, is_pass_set ? "TRUE" : "FALSE");
433 printf("Input certificate file:\n");
434 rv = scanf("%99s", input_str1);
436 rv = wifi_ap_set_eap_ca_cert_file(ap, input_str1);
437 if (rv != WIFI_ERROR_NONE) {
438 printf("Fail to set eap certificatefile : %s\n", __test_convert_error_to_string(rv));
444 printf("Input EAP type:\n");
445 printf("0 -> WIFI_EAP_TYPE_PEAP\n");
446 printf("1 -> WIFI_EAP_TYPE_TLS\n");
447 printf("2 -> WIFI_EAP_TYPE_TTLS\n");
448 printf("3 -> WIFI_EAP_TYPE_SIM\n");
449 printf("4 -> WIFI_EAP_TYPE_AKA\n");
450 rv = scanf("%d", &input_int);
452 rv = wifi_ap_set_eap_type(ap, input_int);
453 if (rv != WIFI_ERROR_NONE) {
454 printf("Fail to set eap type : %s\n", __test_convert_error_to_string(rv));
459 printf("Input EAP authentication type:\n");
460 printf("0 -> WIFI_EAP_AUTH_TYPE_NONE\n");
461 printf("1 -> WIFI_EAP_AUTH_TYPE_PAP\n");
462 printf("2 -> WIFI_EAP_AUTH_TYPE_MSCHAP\n");
463 printf("3 -> WIFI_EAP_AUTH_TYPE_MSCHAPV2\n");
464 printf("4 -> WIFI_EAP_AUTH_TYPE_GTC\n");
465 printf("5 -> WIFI_EAP_AUTH_TYPE_MD5\n");
466 rv = scanf("%d", &input_int);
468 rv = wifi_ap_set_eap_auth_type(ap, input_int);
469 if (rv != WIFI_ERROR_NONE) {
470 printf("Fail to set eap auth type : %s\n", __test_convert_error_to_string(rv));
475 rv = wifi_connect(ap, __test_connected_callback, NULL);
476 if (rv != WIFI_ERROR_NONE)
477 printf("Fail to connection request [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
479 printf("Success to connection request [%s]\n", ap_name);
482 g_free(inputed_name);
490 static bool test_get_user_int(const char *msg, int *num)
492 if (msg == NULL || num == NULL)
498 rv = read(0, buf, 32);
500 if (rv < 0 || *buf == 0 || *buf == '\n' || *buf == '\r')
507 static bool __test_found_change_ip_method_callback(wifi_ap_h ap, void *user_data)
511 char *ap_name_part = (char*)user_data;
513 rv = wifi_ap_get_essid(ap, &ap_name);
514 if (rv != WIFI_ERROR_NONE) {
515 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
519 if (__test_compare_ap_name(ap_name, ap_name_part)) {
520 wifi_ip_config_type_e type;
524 printf("Input new method type (1:dhcp, 2:manual, 3:auto) :\n");
525 rv = scanf("%9d", &method);
531 rv = test_get_user_int("Input Address type to get"
532 "(0:IPV4, 1:IPV6):", &address_type);
534 if (rv == false || (address_type != 0 && address_type != 1)) {
535 printf("Invalid input!!\n");
541 type = WIFI_IP_CONFIG_TYPE_DYNAMIC;
544 type = WIFI_IP_CONFIG_TYPE_STATIC;
547 type = WIFI_IP_CONFIG_TYPE_AUTO;
550 printf("Invalid input!\n");
555 rv = wifi_ap_set_ip_config_type(ap, address_type, type);
556 if (rv != WIFI_ERROR_NONE)
557 printf("Fail to set ip method type[%s]\n", __test_convert_error_to_string(rv));
559 if (type == WIFI_IP_CONFIG_TYPE_STATIC) {
562 printf("Input new ip address (x:skip, 0:clear) :\n");
563 rv = scanf("%15s", ip_addr);
565 switch (ip_addr[0]) {
567 rv = WIFI_ERROR_NONE;
570 rv = wifi_ap_set_ip_address(ap, address_type, NULL);
573 rv = wifi_ap_set_ip_address(ap, address_type, ip_addr);
576 if (rv != WIFI_ERROR_NONE)
577 printf("Fail to set ip address[%s]\n",
578 __test_convert_error_to_string(rv));
581 printf("Input new subnet mask (x:skip, 0:clear) :\n");
582 rv = scanf("%15s", ip_addr);
584 switch (ip_addr[0]) {
586 rv = WIFI_ERROR_NONE;
589 rv = wifi_ap_set_subnet_mask(ap, address_type, NULL);
592 rv = wifi_ap_set_subnet_mask(ap, address_type, ip_addr);
595 if (rv != WIFI_ERROR_NONE)
596 printf("Fail to set subnet mask[%s]\n",
597 __test_convert_error_to_string(rv));
600 printf("Input new gateway address (x:skip, 0:clear) :\n");
601 rv = scanf("%15s", ip_addr);
603 switch (ip_addr[0]) {
605 rv = WIFI_ERROR_NONE;
608 rv = wifi_ap_set_gateway_address(ap, address_type, NULL);
611 rv = wifi_ap_set_gateway_address(ap, address_type, ip_addr);
614 if (rv != WIFI_ERROR_NONE)
615 printf("Fail to set gateway address[%s]\n",
616 __test_convert_error_to_string(rv));
628 static bool __test_found_change_proxy_method_callback(wifi_ap_h ap, void *user_data)
630 int rv, address_type;
632 char *ap_name_part = (char*)user_data;
634 rv = wifi_ap_get_essid(ap, &ap_name);
635 if (rv != WIFI_ERROR_NONE) {
636 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
640 printf("ap_name %s, user input name %s\n", ap_name, ap_name_part);
641 if (__test_compare_ap_name(ap_name, ap_name_part)) {
642 wifi_proxy_type_e type;
646 printf("Input new method type (1:direct, 2:manual, 3:auto) :\n");
647 rv = scanf("%9d", &method);
653 rv = test_get_user_int("Input Address type to get"
654 "(0:IPV4, 1:IPV6):", &address_type);
656 if (rv == false || (address_type != 0 && address_type != 1)) {
657 printf("Invalid input!!\n");
663 type = WIFI_PROXY_TYPE_DIRECT;
666 type = WIFI_PROXY_TYPE_MANUAL;
669 type = WIFI_PROXY_TYPE_AUTO;
672 printf("Invalid input!\n");
677 rv = wifi_ap_set_proxy_type(ap, type);
678 if (rv != WIFI_ERROR_NONE)
679 printf("Fail to set proxy method type[%s]\n", __test_convert_error_to_string(rv));
681 printf("Input new proxy address (x:skip, 0:clear) :\n");
682 rv = scanf("%64s", proxy_addr);
685 switch (proxy_addr[0]) {
687 rv = WIFI_ERROR_NONE;
690 rv = wifi_ap_set_proxy_address(ap, address_type, NULL);
693 rv = wifi_ap_set_proxy_address(ap, address_type, proxy_addr);
696 if (rv != WIFI_ERROR_NONE)
697 printf("Fail to set proxy address[%s]\n", __test_convert_error_to_string(rv));
708 static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
710 int rv, address_type = 0;
714 wifi_connection_state_e conn_state;
715 wifi_ip_config_type_e ip_type;
716 wifi_proxy_type_e proxy_type;
717 wifi_security_type_e sec_type;
718 wifi_encryption_type_e enc_type;
719 wifi_eap_type_e eap_type;
720 wifi_eap_auth_type_e eap_auth_type;
722 char *ap_name_part = (char*)user_data;
724 rv = wifi_ap_get_essid(ap, &ap_name);
725 if (rv != WIFI_ERROR_NONE) {
726 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
730 printf("ap_name %s, user input name %s\n", ap_name, ap_name_part);
731 if (__test_compare_ap_name(ap_name, ap_name_part)) {
733 printf("ESSID : %s\n", ap_name);
735 if (wifi_ap_get_bssid(ap, &str_value) == WIFI_ERROR_NONE) {
736 printf("BSSID : %s\n", str_value);
739 printf("Fail to get BSSID\n");
741 if (wifi_ap_get_rssi(ap, &int_value) == WIFI_ERROR_NONE)
742 printf("RSSI : %d\n", int_value);
744 printf("Fail to get RSSI\n");
746 if (wifi_ap_get_frequency(ap, &int_value) == WIFI_ERROR_NONE)
747 printf("Frequency : %d\n", int_value);
749 printf("Fail to get Frequency\n");
751 if (wifi_ap_get_max_speed(ap, &int_value) == WIFI_ERROR_NONE)
752 printf("Max speed : %d\n", int_value);
754 printf("Fail to get Max speed\n");
756 if (wifi_ap_is_favorite(ap, &bool_value) == WIFI_ERROR_NONE)
757 printf("Favorite : %s\n", bool_value ? "TRUE" : "FALSE");
759 printf("Fail to get Favorite\n");
762 if (wifi_ap_get_connection_state(ap, &conn_state) == WIFI_ERROR_NONE)
763 printf("Connection State : %d\n", conn_state);
765 printf("Fail to get Connection State\n");
767 rv = test_get_user_int("Input Address type to get"
768 "(0:IPV4, 1:IPV6):", &address_type);
770 if (rv == false || (address_type != 0 && address_type != 1)) {
771 printf("Invalid input!!\n");
775 if (wifi_ap_get_ip_config_type(ap, address_type, &ip_type) == WIFI_ERROR_NONE)
776 printf("IP config type : %d\n", ip_type);
778 printf("Fail to get IP config type\n");
780 if (wifi_ap_get_ip_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
781 printf("IP : %s\n", str_value);
784 printf("Fail to get IP\n");
786 if (wifi_ap_get_subnet_mask(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
787 printf("Subnet mask : %s\n", str_value);
790 printf("Fail to get Subnet mask\n");
792 if (wifi_ap_get_gateway_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
793 printf("Gateway : %s\n", str_value);
796 printf("Fail to get Gateway\n");
798 if (wifi_ap_get_proxy_type(ap, &proxy_type) == WIFI_ERROR_NONE)
799 printf("Proxy type : %d\n", proxy_type);
801 printf("Fail to get Proxy type\n");
803 if (wifi_ap_get_proxy_address(ap, address_type, &str_value) == WIFI_ERROR_NONE) {
804 printf("Proxy : %s\n", str_value);
807 printf("Fail to get Proxy\n");
809 if (wifi_ap_get_dns_address(ap, 1, address_type, &str_value) == WIFI_ERROR_NONE) {
810 printf("DNS1 : %s\n", str_value);
813 printf("Fail to get DNS1\n");
815 if (wifi_ap_get_dns_address(ap, 2, address_type, &str_value) == WIFI_ERROR_NONE) {
816 printf("DNS2 : %s\n", str_value);
819 printf("Fail to get DNS2\n");
822 if (wifi_ap_get_security_type(ap, &sec_type) == WIFI_ERROR_NONE)
823 printf("Security type : %d\n", sec_type);
825 printf("Fail to get Security type\n");
827 if (wifi_ap_get_encryption_type(ap, &enc_type) == WIFI_ERROR_NONE)
828 printf("Encryption type : %d\n", enc_type);
830 printf("Fail to get Encryption type\n");
832 if (wifi_ap_is_passphrase_required(ap, &bool_value) == WIFI_ERROR_NONE)
833 printf("Passphrase required : %s\n", bool_value ? "TRUE" : "FALSE");
835 printf("Fail to get Passphrase required\n");
837 if (wifi_ap_is_wps_supported(ap, &bool_value) == WIFI_ERROR_NONE)
838 printf("WPS supported : %s\n", bool_value ? "TRUE" : "FALSE");
840 printf("Fail to get WPS supported\n");
842 if (sec_type != WIFI_SECURITY_TYPE_EAP) {
848 if (wifi_ap_get_eap_type(ap, &eap_type) == WIFI_ERROR_NONE)
849 printf("EAP type : %d\n", eap_type);
851 printf("Fail to get EAP type\n");
853 if (wifi_ap_get_eap_auth_type(ap, &eap_auth_type) == WIFI_ERROR_NONE)
854 printf("EAP auth type : %d\n", eap_auth_type);
856 printf("Fail to get EAP auth type\n");
858 if (wifi_ap_get_eap_passphrase(ap, &str_value, &bool_value) == WIFI_ERROR_NONE) {
859 printf("EAP user name : %s\n", str_value);
860 printf("EAP is password setted : %s\n", bool_value ? "TRUE" : "FALSE");
863 printf("Fail to get EAP passphrase(user name/password)\n");
865 if (wifi_ap_get_eap_ca_cert_file(ap, &str_value) == WIFI_ERROR_NONE) {
866 printf("EAP ca cert file : %s\n", str_value);
869 printf("Fail to get EAP ca cert file\n");
871 if (wifi_ap_get_eap_client_cert_file(ap, &str_value) == WIFI_ERROR_NONE) {
872 printf("EAP client cert file : %s\n", str_value);
875 printf("Fail to get EAP client cert file\n");
877 if (wifi_ap_get_eap_private_key_file(ap, &str_value) == WIFI_ERROR_NONE) {
878 printf("EAP private key file : %s\n", str_value);
881 printf("Fail to get EAP private key file\n");
891 static bool _test_config_list_cb(const wifi_config_h config, void *user_data)
894 wifi_security_type_e security_type;
896 wifi_config_get_name(config, &name);
897 wifi_config_get_security_type(config, &security_type);
899 printf("Name[%s] ", name);
900 printf("Security type[%d] ", security_type);
901 if (security_type == WIFI_SECURITY_TYPE_EAP) {
902 wifi_eap_type_e eap_type;
903 wifi_eap_auth_type_e eap_auth_type;
904 wifi_config_get_eap_type(config, &eap_type);
905 printf("Eap type[%d] ", eap_type);
906 wifi_config_get_eap_auth_type(config, &eap_auth_type);
907 printf("Eap auth type[%d]", eap_auth_type);
920 static bool _test_config_list_cb_for_remove(const wifi_config_h config, void *user_data)
923 struct _wifi_conf *c = (struct _wifi_conf *)user_data;
925 wifi_security_type_e security_type;
927 wifi_config_get_name(config, &name);
928 wifi_config_get_security_type(config, &security_type);
930 if (strncmp(name, c->name, sizeof(c->name)) == 0 && security_type == c->type) {
931 int rv = wifi_config_remove(config);
932 if (rv != WIFI_ERROR_NONE)
933 printf("Fail to remove configurations [%s]\n", __test_convert_error_to_string(rv));
935 printf("Success to remove configuration [%s]\n", name);
944 static bool __test_found_specific_aps_callback(wifi_ap_h ap, void *user_data)
946 printf("Found specific ap Completed\n");
949 char *ap_name = NULL;
950 wifi_security_type_e security_type = WIFI_SECURITY_TYPE_NONE;
952 rv = wifi_ap_get_essid(ap, &ap_name);
953 if (rv != WIFI_ERROR_NONE) {
954 printf("Fail to get AP name [%s]\n", __test_convert_error_to_string(rv));
957 printf("[AP name] : %s\n", ap_name);
959 rv = wifi_ap_get_security_type(ap, &security_type);
960 if (rv == WIFI_ERROR_NONE)
961 printf("[Security type] : %d\n", security_type);
963 printf("Fail to get Security type\n");
968 switch (security_type) {
969 case WIFI_SECURITY_TYPE_WEP:
970 case WIFI_SECURITY_TYPE_WPA_PSK:
971 case WIFI_SECURITY_TYPE_WPA2_PSK:
973 char passphrase[100];
974 printf("Input passphrase for %s : ", ap_name);
975 rv = scanf("%99s", passphrase);
977 rv = wifi_ap_set_passphrase(ap, passphrase);
978 if (rv != WIFI_ERROR_NONE) {
979 printf("Fail to set passphrase : %s\n", __test_convert_error_to_string(rv));
985 case WIFI_SECURITY_TYPE_EAP:
987 char input_str1[100];
988 printf("Input user name for %s : ", ap_name);
989 rv = scanf("%99s", input_str1);
991 char input_str2[100];
992 printf("Input password for %s : ", ap_name);
993 rv = scanf("%99s", input_str2);
995 rv = wifi_ap_set_eap_passphrase(ap, input_str1, input_str2);
996 if (rv != WIFI_ERROR_NONE) {
997 printf("Fail to set eap passphrase : %s\n", __test_convert_error_to_string(rv));
1002 char *inputed_name = NULL;
1004 rv = wifi_ap_get_eap_passphrase(ap, &inputed_name, &is_pass_set);
1005 if (rv != WIFI_ERROR_NONE) {
1006 printf("Fail to get eap passphrase : %s\n", __test_convert_error_to_string(rv));
1011 printf("name : %s, is password set : %s\n", inputed_name, is_pass_set ? "TRUE" : "FALSE");
1012 g_free(inputed_name);
1015 case WIFI_SECURITY_TYPE_NONE:
1020 rv = wifi_connect(ap, __test_connected_callback, NULL);
1021 if (rv != WIFI_ERROR_NONE)
1022 printf("Fail to connection request [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
1024 printf("Success to connection request [%s]\n", ap_name);
1030 static void __test_scan_specific_ap_callback(wifi_error_e error_code, void* user_data)
1034 printf("Specific scan Completed from scan request, error code : %s\n",
1035 __test_convert_error_to_string(error_code));
1037 if (error_code != WIFI_ERROR_NONE)
1040 rv = wifi_foreach_found_specific_aps(__test_found_specific_aps_callback, user_data);
1041 if (rv != WIFI_ERROR_NONE) {
1042 printf("Fail to get specific AP(can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1047 int test_wifi_init(void)
1049 int rv = wifi_initialize();
1051 if (rv == WIFI_ERROR_NONE) {
1052 wifi_set_device_state_changed_cb(__test_device_state_callback, NULL);
1053 wifi_set_background_scan_cb(__test_bg_scan_completed_callback, NULL);
1054 wifi_set_connection_state_changed_cb(__test_connection_state_callback, NULL);
1055 wifi_set_rssi_level_changed_cb(__test_rssi_level_callback, NULL);
1057 printf("Wifi init failed [%s]\n", __test_convert_error_to_string(rv));
1061 printf("Wifi init succeeded\n");
1065 int test_wifi_deinit(void)
1069 rv = wifi_deinitialize();
1071 if (rv != WIFI_ERROR_NONE) {
1072 printf("Wifi deinit failed [%s]\n", __test_convert_error_to_string(rv));
1076 printf("Wifi deinit succeeded\n");
1080 int test_wifi_activate(void)
1086 rv = wifi_is_activated(&state);
1088 if (state != true) {
1089 rv = wifi_activate(__test_activated_callback, NULL);
1091 if (rv != WIFI_ERROR_NONE) {
1092 printf("Fail to activate Wi-Fi device [%s]", __test_convert_error_to_string(rv));
1096 __test_activated_callback(WIFI_ERROR_NONE, NULL);
1102 int test_wifi_deactivate(void)
1107 rv = wifi_is_activated(&state);
1109 if (state == true) {
1110 rv = wifi_deactivate(__test_deactivated_callback, NULL);
1112 if (rv != WIFI_ERROR_NONE) {
1113 printf("Fail to deactivate Wi-Fi device [%s]\n", __test_convert_error_to_string(rv));
1117 __test_deactivated_callback(WIFI_ERROR_NONE, NULL);
1123 int test_is_activated(void)
1128 rv = wifi_is_activated(&state);
1130 if (rv != WIFI_ERROR_NONE) {
1131 printf("Fail to get Wi-Fi device state [%s]\n", __test_convert_error_to_string(rv));
1135 printf("Success to get Wi-Fi device state : %s\n", (state) ? "TRUE" : "FALSE");
1140 int test_get_connection_state(void)
1143 wifi_connection_state_e connection_state;
1145 rv = wifi_get_connection_state(&connection_state);
1147 if (rv != WIFI_ERROR_NONE) {
1148 printf("Fail to get connection state [%s]\n", __test_convert_error_to_string(rv));
1152 printf("Success to get connection state : ");
1153 switch (connection_state) {
1154 case WIFI_CONNECTION_STATE_ASSOCIATION:
1155 printf("Association\n");
1157 case WIFI_CONNECTION_STATE_CONNECTED:
1158 printf("Connected\n");
1160 case WIFI_CONNECTION_STATE_CONFIGURATION:
1161 printf("Configuration\n");
1163 case WIFI_CONNECTION_STATE_DISCONNECTED:
1164 printf("Disconnected\n");
1167 printf("Unknown\n");
1173 int test_get_mac_address(void)
1176 char *mac_addr = NULL;
1178 rv = wifi_get_mac_address(&mac_addr);
1180 if (rv != WIFI_ERROR_NONE) {
1181 printf("Fail to get MAC address [%s]\n", __test_convert_error_to_string(rv));
1185 printf("MAC address : %s\n", mac_addr);
1191 int test_get_interface_name(void)
1194 char *if_name = NULL;
1196 rv = wifi_get_network_interface_name(&if_name);
1198 if (rv != WIFI_ERROR_NONE) {
1199 printf("Fail to get Interface name [%s]\n", __test_convert_error_to_string(rv));
1203 printf("Interface name : %s\n", if_name);
1209 int test_scan_request(void)
1213 rv = wifi_scan(__test_scan_request_callback, NULL);
1215 if (rv != WIFI_ERROR_NONE) {
1216 printf("Scan request failed [%s]\n", __test_convert_error_to_string(rv));
1220 printf("Scan request succeeded\n");
1225 int test_get_connected_ap(void)
1228 char *ap_name = NULL;
1231 rv = wifi_get_connected_ap(&ap_h);
1232 if (rv != WIFI_ERROR_NONE) {
1233 printf("Fail to get connected AP [%s]\n", __test_convert_error_to_string(rv));
1237 rv = wifi_ap_get_essid(ap_h, &ap_name);
1238 if (rv != WIFI_ERROR_NONE) {
1239 printf("Fail to get essid [%s]\n", __test_convert_error_to_string(rv));
1240 wifi_ap_destroy(ap_h);
1244 printf("Connected AP : %s\n", ap_name);
1246 wifi_ap_destroy(ap_h);
1251 int test_foreach_found_aps(void)
1255 rv = wifi_foreach_found_aps(__test_found_ap_callback, NULL);
1256 if (rv != WIFI_ERROR_NONE) {
1257 printf("Fail to get AP list [%s]\n", __test_convert_error_to_string(rv));
1261 printf("Get AP list finished\n");
1266 int test_connect_ap(void)
1272 wifi_is_activated(&state);
1276 printf("Input a part of AP name to connect : ");
1277 rv = scanf("%32s", ap_name);
1279 rv = wifi_foreach_found_aps(__test_found_connect_ap_callback, ap_name);
1280 if (rv != WIFI_ERROR_NONE) {
1281 printf("Fail to connect (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1285 printf("Connection step finished\n");
1289 int test_connect_specific_ap(void)
1294 printf("Input a part of specific AP name to connect : ");
1295 rv = scanf("%32s", ap_name);
1299 rv = wifi_scan_specific_ap(ap_name, __test_scan_specific_ap_callback, NULL);
1301 if (rv != WIFI_ERROR_NONE) {
1302 printf("Scan request failed [%s]\n", __test_convert_error_to_string(rv));
1306 printf("Scan specific AP request succeeded\n");
1310 int test_disconnect_ap(void)
1316 wifi_is_activated(&state);
1320 printf("Input a part of AP name to disconnect : ");
1321 rv = scanf("%32s", ap_name);
1323 rv = wifi_foreach_found_aps(__test_found_disconnect_ap_callback, ap_name);
1324 if (rv != WIFI_ERROR_NONE) {
1325 printf("Fail to disconnect (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1329 printf("Disconnection step finished\n");
1333 int test_connect_wps(void)
1339 wifi_is_activated(&state);
1343 printf("Input a part of AP name to connect by wps : ");
1344 rv = scanf("%32s", ap_name);
1346 rv = wifi_foreach_found_aps(__test_found_connect_wps_callback, ap_name);
1347 if (rv != WIFI_ERROR_NONE) {
1348 printf("Fail to connect (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1352 printf("Connection step finished\n");
1356 int test_forget_ap(void)
1362 wifi_is_activated(&state);
1366 printf("Input a part of AP name to forget : ");
1367 rv = scanf("%32s", ap_name);
1369 rv = wifi_foreach_found_aps(__test_found_forget_ap_callback, ap_name);
1370 if (rv != WIFI_ERROR_NONE) {
1371 printf("Fail to forget (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1375 printf("Forget AP finished\n");
1379 int test_connect_eap_ap(void)
1385 wifi_is_activated(&state);
1389 printf("Input a part of AP name to connect : ");
1390 rv = scanf("%32s", ap_name);
1392 rv = wifi_foreach_found_aps(__test_found_eap_ap_callback, ap_name);
1393 if (rv != WIFI_ERROR_NONE) {
1394 printf("Fail to connect (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1398 printf("Connection step finished\n");
1402 int test_set_ip_method(void)
1408 rv = wifi_is_activated(&state);
1409 if (rv != WIFI_ERROR_NONE || state == false)
1412 printf("Input a part of AP name to change IP method : ");
1413 rv = scanf("%32s", ap_name);
1417 rv = wifi_foreach_found_aps(__test_found_change_ip_method_callback, ap_name);
1418 if (rv != WIFI_ERROR_NONE) {
1419 printf("Fail to change (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1423 printf("IP method changing finished\n");
1427 int test_set_proxy_method(void)
1433 rv = wifi_is_activated(&state);
1434 if (rv != WIFI_ERROR_NONE || state == false)
1437 printf("Input a part of AP name to change Proxy method : ");
1438 rv = scanf("%32s", ap_name);
1442 rv = wifi_foreach_found_aps(__test_found_change_proxy_method_callback, ap_name);
1443 if (rv != WIFI_ERROR_NONE) {
1444 printf("Fail to change (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1448 printf("Proxy method changing finished\n");
1452 int test_get_ap_info(void)
1458 rv = wifi_is_activated(&state);
1459 if (rv != WIFI_ERROR_NONE || state == false)
1462 printf("Input a part of AP name to get detailed info : ");
1463 rv = scanf("%32s", ap_name);
1467 rv = wifi_foreach_found_aps(__test_found_print_ap_info_callback, ap_name);
1468 if (rv != WIFI_ERROR_NONE) {
1469 printf("Fail to get AP info (can't get AP list) [%s]\n", __test_convert_error_to_string(rv));
1473 printf("AP info printing finished\n");
1477 int test_load_configuration(void)
1481 rv = wifi_config_foreach_configuration(_test_config_list_cb, NULL);
1482 if (rv != WIFI_ERROR_NONE) {
1483 printf("Fail to get configurations [%s]\n", __test_convert_error_to_string(rv));
1490 int test_save_configuration(void)
1493 char name[33] = { 0, };
1494 char passphrase[100] = { 0, };
1496 wifi_config_h config;
1498 printf("Input AP configuration\n");
1500 rv = scanf("%32s", name);
1504 printf("Passphrase : ");
1505 rv = scanf("%99s", passphrase);
1509 printf("Security type(None(0), WEP(1), WPA-PSK(2), EAP(4) : ");
1510 rv = scanf("%d", &type);
1514 rv = wifi_config_create(name, passphrase, type, &config);
1515 if (rv != WIFI_ERROR_NONE)
1518 rv = wifi_config_save_configuration(config);
1519 if (rv != WIFI_ERROR_NONE)
1522 rv = wifi_config_destroy(config);
1523 if (rv != WIFI_ERROR_NONE)
1529 int test_remove_configuration(void)
1532 struct _wifi_conf c;
1534 printf("Input AP configuration\n");
1536 rv = scanf("%32s", c.name);
1540 printf("Security type(None(0), WEP(1), WPA-PSK(2), EAP(4) : ");
1541 rv = scanf("%d", &c.type);
1545 rv = wifi_config_foreach_configuration(_test_config_list_cb_for_remove, &c);
1546 if (rv != WIFI_ERROR_NONE) {
1547 printf("Fail to get configurations [%s]\n", __test_convert_error_to_string(rv));
1554 int test_set_configuration_proxy_and_hidden(void)
1557 char name[33] = { 0, };
1558 char passphrase[100] = { 0, };
1560 char proxy[100] = { 0, };
1562 wifi_config_h config;
1564 printf("Input AP configuration\n");
1566 rv = scanf("%32s", name);
1570 printf("Passphrase : ");
1571 rv = scanf("%99s", passphrase);
1575 printf("Security type(None(0), WEP(1), WPA-PSK(2), EAP(4) : ");
1576 rv = scanf("%d", &type);
1580 printf("Proxy(server:port) : ");
1581 rv = scanf("%99s", proxy);
1585 printf("Hidden(1:Hidden) : ");
1586 rv = scanf("%d", &hidden);
1590 rv = wifi_config_create(name, passphrase, type, &config);
1591 if (rv != WIFI_ERROR_NONE)
1594 rv = wifi_config_save_configuration(config);
1595 if (rv != WIFI_ERROR_NONE) {
1596 wifi_config_destroy(config);
1600 rv = wifi_config_set_proxy_address(config, WIFI_ADDRESS_FAMILY_IPV4, proxy);
1601 if (rv != WIFI_ERROR_NONE) {
1602 wifi_config_destroy(config);
1607 rv = wifi_config_set_hidden_ap_property(config, TRUE);
1609 rv = wifi_config_set_hidden_ap_property(config, FALSE);
1610 if (rv != WIFI_ERROR_NONE) {
1611 wifi_config_destroy(config);
1615 rv = wifi_config_destroy(config);
1616 if (rv != WIFI_ERROR_NONE)
1622 int test_set_eap_configuration(void)
1625 char name[33] = { 0, };
1626 char passphrase[100] = { 0, };
1627 int type = WIFI_SECURITY_TYPE_EAP;
1628 wifi_config_h config;
1630 printf("Input EAP configuration\n");
1632 rv = scanf("%32s", name);
1636 printf("Passphrase : ");
1637 rv = scanf("%99s", passphrase);
1641 rv = wifi_config_create(name, passphrase, type, &config);
1642 if (rv != WIFI_ERROR_NONE)
1645 rv = wifi_config_save_configuration(config);
1646 if (rv != WIFI_ERROR_NONE)
1649 rv = wifi_config_set_eap_type(config, WIFI_EAP_TYPE_TLS);
1650 if (rv != WIFI_ERROR_NONE)
1653 rv = wifi_config_set_eap_auth_type(config, WIFI_EAP_AUTH_TYPE_MD5);
1654 if (rv != WIFI_ERROR_NONE)
1657 rv = wifi_config_destroy(config);
1658 if (rv != WIFI_ERROR_NONE)
1664 int test_wifi_tdls_disconnect(void)
1669 printf("Enter Mac_address: ");
1670 if (scanf(" %17s", peer_mac) < 1)
1673 if (strlen(peer_mac) > 17) {
1674 printf("Wrong Mac_address\n");
1678 rv = wifi_tdls_disconnect(peer_mac);
1679 if (rv != WIFI_ERROR_NONE) {
1680 printf("test_wifi_tdls_disconnect() is failed [%s]\n", __test_convert_error_to_string(rv));
1686 int test_wifi_tdls_get_connected_peer(void)
1689 char *mac_addr = NULL;
1691 rv = wifi_tdls_get_connected_peer(&mac_addr);
1692 if (rv != WIFI_ERROR_NONE) {
1693 printf("wifi_tdls_get_connected_peer() is failed [%s]\n", __test_convert_error_to_string(rv));
1696 printf("Peer Mac address is [%s]\n", mac_addr);
1701 int test_wifi_connect_specific_ap(void)
1705 char passphrase[65];
1709 wifi_is_activated(&state);
1713 printf("Input hidden AP name to connect : ");
1714 rv = scanf("%32s", ap_name);
1715 printf("Input Security Type :\n");
1716 printf("0 -> WIFI_SECURITY_TYPE_NONE\n");
1717 printf("1 -> WIFI_SECURITY_TYPE_WEP\n");
1718 printf("2 -> WIFI_SECURITY_TYPE_WPA_PSK/WIFI_SECURITY_TYPE_WPA2_PSK\n");
1719 rv = scanf("%d", &sec_type);
1720 if (sec_type == 1 || sec_type == 2) {
1721 printf("Input hidden AP passphrase : ");
1722 rv = scanf("%64s", passphrase);
1725 rv = wifi_connect_specific_ap(ap_name, sec_type, passphrase,
1726 __test_connected_callback, NULL);
1727 if (rv != WIFI_ERROR_NONE) {
1728 printf("Fail to connect to hidden AP [%s]\n", __test_convert_error_to_string(rv));
1732 printf("Hidden Connection step finished\n");
1736 int main(int argc, char **argv)
1738 GMainLoop *mainloop;
1739 #if !GLIB_CHECK_VERSION(2, 36, 0)
1742 mainloop = g_main_loop_new(NULL, FALSE);
1744 GIOChannel *channel = g_io_channel_unix_new(0);
1745 g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread, NULL);
1747 printf("Test Thread created...\n");
1749 g_main_loop_run(mainloop);
1754 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
1759 printf("Event received from stdin\n");
1761 rv = read(0, a, 10);
1763 if (rv <= 0 || a[0] == '0') {
1764 rv = wifi_deinitialize();
1766 if (rv != WIFI_ERROR_NONE)
1767 printf("Fail to deinitialize.\n");
1772 if (a[0] == '\n' || a[0] == '\r') {
1773 printf("\n\n Network Connection API Test App\n\n");
1774 printf("Options..\n");
1775 printf(LOG_GREEN "1 - Wi-Fi init and set callbacks\n" LOG_END);
1776 printf("2 - Wi-Fi deinit(unset callbacks automatically)\n");
1777 printf(LOG_GREEN "3 - Activate Wi-Fi device\n" LOG_END);
1778 printf("4 - Deactivate Wi-Fi device\n");
1779 printf("5 - Is Wi-Fi activated?\n");
1780 printf("6 - Get connection state\n");
1781 printf("7 - Get MAC address\n");
1782 printf("8 - Get Wi-Fi interface name\n");
1783 printf(LOG_GREEN "9 - Scan request\n" LOG_END);
1784 printf("a - Get Connected AP\n");
1785 printf("b - Get AP list\n");
1786 printf(LOG_GREEN "c - Connect\n" LOG_END);
1787 printf("d - Disconnect\n");
1788 printf("e - Connect by wps pbc\n");
1789 printf("f - Forget an AP\n");
1790 printf("g - Set & connect EAP\n");
1791 printf("h - Set IP method type\n");
1792 printf("i - Set Proxy method type\n");
1793 printf("j - Get Ap info\n");
1794 printf("k - Connect Specific AP\n");
1795 printf("l - Load configuration\n");
1796 printf("m - Save configuration\n");
1797 printf("n - Remove configuration\n");
1798 printf("o - Set configuration proxy and hidden\n");
1799 printf("p - Set EAP configuration\n");
1800 printf("q - TDLS TearDown\n");
1801 printf("r - TDLS Get Connected Peer\n");
1802 printf("s - Connect to Hidden AP\n");
1803 printf(LOG_RED "0 - Exit \n" LOG_END);
1805 printf("ENTER - Show options menu.......\n");
1810 rv = test_wifi_init();
1813 rv = test_wifi_deinit();
1816 rv = test_wifi_activate();
1819 rv = test_wifi_deactivate();
1822 rv = test_is_activated();
1825 rv = test_get_connection_state();
1828 rv = test_get_mac_address();
1831 rv = test_get_interface_name();
1834 rv = test_scan_request();
1837 rv = test_get_connected_ap();
1840 rv = test_foreach_found_aps();
1843 rv = test_connect_ap();
1846 rv = test_disconnect_ap();
1849 rv = test_connect_wps();
1852 rv = test_forget_ap();
1855 rv = test_connect_eap_ap();
1858 rv = test_set_ip_method();
1861 rv = test_set_proxy_method();
1864 rv = test_get_ap_info();
1867 rv = test_connect_specific_ap();
1870 rv = test_load_configuration();
1873 rv = test_save_configuration();
1876 rv = test_remove_configuration();
1879 rv = test_set_configuration_proxy_and_hidden();
1882 rv = test_set_eap_configuration();
1885 rv = test_wifi_tdls_disconnect();
1888 rv = test_wifi_tdls_get_connected_peer();
1891 rv = test_wifi_connect_specific_ap();
1898 printf("Operation succeeded!\n");
1900 printf("Operation failed!\n");