2 * Copyright (c) 2011 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.
22 #include <glib-object.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25 #include <arpa/inet.h>
29 #include "tethering.h"
31 #define DISABLE_REASON_TEXT_LEN 64
32 #define COMMON_STR_BUF_LEN 32
34 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data);
37 tethering_enabled_cb enabled_cb;
38 tethering_disabled_cb disabled_cb;
39 tethering_connection_state_changed_cb changed_cb;
40 tethering_wifi_security_type_changed_cb security_type_changed_cb;
41 tethering_wifi_ssid_visibility_changed_cb ssid_visibility_changed_cb;
42 tethering_wifi_passphrase_changed_cb passphrase_changed_cb;
45 tethering_h th = NULL;
47 static bool __is_err(tethering_error_e ret)
52 case TETHERING_ERROR_INVALID_PARAMETER:
53 err_msg = "Wrong parameter is used";
56 case TETHERING_ERROR_OUT_OF_MEMORY:
57 err_msg = "Memory is not enough";
60 case TETHERING_ERROR_NONE:
63 case TETHERING_ERROR_NOT_ENABLED:
64 err_msg = "Tethering is not enabled";
67 case TETHERING_ERROR_OPERATION_FAILED:
68 err_msg = "Operation is failed";
71 case TETHERING_ERROR_RESOURCE_BUSY:
72 err_msg = "Resource is busy";
76 err_msg = "This should not be happened";
80 g_print("##ERR: %s\n", err_msg);
85 static const char *__convert_tethering_type_to_str(const tethering_type_e type)
87 static char str_buf[COMMON_STR_BUF_LEN] = {0, };
90 case TETHERING_TYPE_USB:
91 g_strlcpy(str_buf, "USB Tethering", sizeof(str_buf));
94 case TETHERING_TYPE_WIFI:
95 g_strlcpy(str_buf, "Wi-Fi Tethering", sizeof(str_buf));
98 case TETHERING_TYPE_BT:
99 g_strlcpy(str_buf, "Bluetooth Tethering", sizeof(str_buf));
102 case TETHERING_TYPE_RESERVED:
103 g_strlcpy(str_buf, "Wi-Fi AP", sizeof(str_buf));
107 g_strlcpy(str_buf, "Unknown", sizeof(str_buf));
114 static const char *__convert_disabled_code_to_str(const tethering_disabled_cause_e code)
116 static char str_buf[DISABLE_REASON_TEXT_LEN] = {0, };
119 case TETHERING_DISABLED_BY_USB_DISCONNECTION:
120 strncpy(str_buf, "disabled due to usb disconnection", sizeof(str_buf));
123 case TETHERING_DISABLED_BY_FLIGHT_MODE:
124 strncpy(str_buf, "disabled due to flight mode on", sizeof(str_buf));
127 case TETHERING_DISABLED_BY_LOW_BATTERY:
128 strncpy(str_buf, "disabled due to low battery", sizeof(str_buf));
131 case TETHERING_DISABLED_BY_NETWORK_CLOSE:
132 strncpy(str_buf, "disabled due to pdp network close", sizeof(str_buf));
135 case TETHERING_DISABLED_BY_TIMEOUT:
136 strncpy(str_buf, "disabled due to timeout", sizeof(str_buf));
139 case TETHERING_DISABLED_BY_OTHERS:
140 strncpy(str_buf, "disabled by other apps", sizeof(str_buf));
143 case TETHERING_DISABLED_BY_REQUEST:
144 strncpy(str_buf, "disabled by my request", sizeof(str_buf));
147 case TETHERING_DISABLED_BY_WIFI_ON:
148 strncpy(str_buf, "disabled by Wi-Fi station on", sizeof(str_buf));
151 case TETHERING_DISABLED_BY_BT_OFF:
152 strncpy(str_buf, "disabled by bluetooth off", sizeof(str_buf));
156 strncpy(str_buf, "disabled by unknown reason", sizeof(str_buf));
163 static void __register_cbs(tethering_h th, __tethering_cbs *cbs, void *user_data)
165 tethering_error_e ret = TETHERING_ERROR_NONE;
167 ret = tethering_set_enabled_cb(th, TETHERING_TYPE_ALL,
168 cbs->enabled_cb, user_data);
169 if (__is_err(ret) == true) {
170 g_print("tethering_set_enabled_cb is failed\n");
173 ret = tethering_set_enabled_cb(th, TETHERING_TYPE_RESERVED,
174 cbs->enabled_cb, user_data);
175 if (__is_err(ret) == true) {
176 g_print("tethering_set_enabled_cb is failed\n");
179 ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL,
180 cbs->disabled_cb, user_data);
181 if (__is_err(ret) == true) {
182 g_print("tethering_set_disabled_cb is failed\n");
185 ret = tethering_set_disabled_cb(th, TETHERING_TYPE_RESERVED,
186 cbs->disabled_cb, user_data);
187 if (__is_err(ret) == true) {
188 g_print("tethering_set_disabled_cb is failed\n");
191 ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL,
192 cbs->changed_cb, user_data);
193 if (__is_err(ret) == true) {
194 g_print("tethering_set_connection_state_changed_cb is failed\n");
197 ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED,
198 cbs->changed_cb, user_data);
199 if (__is_err(ret) == true) {
200 g_print("tethering_set_connection_state_changed_cb is failed\n");
203 ret = tethering_wifi_set_security_type_changed_cb(th,
204 cbs->security_type_changed_cb, user_data);
205 if (__is_err(ret) == true) {
206 g_print("tethering_wifi_set_security_type_changed_cb is failed\n");
209 ret = tethering_wifi_set_ssid_visibility_changed_cb(th,
210 cbs->ssid_visibility_changed_cb, user_data);
211 if (__is_err(ret) == true) {
212 g_print("tethering_wifi_set_ssid_visibility_changed_cb is failed\n");
215 ret = tethering_wifi_set_passphrase_changed_cb(th,
216 cbs->passphrase_changed_cb, user_data);
217 if (__is_err(ret) == true) {
218 g_print("tethering_wifi_set_passphrase_changed_cb is failed\n");
224 static void __deregister_cbs(tethering_h th)
226 tethering_error_e ret = TETHERING_ERROR_NONE;
228 ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_ALL);
229 if (__is_err(ret) == true) {
230 g_print("tethering_unset_enabled_cb is failed\n");
233 ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_RESERVED);
234 if (__is_err(ret) == true) {
235 g_print("tethering_unset_enabled_cb is failed\n");
238 ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL);
239 if (__is_err(ret) == true) {
240 g_print("tethering_unset_disabled_cb is failed\n");
243 ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_RESERVED);
244 if (__is_err(ret) == true) {
245 g_print("tethering_unset_disabled_cb is failed\n");
248 ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL);
249 if (__is_err(ret) == true) {
250 g_print("tethering_unset_connection_state_changed_cb is failed\n");
253 ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED);
254 if (__is_err(ret) == true) {
255 g_print("tethering_unset_connection_state_changed_cb is failed\n");
258 ret = tethering_wifi_unset_security_type_changed_cb(th);
259 if (__is_err(ret) == true) {
260 g_print("tethering_wifi_unset_security_type_changed_cb is failed\n");
263 ret = tethering_wifi_unset_ssid_visibility_changed_cb(th);
264 if (__is_err(ret) == true) {
265 g_print("tethering_wifi_unset_ssid_visibility_changed_cb is failed\n");
268 ret = tethering_wifi_unset_passphrase_changed_cb(th);
269 if (__is_err(ret) == true) {
270 g_print("tethering_wifi_unset_passphrase_changed_cb is failed\n");
276 /* Tethering callbacks */
277 static void __enabled_cb(tethering_error_e error, tethering_type_e type, bool is_requested, void *data)
279 if (__is_err(error)) {
284 g_print("## %s is not enabled. error code[0x%X]\n",
285 __convert_tethering_type_to_str(type),
291 g_print("## %s is enabled successfully\n",
292 __convert_tethering_type_to_str(type));
294 g_print("## %s is enabled by other app\n",
295 __convert_tethering_type_to_str(type));
300 static void __disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
302 if (__is_err(error)) {
303 if (code != TETHERING_DISABLED_BY_REQUEST) {
307 g_print("## %s is not disabled. error code[0x%X]\n",
308 __convert_tethering_type_to_str(type), error);
312 g_print("## %s is %s\n",
313 __convert_tethering_type_to_str(type),
314 __convert_disabled_code_to_str(code));
319 static void __connection_state_changed_cb(tethering_client_h client, bool open, void *data)
321 tethering_client_h clone = NULL;
322 tethering_type_e type;
323 char *ip_address = NULL;
324 char *mac_address = NULL;
325 char *hostname = NULL;
327 tethering_client_clone(&clone, client);
329 g_print("tetheirng_client_clone is failed\n");
333 tethering_client_get_tethering_type(clone, &type);
334 tethering_client_get_ip_address(clone,
335 TETHERING_ADDRESS_FAMILY_IPV4, &ip_address);
336 tethering_client_get_mac_address(clone, &mac_address);
337 tethering_client_get_name(clone, &hostname);
340 g_print("## New station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
341 __convert_tethering_type_to_str(type),
342 ip_address, mac_address, hostname);
344 g_print("## Disconnected station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
345 __convert_tethering_type_to_str(type),
346 ip_address, mac_address, hostname);
356 tethering_client_destroy(clone);
361 static void __data_usage_cb(tethering_error_e result, unsigned long long received_data,
362 unsigned long long sent_data, void *user_data)
364 g_print("__data_usage_cb\n");
366 if (result != TETHERING_ERROR_NONE) {
367 g_print("tethering_get_data_usage is failed. error[0x%X]\n", result);
371 g_print("## Received data : %llu bytes\n", received_data);
372 g_print("## Sent data : %llu bytes\n", sent_data);
377 static void __settings_reloaded_cb(tethering_error_e result, void *user_data)
379 g_print("__settings_reloaded_cb\n");
381 if (result != TETHERING_ERROR_NONE) {
382 g_print("tethering_wifi_reload_settings is failed. error[0x%X]\n", result);
386 g_print("## Wi-Fi tethering setting is reloaded\n");
391 static bool __clients_foreach_cb(tethering_client_h client, void *data)
393 tethering_client_h clone = NULL;
394 tethering_type_e type;
395 char *ip_address = NULL;
396 char *mac_address = NULL;
397 char *hostname = NULL;
399 /* Clone internal information */
400 if (tethering_client_clone(&clone, client) != TETHERING_ERROR_NONE) {
401 g_print("tethering_client_clone is failed\n");
405 /* Get information */
406 if (tethering_client_get_tethering_type(clone, &type) != TETHERING_ERROR_NONE) {
407 g_print("tethering_client_get_type is failed\n");
410 if (tethering_client_get_ip_address(clone, TETHERING_ADDRESS_FAMILY_IPV4, &ip_address) != TETHERING_ERROR_NONE) {
411 g_print("tethering_client_get_ip_address is failed\n");
414 if (tethering_client_get_mac_address(clone, &mac_address) != TETHERING_ERROR_NONE) {
415 g_print("tethering_client_get_mac_address is failed\n");
418 if (tethering_client_get_name(clone, &hostname) != TETHERING_ERROR_NONE) {
419 g_print("tethering_client_get_hostname is failed\n");
421 /* End of getting information */
423 g_print("\n< Client Info. >\n");
424 g_print("\tType %s\n", __convert_tethering_type_to_str(type));
425 g_print("\tIP Address %s\n", ip_address);
426 g_print("\tMAC Address : %s\n", mac_address);
427 g_print("\tHostname : %s\n", hostname);
429 /* Destroy cloned objects */
437 tethering_client_destroy(clone);
439 /* Continue iteration */
443 static void __security_type_changed_cb(tethering_wifi_security_type_e changed_type, void *user_data)
445 g_print("Wi-Fi Tethering Security type is changed to [%s]\n",
446 changed_type == TETHERING_WIFI_SECURITY_TYPE_NONE ?
447 "open" : "wpa2-psk");
451 static void __ssid_visibility_changed_cb(bool changed_visible, void *user_data)
453 g_print("SSID visibility for Wi-Fi tethering changed to [%s]\n",
454 changed_visible ? "visible" : "invisible");
458 static void __passphrase_changed_cb(void *user_data)
460 g_print("Wi-Fi Tethering passphrase is changed\n");
463 /* End of tethering callbacks */
465 static void __print_interface_info(tethering_h th, tethering_type_e type)
467 char *interface = NULL;
468 char *mac_address = NULL;
469 char *ip_address = NULL;
470 char *gateway_address = NULL;
471 char *subnet_mask = NULL;
473 if (tethering_is_enabled(th, type) == FALSE) {
474 g_print("%s is not enabled\n",
475 __convert_tethering_type_to_str(type));
479 tethering_get_network_interface_name(th, type, &interface);
480 tethering_get_mac_address(th, type, &mac_address);
481 tethering_get_ip_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
483 tethering_get_gateway_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
485 tethering_get_subnet_mask(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
488 g_print("interface name : %s\n", interface);
489 g_print("mac address : %s\n", mac_address);
490 g_print("ip address : %s\n", ip_address);
491 g_print("gateway address: %s\n", gateway_address);
492 g_print("subnet mask : %s\n", subnet_mask);
501 free(gateway_address);
508 static void __print_wifi_tethering_setting(tethering_h th)
511 char *passphrase = NULL;
512 bool visibility = false;
513 tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
515 int error = TETHERING_ERROR_NONE;
517 error = tethering_wifi_get_ssid(th, &ssid);
518 if (error != TETHERING_ERROR_NONE)
521 g_print("\n\t** WiFi tethering SSID : %s\n", ssid);
523 error = tethering_wifi_get_passphrase(th, &passphrase);
524 if (error != TETHERING_ERROR_NONE)
527 g_print("\t** WiFi tethering passphrase : %s\n", passphrase);
529 error = tethering_wifi_get_ssid_visibility(th, &visibility);
530 if (error != TETHERING_ERROR_NONE)
533 g_print("\t** WiFi tethering ssid visibility : %s\n",
534 visibility ? "visible" : "invisible");
536 error = tethering_wifi_get_security_type(th, &security_type);
537 if (error != TETHERING_ERROR_NONE)
540 g_print("\t** WiFi tethering security_type : %s\n",
542 TETHERING_WIFI_SECURITY_TYPE_NONE ?
543 "open" : "wpa2-psk");
553 static void __print_wifi_ap_setting(tethering_h th)
556 char *passphrase = NULL;
557 bool visibility = false;
558 tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
560 int error = TETHERING_ERROR_NONE;
562 error = tethering_wifi_ap_get_ssid(th, &ssid);
563 if (error != TETHERING_ERROR_NONE)
566 g_print("\n\t** WiFi AP SSID : %s\n", ssid);
568 error = tethering_wifi_ap_get_passphrase(th, &passphrase);
569 if (error != TETHERING_ERROR_NONE)
572 g_print("\t** WiFi AP passphrase : %s\n", passphrase);
574 error = tethering_wifi_ap_get_ssid_visibility(th, &visibility);
575 if (error != TETHERING_ERROR_NONE)
578 g_print("\t** WiFi AP ssid visibility : %s\n",
579 visibility ? "visible" : "invisible");
581 error = tethering_wifi_ap_get_security_type(th, &security_type);
582 if (error != TETHERING_ERROR_NONE)
585 g_print("\t** WiFi AP security_type : %s\n",
587 TETHERING_WIFI_SECURITY_TYPE_NONE ?
588 "open" : "wpa2-psk");
598 bool __get_tethering_type(tethering_type_e *type)
603 printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:WiFi AP, 5:ALL)\n");
604 ret = scanf("%9d", &sel);
606 printf("scanf is failed!!\n");
612 *type = TETHERING_TYPE_WIFI;
615 *type = TETHERING_TYPE_BT;
618 *type = TETHERING_TYPE_USB;
621 *type = TETHERING_TYPE_RESERVED;
624 *type = TETHERING_TYPE_ALL;
627 printf("Invalid input!!\n");
634 static int test_tethering_create(void)
636 int ret = tethering_create(&th);
637 __tethering_cbs cbs = {
638 __enabled_cb, __disabled_cb,
639 __connection_state_changed_cb, __security_type_changed_cb,
640 __ssid_visibility_changed_cb, __passphrase_changed_cb};
642 if (__is_err(ret) == false) __register_cbs(th, &cbs, NULL);
644 printf("Tethering create is failed\n");
647 printf("Tethering create and register callback success\n");
652 static int test_tethering_destroy(void)
654 int ret = TETHERING_ERROR_NONE;
656 __deregister_cbs(th);
658 ret = tethering_destroy(th);
659 if (__is_err(ret) == true)
661 printf("Tethering destroy is failed\n");
668 static int test_tethering_enable(void)
670 int ret = TETHERING_ERROR_NONE;
671 tethering_type_e type;
673 if (!__get_tethering_type(&type))
676 ret = tethering_enable(th, type);
677 if (__is_err(ret) == true) {
678 printf("Fail to enable tethering\n");
684 static int test_tethering_disable(void)
686 int ret = TETHERING_ERROR_NONE;
687 tethering_type_e type;
689 if (!__get_tethering_type(&type))
692 ret = tethering_disable(th, type);
693 if (__is_err(ret) == true) {
694 printf("Fail to disable tethering\n");
700 static int test_tethering_get_client_info(void)
703 tethering_type_e type;
705 if (!__get_tethering_type(&type))
708 ret = tethering_foreach_connected_clients(th, type,
709 __clients_foreach_cb, NULL);
710 if (__is_err(ret) == true) {
711 printf("Fail to disable tethering\n");
718 static int test_tethering_get_interface_info(void)
720 tethering_type_e type;
722 if (!__get_tethering_type(&type))
725 __print_interface_info(th, type);
730 static int test_tethering_get_data_usage(void)
732 int ret = tethering_get_data_usage(th, __data_usage_cb, NULL);
734 if (__is_err(ret) == true) {
735 printf("Fail to get data usage!!\n");
742 static int test_tethering_wifi_get_setting(void)
744 __print_wifi_tethering_setting(th);
748 static int test_tethering_wifi_ap_get_setting(void)
750 __print_wifi_ap_setting(th);
754 static int test_tethering_wifi_set_ssid(void)
759 printf("Input SSID for Wi-Fi tethering: ");
760 ret = scanf("%99s", ssid);
762 printf("scanf is failed!!\n");
766 ret = tethering_wifi_set_ssid(th, ssid);
767 if (__is_err(ret) == true) {
768 printf("Fail to set wifi ssid!!\n");
775 static int test_tethering_wifi_set_security_type(void)
780 printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK)");
781 ret = scanf("%9d", &security_type);
783 printf("scanf is failed!!\n");
787 ret = tethering_wifi_set_security_type(th, security_type);
788 if (__is_err(ret) == true) {
789 printf("Fail to set security type!!\n");
796 int test_tethering_wifi_set_visibility(void)
801 printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
802 ret = scanf("%9d", &visibility);
804 printf("scanf is failed!!\n");
808 ret = tethering_wifi_set_ssid_visibility(th, visibility);
809 if (__is_err(ret) == true) {
810 printf("Fail to set visibility!!\n");
817 static int test_tethering_wifi_set_passphrase(void)
820 char passphrase[100];
822 printf("Input passphrase for Wi-Fi tethering: ");
823 ret = scanf("%99s", passphrase);
825 printf("scanf is failed!!\n");
829 ret = tethering_wifi_set_passphrase(th, passphrase);
830 if (__is_err(ret) == true) {
831 printf("Fail to set passphrase!!\n");
838 static int test_tethering_wifi_ap_set_ssid(void)
843 printf("Input SSID for Wi-Fi AP tethering: ");
844 ret = scanf("%99s", ssid);
846 printf("scanf is failed!!\n");
850 ret = tethering_wifi_ap_set_ssid(th, ssid);
851 if (__is_err(ret) == true) {
852 printf("Fail to set wifi ap ssid!!\n");
858 static int test_tethering_wifi_ap_set_security_type(void)
863 printf("Input security type for Wi-Fi AP tethering (0:NONE, 1:WPA2_PSK)");
864 ret = scanf("%9d", &security_type);
866 printf("scanf is failed!!\n");
870 ret = tethering_wifi_ap_set_security_type(th, security_type);
871 if (__is_err(ret) == true) {
872 printf("Fail to set security type!!\n");
878 static int test_tethering_wifi_ap_set_visibility(void)
883 printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
884 ret = scanf("%9d", &visibility);
886 printf("scanf is failed!!\n");
890 ret = tethering_wifi_ap_set_ssid_visibility(th, visibility);
891 if (__is_err(ret) == true) {
892 printf("Fail to set visibility!!\n");
898 static int test_tethering_wifi_ap_set_passphrase(void)
901 char passphrase[100];
903 printf("Input passphrase for Wi-Fi tethering: ");
904 ret = scanf("%99s", passphrase);
906 printf("scanf is failed!!\n");
910 ret = tethering_wifi_ap_set_passphrase(th, passphrase);
911 if (__is_err(ret) == true) {
912 printf("Fail to set passphrase!!\n");
918 static int test_tethering_wifi_reload_settings(void)
920 int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL);
922 if (__is_err(ret) == true) {
923 printf("Fail to reload wifi tethering!!\n");
929 static int test_tethering_wifi_ap_reload_settings(void)
931 int ret = tethering_wifi_ap_reload_settings(th, __settings_reloaded_cb, NULL);
933 if (__is_err(ret) == true) {
934 printf("Fail to reload wifi tethering!!\n");
940 int main(int argc, char **argv)
944 #if !GLIB_CHECK_VERSION(2,36,0)
947 mainloop = g_main_loop_new (NULL, false);
949 GIOChannel *channel = g_io_channel_unix_new(0);
950 g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread, NULL);
951 printf("Test Thread created...\n");
952 g_main_loop_run (mainloop);
957 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
962 printf("Event received from stdin\n");
966 if (rv <= 0 || a[0] == '0') {
971 if (a[0] == '\n' || a[0] == '\r') {
972 printf("\n\n Network Connection API Test App\n\n");
973 printf("Options..\n");
974 printf("1 - Tethering create and set callbacks\n");
975 printf("2 - Tethering destroy\n");
976 printf("3 - Enable Tethering\n");
977 printf("4 - Disable Tethering\n");
978 printf("5 - Get client information\n");
979 printf("6 - Get interface information\n");
980 printf("7 - Get data usage\n");
981 printf("8 - Get Wi-Fi tethering setting\n");
982 printf("9 - Get Wi-Fi AP setting\n");
983 printf("a - Set Wi-Fi tethering SSID\n");
984 printf("b - Set Wi-Fi tethering security type\n");
985 printf("c - Set Wi-Fi tethering visibility\n");
986 printf("d - Set Wi-Fi tethering passphrase\n");
987 printf("e - Set Wi-Fi AP SSID\n");
988 printf("f - Set Wi-Fi AP security type\n");
989 printf("g - Set Wi-Fi AP visibility\n");
990 printf("h - Set Wi-Fi AP passphrase\n");
991 printf("i - Reload Wi-Fi tethering\n");
992 printf("j - Reload Wi-Fi AP\n");
993 printf("0 - Exit \n");
994 printf("ENTER - Show options menu.......\n");
999 rv = test_tethering_create();
1002 rv = test_tethering_destroy();
1005 rv = test_tethering_enable();
1008 rv = test_tethering_disable();
1011 rv = test_tethering_get_client_info();
1014 rv = test_tethering_get_interface_info();
1017 rv = test_tethering_get_data_usage();
1020 rv = test_tethering_wifi_get_setting();
1023 rv = test_tethering_wifi_ap_get_setting();
1026 rv = test_tethering_wifi_set_ssid();
1029 rv = test_tethering_wifi_set_security_type();
1032 rv = test_tethering_wifi_set_visibility();
1035 rv = test_tethering_wifi_set_passphrase();
1038 rv = test_tethering_wifi_ap_set_ssid();
1041 rv = test_tethering_wifi_ap_set_security_type();
1044 rv = test_tethering_wifi_ap_set_visibility();
1047 rv = test_tethering_wifi_ap_set_passphrase();
1050 rv = test_tethering_wifi_reload_settings();
1053 rv = test_tethering_wifi_ap_reload_settings();
1059 printf("Operation succeeded!\n");
1061 printf("Operation failed!\n");