- if (!strcmp(cmd, "set_ap_ssid")) {
- error = tethering_wifi_ap_set_ssid(th, param);
- if (error != TETHERING_ERROR_NONE)
- g_print("tethering_wifi_ap_set_ssid is failed [0x%X]\n",
- error);
- goto DONE;
- }
-
- if (!strcmp(cmd, "do handle_creation_test")) {
- int count = 0;
- int i = 0;
- count = atoi(param);
- g_print("testing %d times....\n", count);
- while (count > 0) {
- sleep(3);
- g_print("Destroying tethering %dth time\n", i);
- if (NULL != th) {
- __deregister_cbs(th);
-
- error = tethering_destroy(th);
-
- if (__is_err(error) == true)
- return 0;
- }
- sleep(3);
- g_print("Creating tethering %dth time\n", i);
- error = tethering_create(&th);
- if (__is_err(error) == true)
- return 0;
- __register_cbs(th, &cbs, NULL);
- i++;
- count--;
- }
- goto DONE;
- }
-
- /* One parameter(type) */
- if (!strcmp(param, "USB"))
- type = TETHERING_TYPE_USB;
- else if (!strcmp(param, "WIFI"))
- type = TETHERING_TYPE_WIFI;
- else if (!strcmp(param, "BT"))
- type = TETHERING_TYPE_BT;
- else if (!strcmp(param, "AP"))
- type = TETHERING_TYPE_RESERVED;
- else if (!strcmp(param, "ALL"))
- type = TETHERING_TYPE_ALL;
- else
- goto DONE;
-
- if (!strcmp(cmd, "clients")) {
- error = tethering_foreach_connected_clients(th, type,
- __clients_foreach_cb, NULL);
- if (error != TETHERING_ERROR_NONE)
- g_print("tethering_get_data_usage is failed [0x%X]\n",
- error);
- } else if (!strcmp(cmd, "info")) {
- __print_interface_info(th, type);
- } else if (!strcmp(cmd, "enable")) {
- __enable_tethering(th, type);
- } else if (!strcmp(cmd, "disable")) {
- __disable_tethering(th, type);
- } else {
- goto DONE;
+ ret = tethering_wifi_ap_set_ssid(th, ssid);
+ if (__is_err(ret) == true) {
+ printf("Fail to set wifi ap ssid!!\n");
+ return -1;
+ }
+ return 1;
+}
+
+static int test_tethering_wifi_ap_set_security_type(void)
+{
+ int ret;
+ int security_type;
+
+ printf("Input security type for Wi-Fi AP tethering (0:NONE, 1:WPA2_PSK)");
+ ret = scanf("%9d", &security_type);
+ if (ret < 0) {
+ printf("scanf is failed!!\n");
+ return -1;