[wifi-direct]: Added support of "wifi_direct_set_auto_group_removal()" CAPI 67/70567/9 accepted/tizen/common/20160523.144136 accepted/tizen/ivi/20160523.103133 accepted/tizen/mobile/20160523.103140 accepted/tizen/tv/20160523.103100 accepted/tizen/wearable/20160523.103128 submit/tizen/20160523.083958
authorManeesh Jain <maneesh.jain@samsung.com>
Thu, 19 May 2016 12:40:32 +0000 (18:10 +0530)
committerManeesh Jain <maneesh.jain@samsung.com>
Fri, 20 May 2016 06:43:08 +0000 (23:43 -0700)
Description: Role of CAPI: :Enables / Disables automatic group
            removal feature when all peers are disconnected

Change-Id: I69ed4044d9339429415dfffbdba95802455de036
Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
src/wifi-direct-client-proxy.c
test/test-wifi-direct.c

index 4caf7272668528d9ca33e8ad835de87f7a908565..283c316b66049462cb925555476792fbe79d8f8b 100755 (executable)
@@ -4157,8 +4157,42 @@ int wifi_direct_get_session_timer(int *seconds)
 
        WDC_LOGD("Session Timer = [%d] Seconds", *seconds);
        WDC_LOGD("%s() return : [%d]", __func__, ret);
+
        __WDC_LOG_FUNC_END__;
        return ret;
 }
 
+int wifi_direct_set_auto_group_removal(bool enable)
+{
+       __WDC_LOG_FUNC_START__;
+
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE);
+
+       GError* error = NULL;
+       GVariant *reply = NULL;
+       GVariant *params = NULL;
+       int ret = WIFI_DIRECT_ERROR_NONE;
+
+       if (g_client_info.is_registered == false) {
+               WDC_LOGE("Client is NOT registered");
+               __WDC_LOG_FUNC_END__;
+               return WIFI_DIRECT_ERROR_NOT_INITIALIZED;
+       }
+
+       params = g_variant_new("(b)", enable);
+       reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE,
+                                         "SetAutoGroupRemoval",
+                                         params,
+                                         &error);
+
+       ret = __net_wifidirect_gerror_to_enum(error);
+       if (ret == WIFI_DIRECT_ERROR_NONE) {
+               g_variant_get(reply, "(i)", &ret);
+               g_variant_unref(reply);
+       }
+
+       WDC_LOGD("%s() return : [%d]", __func__, ret);
+       __WDC_LOG_FUNC_END__;
+       return ret;
+}
 //LCOV_EXCL_STOP
index 39e8c1e1fd8f59f5eeb034c13d102ad70bc3645a..5b7b2fc6747bf6742e71d1695a138ce0d63d85e4 100755 (executable)
@@ -167,6 +167,7 @@ enum {
        CMD_GET_PEER_DISPLAY_THROUGHPUT,
        CMD_GET_SESSION_TIMER,
        CMD_SET_SESSION_TIMER,
+       CMD_SET_AUTO_GROUP_REMOVAL,
 
        CMD_INVALID = 255,
 };
@@ -276,6 +277,7 @@ menu_str_t g_menu_str[] = {
                { CMD_GET_PEER_DISPLAY_THROUGHPUT, "CMD_GET_PEER_DISPLAY_THROUGHPUT" },
                { CMD_GET_SESSION_TIMER, "CMD_GET_SESSION_TIMER" },
                { CMD_SET_SESSION_TIMER, "CMD_SET_SESSION_TIMER" },
+               { CMD_SET_AUTO_GROUP_REMOVAL, "CMD_SET_AUTO_GROUP_REMOVAL" },
 
                { -1, NULL }, };
 
@@ -2382,6 +2384,20 @@ void process_input(const char *input, gpointer user_data)
                                                        result, session_timer);
                }
                break;
+       case CMD_SET_AUTO_GROUP_REMOVAL:
+               if (ad != NULL) {
+                       int enable;
+                       if (scanf(" %d", &enable) < 1)
+                               break;
+
+                       result = wifi_direct_set_auto_group_removal(enable);
+                       printf("wifi_direct_set_auto_group_removal() result=[%d]\n", result);
+                       if (enable == true)
+                               printf("Enable auto Group Removal!! \n");
+                       else
+                               printf("Disable auto Group Removal mode!! \n");
+               }
+               break;
        case CMD_FULL_MENU:
                usage_full();
                break;