Getting primary and secondary device type from wifi-direct-manager. 04/84004/1 accepted/tizen/common/20160818.144048 accepted/tizen/ivi/20160818.231618 accepted/tizen/mobile/20160818.231602 accepted/tizen/tv/20160818.231611 accepted/tizen/wearable/20160818.231551 submit/tizen/20160818.002458
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 16 Aug 2016 07:46:00 +0000 (13:16 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 16 Aug 2016 07:46:00 +0000 (13:16 +0530)
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 <n.chaprana@samsung.com>
packaging/capi-network-wifi-direct.spec
src/CMakeLists.txt
src/wifi-direct-client-proxy.c
test/CMakeLists.txt

index 1e63775..e1df9a4 100644 (file)
@@ -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
index 65b94d8..ed2c1b8 100644 (file)
@@ -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}")
index 3f35ce5..7131174 100644 (file)
@@ -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)
index 4c07bff..e03471c 100644 (file)
@@ -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}")