From 6822502642c2b9eaf03718e77fede531a4967a6b Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Tue, 16 Aug 2016 13:16:00 +0530 Subject: [PATCH] Getting primary and secondary device type from wifi-direct-manager. This patch changes logic to get primary and secondary device type from wifi-direct-manager and also removes TIZEN_TV macro. Change-Id: Ia28c9bc08e9bf063c2bdea709e39f3625a733c0f Signed-off-by: Nishant Chaprana --- packaging/capi-network-wifi-direct.spec | 3 +- src/CMakeLists.txt | 4 --- src/wifi-direct-client-proxy.c | 64 +++++++++++++++++++++------------ test/CMakeLists.txt | 4 --- 4 files changed, 43 insertions(+), 32 deletions(-) diff --git a/packaging/capi-network-wifi-direct.spec b/packaging/capi-network-wifi-direct.spec index 1e63775..e1df9a4 100644 --- a/packaging/capi-network-wifi-direct.spec +++ b/packaging/capi-network-wifi-direct.spec @@ -1,6 +1,6 @@ Name: capi-network-wifi-direct Summary: Network WiFi-Direct Library -Version: 1.2.70 +Version: 1.2.71 Release: 1 Group: Network & Connectivity/API License: Apache-2.0 @@ -73,7 +73,6 @@ cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DTIZEN_FEATURE_WIFI_DISPLAY=1 \ %else %if "%{profile}" == "tv" - -DTIZEN_TV=1 \ -DTIZEN_FEATURE_SERVICE_DISCOVERY=1 \ -DTIZEN_FEATURE_WIFI_DISPLAY=1 \ %endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65b94d8..ed2c1b8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,10 +95,6 @@ IF(TIZEN_FEATURE_WIFI_DISPLAY) ADD_DEFINITIONS(-DTIZEN_FEATURE_WIFI_DISPLAY) SET(FEATURES "${FEATURES} -DTIZEN_FEATURE_WIFI_DISPLAY") ENDIF(TIZEN_FEATURE_WIFI_DISPLAY) -IF(TIZEN_TV) - ADD_DEFINITIONS(" -DTIZEN_TV") - MESSAGE("add -DTIZEN_TV") -ENDIF(TIZEN_TV) # Linker flags SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed, --rpath=${LIBDIR}") diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index 3f35ce5..7131174 100644 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -2953,11 +2953,10 @@ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type) CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE); - if (!type) { - WDC_LOGE("NULL Param [type]!"); - __WDC_LOG_FUNC_END__; - return WIFI_DIRECT_ERROR_INVALID_PARAMETER; - } + GError* error = NULL; + GVariant *reply = NULL; + int ret = WIFI_DIRECT_ERROR_NONE; + int primary_device_type = 0; if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered"); @@ -2965,16 +2964,27 @@ int wifi_direct_get_primary_device_type(wifi_direct_primary_device_type_e* type) return WIFI_DIRECT_ERROR_NOT_INITIALIZED; } -#ifdef TIZEN_TV - WDC_LOGD("Current primary_dev_type [%d]", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY); - *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY; -#else /* TIZEN_TV */ - WDC_LOGD("Current primary_dev_type [%d]", WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE); - *type = WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE; -#endif /* TIZEN_TV */ + if (type == NULL) { + WDC_LOGE("NULL Param [type]!"); + __WDC_LOG_FUNC_END__; + return WIFI_DIRECT_ERROR_INVALID_PARAMETER; + } + + reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE, + "GetPrimaryDevType", + NULL, &error); + + ret = __net_wifidirect_gerror_to_enum(error); + if (ret != WIFI_DIRECT_ERROR_NONE) + return ret; + + WDC_LOGD("%s() SUCCESS", __func__); + g_variant_get(reply, "(ii)", &ret, &primary_device_type); + g_variant_unref(reply); + *type = primary_device_type; __WDC_LOG_FUNC_END__; - return WIFI_DIRECT_ERROR_NONE; + return ret; } int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* type) @@ -2983,28 +2993,38 @@ int wifi_direct_get_secondary_device_type(wifi_direct_secondary_device_type_e* t CHECK_FEATURE_SUPPORTED(WIFIDIRECT_FEATURE); + GError* error = NULL; + GVariant *reply = NULL; + int ret = WIFI_DIRECT_ERROR_NONE; + int secondary_device_type = 0; + if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered"); __WDC_LOG_FUNC_END__; return WIFI_DIRECT_ERROR_NOT_INITIALIZED; } - if (NULL == type) { + if (type == NULL) { WDC_LOGE("NULL Param [type]!"); __WDC_LOG_FUNC_END__; return WIFI_DIRECT_ERROR_INVALID_PARAMETER; } -#ifdef TIZEN_TV - WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV); - *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV; -#else /* TIZEN_TV */ - WDC_LOGD("Current second_dev_type [%d]", WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL); - *type = WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL; /* smart phone dual mode (wifi and cellular) */ -#endif /* TIZEN_TV */ + reply = wifi_direct_dbus_method_call_sync(WFD_MANAGER_CONFIG_INTERFACE, + "GetSecondaryDevType", + NULL, &error); + + ret = __net_wifidirect_gerror_to_enum(error); + if (ret != WIFI_DIRECT_ERROR_NONE) + return ret; + + WDC_LOGD("%s() SUCCESS", __func__); + g_variant_get(reply, "(ii)", &ret, &secondary_device_type); + g_variant_unref(reply); + *type = secondary_device_type; __WDC_LOG_FUNC_END__; - return WIFI_DIRECT_ERROR_NONE; + return ret; } int wifi_direct_set_autoconnection_mode(bool mode) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c07bff..e03471c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,10 +26,6 @@ IF(TIZEN_FEATURE_WIFI_DISPLAY) ADD_DEFINITIONS(-DTIZEN_FEATURE_WIFI_DISPLAY) SET(FEATURES "${FEATURES} -DTIZEN_FEATURE_WIFI_DISPLAY") ENDIF(TIZEN_FEATURE_WIFI_DISPLAY) -IF(TIZEN_TV) - ADD_DEFINITIONS(" -DTIZEN_TV") - MESSAGE("add -DTIZEN_TV") -ENDIF(TIZEN_TV) FOREACH (flag ${TEST_APP_REQ_PKGS_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -- 2.7.4