g_strlcpy(str_buf, "P2P Tethering", sizeof(str_buf));
break;
- case TETHERING_TYPE_WIFI_SHARING:
- g_strlcpy(str_buf, "Wi-Fi Sharing", sizeof(str_buf));
- break;
-
default:
g_strlcpy(str_buf, "Unknown", sizeof(str_buf));
break;
int sel;
int ret;
- printf("Select tethering type (1:Wi-Fi, 2:Wi-Fi Sharing, 3:BT, 4:USB 5:P2P 6:ALL)\n");
+ printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:P2P 5:ALL)\n");
ret = scanf("%9d", &sel);
if (ret < 0) {
printf("scanf is failed!!\n");
*type = TETHERING_TYPE_WIFI;
break;
case 2:
- *type = TETHERING_TYPE_WIFI_SHARING;
- break;
- case 3:
*type = TETHERING_TYPE_BT;
break;
- case 4:
+ case 3:
*type = TETHERING_TYPE_USB;
break;
- case 5:
+ case 4:
*type = TETHERING_TYPE_P2P;
break;
- case 6:
+ case 5:
*type = TETHERING_TYPE_ALL;
break;
default:
printf("Tethering create is failed\n");
return -1;
}
+
+ tethering_wifi_set_channel(th5, 36);
+ tethering_wifi_set_mode(th5, TETHERING_WIFI_MODE_TYPE_A);
+
printf("Tethering create and register callback success\n");
return 1;
printf("Tethering destroy is failed\n");
return -1;
}
+ th = NULL;
+
+ __deregister_cbs(th5);
+
+ ret = tethering_destroy(th5);
+ if (__is_err(ret) == true) {
+ printf("Tethering destroy is failed\n");
+ return -1;
+ }
+ th5 = NULL;
return 1;
}
+static tethering_h _get_tethering_handle(void)
+{
+ int freq;
+
+ printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
+ if (scanf("%d", &freq) < 0)
+ return th;
+
+ return (freq ? th5 : th);
+}
+
static int test_tethering_enable(void)
{
int ret = TETHERING_ERROR_NONE;
tethering_type_e type;
int address_type = 0;
- int freq = 0;
-
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
+ bool supported = false;
+ int choice = 0;
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("IPv4: 0, IPv6: 1\n");
ret = scanf("%d", &address_type);
if (!__get_tethering_type(&type))
return -1;
- if (type == TETHERING_TYPE_WIFI_SHARING) {
- bool supported = false;
+ if (type != TETHERING_TYPE_WIFI)
+ return -1;
+
+ printf("Select 1: Wi-Fi sharing, 2: Dual band hotspot\n");
+ ret = scanf("%d", &choice);
+ if (choice == 1) {
ret = tethering_wifi_is_sharing_supported(th, &supported);
if (__is_err(ret) == true) {
if (!supported) {
printf("wifi_sharing is not supported.\n");
return -1;
+ } else {
+
+ printf("wifi_sharing is supported.\n");
+ ret = tethering_wifi_set_sharing(th, true);
+ if (__is_err(ret) == true) {
+ printf("Fail to set wifi sharing\n");
+ return -1;
+ }
}
+ } else if (choice == 2) {
+ ret = tethering_is_dualband_supported(handle, type, &supported);
- printf("wifi_sharing is supported.\n");
+ if (__is_err(ret) == true) {
+ printf("Fail to get is dubalband supported\n");
+ return -1;
+ } else
+ printf("DualBand is %s\n", supported ? "Supported" : "Not Supported");
+ } else {
+ printf("Invalid!!\n");
+ return -1;
}
if (address_type)
int ret = TETHERING_ERROR_NONE;
tethering_type_e type;
int address_type = 0;
- int freq = 0;
-
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("IPv4: 0, IPv6: 1\n");
ret = scanf("%d", &address_type);
printf("Fail to disable tethering\n");
return -1;
}
+
+ tethering_wifi_set_sharing(th, false);
+
return 1;
}
{
int ret;
tethering_type_e type;
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
-
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
if (!__get_tethering_type(&type))
return -1;
static int test_tethering_get_interface_info(void)
{
tethering_type_e type;
- int freq = 0;
int ret;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
if (!__get_tethering_type(&type))
return -1;
static int test_tethering_wifi_get_setting(void)
{
int ret;
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
+
__print_wifi_tethering_setting(handle);
ret = 1;
return ret;
{
int ret;
char ssid[100] = {0, };
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
if (test_get_user_string("Input SSID for Wi-Fi tethering:",
ssid, 100) == false) {
{
int ret;
int security_type;
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
+ tethering_h handle = _get_tethering_handle();
- tethering_h handle = freq ? th5 : th;
printf("Input security type for Wi-Fi tethering (0:NONE, 1:WPA2_PSK, 2:WPS, 3:SAE)");
ret = scanf("%9d", &security_type);
if (ret < 0) {
{
int ret;
int visibility;
- int freq = 0;
-
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)");
ret = scanf("%9d", &visibility);
{
int ret;
char passphrase[100] = {0, };
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
if (test_get_user_string("Input passphrase for Wi-Fi tethering:",
passphrase, 100) == false) {
{
int ret;
int channel;
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("Input channel for Wi-Fi tethering: ");
ret = scanf("%d", &channel);
{
int ret;
int type;
- int freq = 0;
- printf("Choose tethering handle ( 0 : 2.4GHz , 1 : 5.0GHz ) \n ");
- ret = scanf("%d", &freq);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("Input hw_mode for Wi-Fi tethering(0-b, 1-g, 2-a, 3-ad): ");
ret = scanf("%d", &type);