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;
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);
- tethering_h handle = freq ? th5 : th;
+ tethering_h handle = _get_tethering_handle();
printf("IPv4: 0, IPv6: 1\n");
ret = scanf("%d", &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);
{
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);