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));
103 g_strlcpy(str_buf, "Unknown", sizeof(str_buf));
110 static const char *__convert_disabled_code_to_str(const tethering_disabled_cause_e code)
112 static char str_buf[DISABLE_REASON_TEXT_LEN] = {0, };
115 case TETHERING_DISABLED_BY_USB_DISCONNECTION:
116 strncpy(str_buf, "disabled due to usb disconnection", sizeof(str_buf));
119 case TETHERING_DISABLED_BY_FLIGHT_MODE:
120 strncpy(str_buf, "disabled due to flight mode on", sizeof(str_buf));
123 case TETHERING_DISABLED_BY_LOW_BATTERY:
124 strncpy(str_buf, "disabled due to low battery", sizeof(str_buf));
127 case TETHERING_DISABLED_BY_NETWORK_CLOSE:
128 strncpy(str_buf, "disabled due to pdp network close", sizeof(str_buf));
131 case TETHERING_DISABLED_BY_TIMEOUT:
132 strncpy(str_buf, "disabled due to timeout", sizeof(str_buf));
135 case TETHERING_DISABLED_BY_OTHERS:
136 strncpy(str_buf, "disabled by other apps", sizeof(str_buf));
139 case TETHERING_DISABLED_BY_REQUEST:
140 strncpy(str_buf, "disabled by my request", sizeof(str_buf));
143 case TETHERING_DISABLED_BY_WIFI_ON:
144 strncpy(str_buf, "disabled by Wi-Fi station on", sizeof(str_buf));
147 case TETHERING_DISABLED_BY_BT_OFF:
148 strncpy(str_buf, "disabled by bluetooth off", sizeof(str_buf));
152 strncpy(str_buf, "disabled by unknown reason", sizeof(str_buf));
159 static void __register_cbs(tethering_h th, __tethering_cbs *cbs, void *user_data)
161 tethering_error_e ret = TETHERING_ERROR_NONE;
163 ret = tethering_set_enabled_cb(th, TETHERING_TYPE_ALL,
164 cbs->enabled_cb, user_data);
165 if (__is_err(ret) == true)
166 g_print("tethering_set_enabled_cb is failed\n");
168 ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL,
169 cbs->disabled_cb, user_data);
170 if (__is_err(ret) == true)
171 g_print("tethering_set_disabled_cb is failed\n");
173 ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL,
174 cbs->changed_cb, user_data);
175 if (__is_err(ret) == true)
176 g_print("tethering_set_connection_state_changed_cb is failed\n");
178 ret = tethering_wifi_set_security_type_changed_cb(th,
179 cbs->security_type_changed_cb, user_data);
180 if (__is_err(ret) == true)
181 g_print("tethering_wifi_set_security_type_changed_cb is failed\n");
183 ret = tethering_wifi_set_ssid_visibility_changed_cb(th,
184 cbs->ssid_visibility_changed_cb, user_data);
185 if (__is_err(ret) == true)
186 g_print("tethering_wifi_set_ssid_visibility_changed_cb is failed\n");
188 ret = tethering_wifi_set_passphrase_changed_cb(th,
189 cbs->passphrase_changed_cb, user_data);
190 if (__is_err(ret) == true)
191 g_print("tethering_wifi_set_passphrase_changed_cb is failed\n");
196 static void __deregister_cbs(tethering_h th)
198 tethering_error_e ret = TETHERING_ERROR_NONE;
200 ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_ALL);
201 if (__is_err(ret) == true)
202 g_print("tethering_unset_enabled_cb is failed\n");
204 ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL);
205 if (__is_err(ret) == true)
206 g_print("tethering_unset_disabled_cb is failed\n");
208 ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL);
209 if (__is_err(ret) == true)
210 g_print("tethering_unset_connection_state_changed_cb is failed\n");
212 ret = tethering_wifi_unset_security_type_changed_cb(th);
213 if (__is_err(ret) == true)
214 g_print("tethering_wifi_unset_security_type_changed_cb is failed\n");
216 ret = tethering_wifi_unset_ssid_visibility_changed_cb(th);
217 if (__is_err(ret) == true)
218 g_print("tethering_wifi_unset_ssid_visibility_changed_cb is failed\n");
220 ret = tethering_wifi_unset_passphrase_changed_cb(th);
221 if (__is_err(ret) == true)
222 g_print("tethering_wifi_unset_passphrase_changed_cb is failed\n");
227 /* Tethering callbacks */
228 static void __enabled_cb(tethering_error_e error, tethering_type_e type, bool is_requested, void *data)
230 if (__is_err(error)) {
234 g_print("## %s is not enabled. error code[0x%X]\n",
235 __convert_tethering_type_to_str(type),
241 g_print("## %s is enabled successfully\n",
242 __convert_tethering_type_to_str(type));
244 g_print("## %s is enabled by other app\n",
245 __convert_tethering_type_to_str(type));
250 static void __disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
252 if (__is_err(error)) {
253 if (code != TETHERING_DISABLED_BY_REQUEST)
256 g_print("## %s is not disabled. error code[0x%X]\n",
257 __convert_tethering_type_to_str(type), error);
261 g_print("## %s is %s\n",
262 __convert_tethering_type_to_str(type),
263 __convert_disabled_code_to_str(code));
268 static void __connection_state_changed_cb(tethering_client_h client, bool open, void *data)
270 tethering_client_h clone = NULL;
271 tethering_type_e type;
272 char *ip_address = NULL;
273 char *mac_address = NULL;
274 char *hostname = NULL;
276 tethering_client_clone(&clone, client);
278 g_print("tetheirng_client_clone is failed\n");
282 tethering_client_get_tethering_type(clone, &type);
283 tethering_client_get_ip_address(clone,
284 TETHERING_ADDRESS_FAMILY_IPV4, &ip_address);
285 tethering_client_get_mac_address(clone, &mac_address);
286 tethering_client_get_name(clone, &hostname);
289 g_print("## New station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
290 __convert_tethering_type_to_str(type),
291 ip_address, mac_address, hostname);
293 g_print("## Disconnected station Type [%s], IP [%s], MAC [%s], hostname [%s]\n",
294 __convert_tethering_type_to_str(type),
295 ip_address, mac_address, hostname);
305 tethering_client_destroy(clone);
310 static void __data_usage_cb(tethering_error_e result, unsigned long long received_data,
311 unsigned long long sent_data, void *user_data)
313 g_print("__data_usage_cb\n");
315 if (result != TETHERING_ERROR_NONE) {
316 g_print("tethering_get_data_usage is failed. error[0x%X]\n", result);
320 g_print("## Received data : %llu bytes\n", received_data);
321 g_print("## Sent data : %llu bytes\n", sent_data);
326 static void __settings_reloaded_cb(tethering_error_e result, void *user_data)
328 g_print("__settings_reloaded_cb\n");
330 if (result != TETHERING_ERROR_NONE) {
331 g_print("tethering_wifi_reload_settings is failed. error[0x%X]\n", result);
335 g_print("## Wi-Fi tethering setting is reloaded\n");
340 static bool __clients_foreach_cb(tethering_client_h client, void *data)
342 tethering_client_h clone = NULL;
343 tethering_type_e type;
344 char *ip_address = NULL;
345 char *mac_address = NULL;
346 char *hostname = NULL;
348 /* Clone internal information */
349 if (tethering_client_clone(&clone, client) != TETHERING_ERROR_NONE) {
350 g_print("tethering_client_clone is failed\n");
354 /* Get information */
355 if (tethering_client_get_tethering_type(clone, &type) != TETHERING_ERROR_NONE)
356 g_print("tethering_client_get_type is failed\n");
358 if (tethering_client_get_ip_address(clone, TETHERING_ADDRESS_FAMILY_IPV4, &ip_address) != TETHERING_ERROR_NONE)
359 g_print("tethering_client_get_ip_address is failed\n");
361 if (tethering_client_get_mac_address(clone, &mac_address) != TETHERING_ERROR_NONE)
362 g_print("tethering_client_get_mac_address is failed\n");
364 if (tethering_client_get_name(clone, &hostname) != TETHERING_ERROR_NONE)
365 g_print("tethering_client_get_hostname is failed\n");
367 /* End of getting information */
369 g_print("\n< Client Info. >\n");
370 g_print("\tType %s\n", __convert_tethering_type_to_str(type));
371 g_print("\tIP Address %s\n", ip_address);
372 g_print("\tMAC Address : %s\n", mac_address);
373 g_print("\tHostname : %s\n", hostname);
375 /* Destroy cloned objects */
383 tethering_client_destroy(clone);
385 /* Continue iteration */
389 static void __security_type_changed_cb(tethering_wifi_security_type_e changed_type, void *user_data)
391 g_print("Wi-Fi Tethering Security type is changed to [%s]\n",
392 changed_type == TETHERING_WIFI_SECURITY_TYPE_NONE ?
393 "open" : "wpa2-psk");
397 static void __ssid_visibility_changed_cb(bool changed_visible, void *user_data)
399 g_print("SSID visibility for Wi-Fi tethering changed to [%s]\n",
400 changed_visible ? "visible" : "invisible");
404 static void __passphrase_changed_cb(void *user_data)
406 g_print("Wi-Fi Tethering passphrase is changed\n");
409 /* End of tethering callbacks */
411 static void __print_interface_info(tethering_h th, tethering_type_e type)
413 char *interface = NULL;
414 char *mac_address = NULL;
415 char *ip_address = NULL;
416 char *gateway_address = NULL;
417 char *subnet_mask = NULL;
419 if (tethering_is_enabled(th, type) == FALSE) {
420 g_print("%s is not enabled\n",
421 __convert_tethering_type_to_str(type));
425 tethering_get_network_interface_name(th, type, &interface);
426 tethering_get_mac_address(th, type, &mac_address);
427 tethering_get_ip_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
429 tethering_get_gateway_address(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
431 tethering_get_subnet_mask(th, type, TETHERING_ADDRESS_FAMILY_IPV4,
434 g_print("interface name : %s\n", interface);
435 g_print("mac address : %s\n", mac_address);
436 g_print("ip address : %s\n", ip_address);
437 g_print("gateway address: %s\n", gateway_address);
438 g_print("subnet mask : %s\n", subnet_mask);
447 free(gateway_address);
454 static void __print_wifi_tethering_setting(tethering_h th)
457 char *passphrase = NULL;
458 bool visibility = false;
461 tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
462 tethering_wifi_mode_type_e hw_mode = TETHERING_WIFI_MODE_TYPE_G;
464 int error = TETHERING_ERROR_NONE;
466 error = tethering_wifi_get_ssid(th, &ssid);
467 if (error != TETHERING_ERROR_NONE)
470 g_print("\n\t** WiFi tethering SSID : %s\n", ssid);
472 error = tethering_wifi_get_passphrase(th, &passphrase);
473 if (error != TETHERING_ERROR_NONE)
476 g_print("\t** WiFi tethering passphrase : %s\n", passphrase);
478 error = tethering_wifi_get_ssid_visibility(th, &visibility);
479 if (error != TETHERING_ERROR_NONE)
482 g_print("\t** WiFi tethering ssid visibility : %s\n",
483 visibility ? "visible" : "invisible");
485 error = tethering_wifi_get_security_type(th, &security_type);
486 if (error != TETHERING_ERROR_NONE)
489 g_print("\t** WiFi tethering security_type : %s\n",
491 TETHERING_WIFI_SECURITY_TYPE_NONE ?
492 "open" : "wpa2-psk");
494 error = tethering_wifi_get_mac_filter(th, &mac_filter);
495 if (error != TETHERING_ERROR_NONE)
498 g_print("\t** WiFi tethering mac filter : %s\n",
499 mac_filter ? "enable" : "disable");
501 error = tethering_wifi_get_mode(th, &hw_mode);
502 if (error != TETHERING_ERROR_NONE)
505 g_print("\t** WiFi tethering mode : %d\n", hw_mode);
507 error = tethering_wifi_get_channel(th, &channel);
508 if (error != TETHERING_ERROR_NONE)
511 g_print("\t** WiFi tethering channel : %d\n", channel);
521 void __display_list(GSList *list)
523 GSList *iterator = NULL;
525 for (iterator = list; iterator; iterator = iterator->next)
526 printf("%s\n", (char*)iterator->data);
529 bool __get_tethering_type(tethering_type_e *type)
534 printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:ALL)\n");
535 ret = scanf("%9d", &sel);
537 printf("scanf is failed!!\n");
543 *type = TETHERING_TYPE_WIFI;
546 *type = TETHERING_TYPE_BT;
549 *type = TETHERING_TYPE_USB;
552 *type = TETHERING_TYPE_ALL;
555 printf("Invalid input!!\n");
562 static int test_tethering_create(void)
564 int ret = tethering_create(&th);
565 __tethering_cbs cbs = {
566 __enabled_cb, __disabled_cb,
567 __connection_state_changed_cb, __security_type_changed_cb,
568 __ssid_visibility_changed_cb, __passphrase_changed_cb};
570 if (__is_err(ret) == false) __register_cbs(th, &cbs, NULL);
572 printf("Tethering create is failed\n");
575 printf("Tethering create and register callback success\n");
580 static int test_tethering_destroy(void)
582 int ret = TETHERING_ERROR_NONE;
584 __deregister_cbs(th);
586 ret = tethering_destroy(th);
587 if (__is_err(ret) == true) {
588 printf("Tethering destroy is failed\n");
595 static int test_tethering_enable(void)
597 int ret = TETHERING_ERROR_NONE;
598 tethering_type_e type;
600 if (!__get_tethering_type(&type))
603 ret = tethering_enable(th, type);
604 if (__is_err(ret) == true) {
605 printf("Fail to enable tethering\n");
611 static int test_tethering_disable(void)
613 int ret = TETHERING_ERROR_NONE;
614 tethering_type_e type;
616 if (!__get_tethering_type(&type))
619 ret = tethering_disable(th, type);
620 if (__is_err(ret) == true) {
621 printf("Fail to disable tethering\n");
627 static int test_tethering_get_client_info(void)
630 tethering_type_e type;
632 if (!__get_tethering_type(&type))
635 ret = tethering_foreach_connected_clients(th, type,
636 __clients_foreach_cb, NULL);
637 if (__is_err(ret) == true) {
638 printf("Fail to disable tethering\n");
645 static int test_tethering_get_interface_info(void)
647 tethering_type_e type;
649 if (!__get_tethering_type(&type))
652 __print_interface_info(th, type);
657 static int test_tethering_get_data_usage(void)
659 int ret = tethering_get_data_usage(th, __data_usage_cb, NULL);
661 if (__is_err(ret) == true) {
662 printf("Fail to get data usage!!\n");
669 static int test_tethering_wifi_get_setting(void)
671 __print_wifi_tethering_setting(th);
675 static int test_tethering_wifi_set_ssid(void)
680 printf("Input SSID for Wi-Fi tethering: ");
681 ret = scanf("%99s", ssid);
683 printf("scanf is failed!!\n");
687 ret = tethering_wifi_set_ssid(th, ssid);
688 if (__is_err(ret) == true) {
689 printf("Fail to set wifi ssid!!\n");
696 static int test_tethering_wifi_set_security_type(void)
701 printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK)");
702 ret = scanf("%9d", &security_type);
704 printf("scanf is failed!!\n");
708 ret = tethering_wifi_set_security_type(th, security_type);
709 if (__is_err(ret) == true) {
710 printf("Fail to set security type!!\n");
717 int test_tethering_wifi_set_visibility(void)
722 printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
723 ret = scanf("%9d", &visibility);
725 printf("scanf is failed!!\n");
729 ret = tethering_wifi_set_ssid_visibility(th, visibility);
730 if (__is_err(ret) == true) {
731 printf("Fail to set visibility!!\n");
738 static int test_tethering_wifi_set_passphrase(void)
741 char passphrase[100];
743 printf("Input passphrase for Wi-Fi tethering: ");
744 ret = scanf("%99s", passphrase);
746 printf("scanf is failed!!\n");
750 ret = tethering_wifi_set_passphrase(th, passphrase);
751 if (__is_err(ret) == true) {
752 printf("Fail to set passphrase!!\n");
759 static int test_tethering_wifi_set_channel(void)
764 printf("Input channel for Wi-Fi tethering: ");
765 ret = scanf("%d", &channel);
767 ret = tethering_wifi_set_channel(th, channel);
768 if (__is_err(ret) == true) {
769 printf("Fail to set channel!!\n");
776 static int test_tethering_wifi_set_mode(void)
781 printf("Input hw_mode for Wi-Fi tethering(0-b, 1-g, 2-a, 3-ad): ");
782 ret = scanf("%d", &type);
784 ret = tethering_wifi_set_mode(th, type);
785 if (__is_err(ret) == true) {
786 printf("Fail to set mode!!\n");
793 static int test_tethering_wifi_enable_dhcp(void)
798 printf("Input (0-Disable, 1-Enable): ");
799 ret = scanf("%d", &enable);
801 ret = tethering_wifi_enable_dhcp(th, enable);
802 if (__is_err(ret) == true) {
803 printf("Fail to enable dhcp server!!\n");
810 static int test_tethering_wifi_set_dhcp_range(void)
813 char rangestart[16], rangestop[16];
815 printf("Input range (ex: 192.168.0.50 192.168.0.150): ");
817 ret = scanf("%15s %15s", rangestart, rangestop);
819 ret = tethering_wifi_set_dhcp_range(th, rangestart, rangestop);
820 if (__is_err(ret) == true) {
821 printf("Fail to set dhcp range and enable dhcp server!!\n");
828 static int test_tethering_wifi_is_dhcp_enabled(void)
833 ret = tethering_wifi_is_dhcp_enabled(th, &enabled);
835 if (__is_err(ret) == true) {
836 printf("Fail to get dhcp server status!!\n");
839 printf("DHCP server is %s\n", enabled ? "enabled" : "disabled");
845 static int test_tethering_wifi_set_mac_filtering(void)
850 printf("Input mac filtering option (0: disable, 1: enable): ");
851 ret = scanf("%d", &enable);
853 ret = tethering_wifi_set_mac_filter(th, enable);
854 if (__is_err(ret) == true) {
855 printf("Fail to set mac filtering!!\n");
862 static int test_tethering_manage_mac_list(void)
868 printf("Select MAC list to modify (0: allowed mac list, 1: blocked mac list): ");
869 ret = scanf("%d", &list);
871 printf("Select option (0: Add, 1: Remove): ");
872 ret = scanf("%d", &option);
874 printf("Input MAC Address to add/remove allowed/blocked mac list: ");
875 ret = scanf("%99s", mac);
877 printf("scanf is failed!!\n");
881 if (!list && !option) {
882 /* Add to allowed mac list*/
883 ret = tethering_wifi_add_allowed_mac_list(th, mac);
884 } else if (!list && option) {
885 /* Remove from allowed mac list */
886 ret = tethering_wifi_remove_allowed_mac_list(th, mac);
887 } else if (list && !option) {
888 /* Add to blocked mac list */
889 ret = tethering_wifi_add_blocked_mac_list(th, mac);
890 } else if (list && option) {
891 /* Remove from blocked mac list */
892 ret = tethering_wifi_remove_blocked_mac_list(th, mac);
894 printf("Input failed!!\n");
904 static int test_tethering_get_mac_list(void)
908 void *mac_list = NULL;
910 printf("Select MAC list to get (0: allowed mac list, 1: blocked mac list): ");
911 ret = scanf("%d", &list);
915 ret = tethering_wifi_get_allowed_mac_list(th, &mac_list);
918 ret = tethering_wifi_get_blocked_mac_list(th, &mac_list);
921 printf("Input failed!!\n");
928 __display_list(mac_list);
933 static int test_tethering_wifi_reload_settings(void)
935 int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL);
937 if (__is_err(ret) == true) {
938 printf("Fail to reload wifi tethering!!\n");
944 static int test_tethering_wifi_get_txpower(void)
946 int ret = TETHERING_ERROR_NONE;
948 unsigned int txpower = 0;
949 ret = tethering_wifi_get_txpower(th, &txpower);
950 if (__is_err(ret) == true) {
951 printf("Fail to get txpower!!\n");
954 g_print("tethering_hostapd_get_txpower received [%d]\n",txpower);
957 static int test_tethering_wifi_set_txpower(void)
960 unsigned int txpower = 0;
962 printf("Input tx power for Wi-Fi tethering: ");
963 ret = scanf("%d", &txpower);
965 ret = tethering_wifi_set_txpower(th, txpower);
966 if (__is_err(ret) == true) {
967 printf("Fail to set txpower!!\n");
974 int main(int argc, char **argv)
978 #if !GLIB_CHECK_VERSION(2, 36, 0)
981 mainloop = g_main_loop_new(NULL, false);
983 GIOChannel *channel = g_io_channel_unix_new(0);
984 g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread, NULL);
985 printf("Test Thread created...\n");
986 g_main_loop_run(mainloop);
991 gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
996 printf("Event received from stdin\n");
1000 if (rv <= 0 || a[0] == '0')
1003 if (a[0] == '\n' || a[0] == '\r') {
1004 printf("\n\n Network Connection API Test App\n\n");
1005 printf("Options..\n");
1006 printf("1 - Tethering create and set callbacks\n");
1007 printf("2 - Tethering destroy\n");
1008 printf("3 - Enable Tethering\n");
1009 printf("4 - Disable Tethering\n");
1010 printf("5 - Get client information\n");
1011 printf("6 - Get interface information\n");
1012 printf("7 - Get data usage\n");
1013 printf("8 - Get Wi-Fi tethering setting\n");
1014 printf("a - Set Wi-Fi tethering SSID\n");
1015 printf("b - Set Wi-Fi tethering security type\n");
1016 printf("c - Set Wi-Fi tethering visibility\n");
1017 printf("d - Set Wi-Fi tethering passphrase\n");
1018 printf("e - Set Wi-Fi tethering mac filtering\n");
1019 printf("f - Add/Remove MAC adress to/from allowed/blocked list\n");
1020 printf("g - Get allowed/blocked list\n");
1021 printf("k - Reload Wi-Fi tethering\n");
1022 printf("m - Set Wi-Fi channel\n");
1023 printf("n - Set Wi-Fi hw_mode\n");
1024 printf("o - Enable dhcp server\n");
1025 printf("p - Enable dhcp server with range\n");
1026 printf("q - Is dhcp server enabled?\n");
1027 printf("r - Get Wi-Fi txpower\n");
1028 printf("s - Set Wi-Fi txpower\n");
1029 printf("0 - Exit \n");
1030 printf("ENTER - Show options menu.......\n");
1035 rv = test_tethering_create();
1038 rv = test_tethering_destroy();
1041 rv = test_tethering_enable();
1044 rv = test_tethering_disable();
1047 rv = test_tethering_get_client_info();
1050 rv = test_tethering_get_interface_info();
1053 rv = test_tethering_get_data_usage();
1056 rv = test_tethering_wifi_get_setting();
1059 rv = test_tethering_wifi_set_ssid();
1062 rv = test_tethering_wifi_set_security_type();
1065 rv = test_tethering_wifi_set_visibility();
1068 rv = test_tethering_wifi_set_passphrase();
1071 rv = test_tethering_wifi_set_mac_filtering();
1074 rv = test_tethering_manage_mac_list();
1077 rv = test_tethering_get_mac_list();
1080 rv = test_tethering_wifi_reload_settings();
1083 rv = test_tethering_wifi_set_channel();
1086 rv = test_tethering_wifi_set_mode();
1089 rv = test_tethering_wifi_enable_dhcp();
1092 rv = test_tethering_wifi_set_dhcp_range();
1095 rv = test_tethering_wifi_is_dhcp_enabled();
1098 rv = test_tethering_wifi_get_txpower();
1101 rv = test_tethering_wifi_set_txpower();
1106 printf("Operation succeeded!\n");
1108 printf("Operation failed!\n");