Change dbus service name for mobileap-agent and add test case for getting channel...
[platform/core/api/tethering.git] / test / tethering_test.c
index e2481be..054c177 100755 (executable)
@@ -488,7 +488,9 @@ static void __print_wifi_tethering_setting(tethering_h th)
        char *passphrase = NULL;
        bool visibility = false;
        bool mac_filter = 0;
+       int channel = 0;
        tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE;
+       tethering_wifi_mode_type_e hw_mode = TETHERING_WIFI_MODE_TYPE_G;
 
        int error = TETHERING_ERROR_NONE;
 
@@ -527,6 +529,18 @@ static void __print_wifi_tethering_setting(tethering_h th)
                g_print("\t** WiFi tethering mac filter : %s\n",
                                mac_filter ? "enable" : "disable");
 
+       error = tethering_wifi_get_mode(th, &hw_mode);
+       if (error != TETHERING_ERROR_NONE)
+               __is_err(error);
+       else
+                g_print("\t** WiFi tethering mode : %d\n", hw_mode);
+
+       error = tethering_wifi_get_channel(th, &channel);
+       if (error != TETHERING_ERROR_NONE)
+               __is_err(error);
+       else
+                g_print("\t** WiFi tethering channel : %d\n", channel);
+
        if (ssid)
                free(ssid);
        if (passphrase)
@@ -853,6 +867,59 @@ static int test_tethering_wifi_set_mode(void)
        return 1;
 }
 
+static int test_tethering_wifi_enable_dhcp(void)
+{
+       int ret;
+       int enable;
+
+       printf("Input (0-Disable, 1-Enable): ");
+       ret = scanf("%d", &enable);
+
+       ret = tethering_wifi_enable_dhcp(th, enable);
+       if (__is_err(ret) == true) {
+               printf("Fail to enable dhcp server!!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_set_dhcp_range(void)
+{
+       int ret;
+       char rangestart[16], rangestop[16];
+
+       printf("Input range (ex: 192.168.0.50 192.168.0.150): ");
+
+       ret = scanf("%s %s", rangestart, rangestop);
+
+       ret = tethering_wifi_set_dhcp_range(th, rangestart, rangestop);
+       if (__is_err(ret) == true) {
+               printf("Fail to set dhcp range and enable dhcp server!!\n");
+               return -1;
+       }
+
+       return 1;
+}
+
+static int test_tethering_wifi_is_dhcp_enabled(void)
+{
+       int ret;
+       bool enabled;
+
+       ret = tethering_wifi_is_dhcp_enabled(th, &enabled);
+
+       if (__is_err(ret) == true) {
+               printf("Fail to get dhcp server status!!\n");
+               return -1;
+       }
+       else {
+               printf("DHCP server is %s\n", enabled? "enabled": "disabled");
+       }
+
+       return 1;
+}
+
 static int test_tethering_wifi_set_mac_filtering(void)
 {
        int ret;
@@ -1069,6 +1136,9 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("l       - Reload Wi-Fi AP\n");
                printf("m       - Set Wi-Fi channel\n");
                printf("n       - Set Wi-Fi hw_mode\n");
+               printf("o       - Enable dhcp server\n");
+               printf("p       - Enable dhcp server with range\n");
+               printf("q       - Is dhcp server enabled?\n");
                printf("0       - Exit \n");
                printf("ENTER  - Show options menu.......\n");
        }
@@ -1143,6 +1213,15 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
        case 'n':
                rv = test_tethering_wifi_set_mode();
                break;
+       case 'o':
+               rv = test_tethering_wifi_enable_dhcp();
+               break;
+       case 'p':
+               rv = test_tethering_wifi_set_dhcp_range();
+               break;
+       case 'q':
+               rv = test_tethering_wifi_is_dhcp_enabled();
+               break;
        }
 
        if (rv == 1)