From: Prasadam Prashath Kumar Date: Sun, 23 Aug 2020 14:52:13 +0000 (+0530) Subject: Added API to supported dualband hotspot. X-Git-Tag: submit/tizen/20200828.142119~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71bb47a2bf3128e9b277f740d7f7ed6ae0a78f29;p=platform%2Fcore%2Fapi%2Ftethering.git Added API to supported dualband hotspot. Change-Id: Iff62b4204c46de2f6f85c32491727cb3ba8e38d4 Signed-off-by: Prasadam Prashath Kumar --- diff --git a/include/tethering.h b/include/tethering.h index fe43b64..102a905 100644 --- a/include/tethering.h +++ b/include/tethering.h @@ -1525,6 +1525,7 @@ int tethering_client_get_mac_address(tethering_client_h client, char **mac_addre */ int tethering_client_get_time(tethering_client_h client, time_t *timestamp); + /** * @} */ diff --git a/src/tethering.c b/src/tethering.c index cd44ae7..4ef8036 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -1946,7 +1946,7 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) SINFO("Disable Wi-Fi Tethering !"); g_dbus_proxy_call(proxy, "disable_wifi_tethering", - g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4), + g_variant_new("(ii)", TETHERING_ADDRESS_FAMILY_IPV4, th->mode_type), G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering); break; diff --git a/tools/tethering_test.c b/tools/tethering_test.c index 02670f2..66ae65e 100755 --- a/tools/tethering_test.c +++ b/tools/tethering_test.c @@ -43,6 +43,7 @@ typedef struct { } __tethering_cbs; tethering_h th = NULL; +tethering_h th5 = NULL; static bool __is_err(tethering_error_e ret) { @@ -669,6 +670,14 @@ static int test_tethering_create(void) printf("Tethering create is failed\n"); return -1; } + + ret = tethering_create(&th5); + + if (__is_err(ret) == false) __register_cbs(th5, &cbs, NULL); + else { + printf("Tethering create is failed\n"); + return -1; + } printf("Tethering create and register callback success\n"); return 1; @@ -694,6 +703,12 @@ 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; printf("IPv4: 0, IPv6: 1\n"); ret = scanf("%d", &address_type); @@ -720,9 +735,9 @@ static int test_tethering_enable(void) } if (address_type) - ret = tethering_ipv6_enable(th, type); + ret = tethering_ipv6_enable(handle, type); else - ret = tethering_enable(th, type); + ret = tethering_enable(handle, type); if (__is_err(ret) == true) { printf("Fail to enable tethering\n"); @@ -736,6 +751,12 @@ static int test_tethering_disable(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; printf("IPv4: 0, IPv6: 1\n"); ret = scanf("%d", &address_type); @@ -744,9 +765,9 @@ static int test_tethering_disable(void) return -1; if (address_type) - ret = tethering_ipv6_disable(th, type); + ret = tethering_ipv6_disable(handle, type); else - ret = tethering_disable(th, type); + ret = tethering_disable(handle, type); if (__is_err(ret) == true) { printf("Fail to disable tethering\n"); @@ -759,11 +780,17 @@ static int test_tethering_get_client_info(void) { 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; if (!__get_tethering_type(&type)) return -1; - ret = tethering_foreach_connected_clients(th, type, + ret = tethering_foreach_connected_clients(handle, type, __clients_foreach_cb, NULL); if (__is_err(ret) == true) { printf("Fail to disable tethering\n"); @@ -776,13 +803,19 @@ static int test_tethering_get_client_info(void) 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; if (!__get_tethering_type(&type)) return -1; - __print_interface_info(th, type); - - return 1; + __print_interface_info(handle, type); + ret = 1; + return ret; } static int test_tethering_get_data_usage(void) @@ -799,14 +832,26 @@ static int test_tethering_get_data_usage(void) static int test_tethering_wifi_get_setting(void) { - __print_wifi_tethering_setting(th); - return 1; + 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; + __print_wifi_tethering_setting(handle); + ret = 1; + return ret; } static int test_tethering_wifi_set_ssid(void) { 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; if (test_get_user_string("Input SSID for Wi-Fi tethering:", ssid, 100) == false) { @@ -814,7 +859,7 @@ static int test_tethering_wifi_set_ssid(void) return -1; } - ret = tethering_wifi_set_ssid(th, ssid); + ret = tethering_wifi_set_ssid(handle, ssid); if (__is_err(ret) == true) { printf("Fail to set wifi ssid!!\n"); return -1; @@ -827,7 +872,12 @@ static int test_tethering_wifi_set_security_type(void) { 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 = 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) { @@ -835,7 +885,7 @@ static int test_tethering_wifi_set_security_type(void) return -1; } - ret = tethering_wifi_set_security_type(th, security_type); + ret = tethering_wifi_set_security_type(handle, security_type); if (__is_err(ret) == true) { printf("Fail to set security type!!\n"); return -1; @@ -848,6 +898,12 @@ int test_tethering_wifi_set_visibility(void) { 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; printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)"); ret = scanf("%9d", &visibility); @@ -856,7 +912,7 @@ int test_tethering_wifi_set_visibility(void) return -1; } - ret = tethering_wifi_set_ssid_visibility(th, visibility); + ret = tethering_wifi_set_ssid_visibility(handle, visibility); if (__is_err(ret) == true) { printf("Fail to set visibility!!\n"); return -1; @@ -869,6 +925,11 @@ static int test_tethering_wifi_set_passphrase(void) { 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; if (test_get_user_string("Input passphrase for Wi-Fi tethering:", passphrase, 100) == false) { @@ -876,7 +937,7 @@ static int test_tethering_wifi_set_passphrase(void) return -1; } - ret = tethering_wifi_set_passphrase(th, passphrase); + ret = tethering_wifi_set_passphrase(handle, passphrase); if (__is_err(ret) == true) { printf("Fail to set passphrase!!\n"); return -1; @@ -889,11 +950,16 @@ static int test_tethering_wifi_set_channel(void) { 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; printf("Input channel for Wi-Fi tethering: "); ret = scanf("%d", &channel); - ret = tethering_wifi_set_channel(th, channel); + ret = tethering_wifi_set_channel(handle, channel); if (__is_err(ret) == true) { printf("Fail to set channel!!\n"); return -1; @@ -906,11 +972,16 @@ static int test_tethering_wifi_set_mode(void) { 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; printf("Input hw_mode for Wi-Fi tethering(0-b, 1-g, 2-a, 3-ad): "); ret = scanf("%d", &type); - ret = tethering_wifi_set_mode(th, type); + ret = tethering_wifi_set_mode(handle, type); if (__is_err(ret) == true) { printf("Fail to set mode!!\n"); return -1; @@ -1364,6 +1435,11 @@ static int test_tethering_wifi_set_wps_pin(void) return 1; } +static int test_tethering_wifi_is_dualband_supported(void) +{ + return 1; +} + int main(int argc, char **argv) { GMainLoop *mainloop; @@ -1434,6 +1510,8 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) printf("F - Set vpn passthrough rule\n"); printf("G - Push WPS button\n"); printf("H - Set WPS PIN\n"); + printf("I - Is Wi-Fi dualband supported \n"); + printf("J - Set Wi-Fi dualband \n"); printf("0 - \n"); printf("ENTER - Show options menu.......\n"); } @@ -1553,6 +1631,9 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) case 'H': rv = test_tethering_wifi_set_wps_pin(); break; + case 'I': + rv = test_tethering_wifi_is_dualband_supported(); + break; } if (rv == 1)