From: Maneesh Jain Date: Thu, 19 May 2016 12:40:32 +0000 (+0530) Subject: [wifi-direct]: Added support of "wifi_direct_set_auto_group_removal()" CAPI X-Git-Tag: submit/tizen/20160523.083958^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F70567%2F9;p=platform%2Fcore%2Fapi%2Fwifi-direct.git [wifi-direct]: Added support of "wifi_direct_set_auto_group_removal()" CAPI Description: Role of CAPI: :Enables / Disables automatic group removal feature when all peers are disconnected Change-Id: I69ed4044d9339429415dfffbdba95802455de036 Signed-off-by: Maneesh Jain --- diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index 4caf727..283c316 100755 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -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 diff --git a/test/test-wifi-direct.c b/test/test-wifi-direct.c index 39e8c1e..5b7b2fc 100755 --- a/test/test-wifi-direct.c +++ b/test/test-wifi-direct.c @@ -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;