Remove TIZEN_FEATURE_SERVICE_DISCOVERY build flag 85/138385/1
authorJiung Yu <jiung.yu@samsung.com>
Wed, 12 Jul 2017 05:02:35 +0000 (14:02 +0900)
committerJiung Yu <jiung.yu@samsung.com>
Wed, 12 Jul 2017 05:02:48 +0000 (14:02 +0900)
Description: Remove this flag and manage it at run time.
If "http://tizen.org/feature/network.wifi.direct.service_discovery"
is disabled in model configuration, we won't  handle related part.

Change-Id: I8c75dbd1db0456bc87de480827d296769d9f000f
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/capi-network-wifi-direct.spec
src/CMakeLists.txt
src/include/wifi-direct-client-proxy.h
src/wifi-direct-client-proxy.c
src/wifi-direct-dbus.c
test/CMakeLists.txt

index 7299a67c47dded368bc485a6c84002810c80f5d8..a8917cfc566a2550959d11da9e7f018ad0e9c19a 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:       capi-network-wifi-direct
 Summary:    Network WiFi-Direct Library
-Version:    1.2.85
+Version:    1.2.86
 Release:    1
 Group:      Network & Connectivity/API
 License:    Apache-2.0
@@ -82,13 +82,11 @@ mkdir -p build_extension
 pushd build_extension
 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
        -DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND=1 \
-       -DTIZEN_FEATURE_SERVICE_DISCOVERY=1 \
        .. -DVERSION=%{version} -DMAJORVERSION=${MAJORVER} -DCMAKE_LIB_DIR=%{_libdir}
 make %{?jobs:-j%jobs}
 popd
 
 cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-       -DTIZEN_FEATURE_SERVICE_DISCOVERY=0 \
        . -DVERSION=%{version} -DMAJORVERSION=${MAJORVER} -DCMAKE_LIB_DIR=%{_libdir}
 make %{?jobs:-j%jobs}
 
index 71720de8204b731ed4c85af2777952c7ca985312..40ce26ff6bc9459e195e04b67be376f08ee7d42d 100644 (file)
@@ -87,10 +87,6 @@ ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" ")
-IF(TIZEN_FEATURE_SERVICE_DISCOVERY)
-       ADD_DEFINITIONS(-DTIZEN_FEATURE_SERVICE_DISCOVERY)
-       SET(FEATURES "${FEATURES} -DTIZEN_FEATURE_SERVICE_DISCOVERY")
-ENDIF(TIZEN_FEATURE_SERVICE_DISCOVERY)
 IF(TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND)
        ADD_DEFINITIONS(-DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND)
        SET(FEATURES "${FEATURES} -DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND")
index 7b1f92546394f1873eabb36bfacffb0f9cd81a79..2f1efe71ffb51beb042d102d7da9af8801405677 100644 (file)
@@ -55,6 +55,7 @@
 typedef struct {
        bool is_registered;
        bool is_display_supported;
+       bool is_service_discovery_supported;
 
        wifi_direct_device_state_changed_cb activation_cb;
        void *user_data_for_cb_activation;
@@ -74,10 +75,8 @@ typedef struct {
        wifi_direct_state_changed_cb state_cb;
        void *user_data_for_cb_state;
 
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        wifi_direct_service_state_changed_cb service_cb;
        void *user_data_for_cb_service;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
 
 } wifi_direct_client_info_s;
 
index 74bb7f8e9a3c33f3366b19369128c8f68e3bcb80..8de51dbec70c1ffc7163e6d195a4683b63cfead2 100644 (file)
@@ -125,6 +125,13 @@ static int __wfd_check_display_feature()
        return WIFI_DIRECT_ERROR_NONE;
 }
 
+static int __wfd_check_service_discovery_feature()
+{
+       CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
+
+       return WIFI_DIRECT_ERROR_NONE;
+}
+
 //LCOV_EXCL_START
 void __wfd_vconf_state_changed_cb(keynode_t *key, void *data)
 {
@@ -574,7 +581,6 @@ void wifi_direct_process_group_destroyed(GDBusConnection *connection,
        __WDC_LOG_FUNC_END__;
 }
 
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
 /* Service */
 void wifi_direct_process_service_discovery_started(GDBusConnection *connection,
                                                   const gchar *sender,
@@ -587,6 +593,12 @@ void wifi_direct_process_service_discovery_started(GDBusConnection *connection,
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
 
+       if (!client->is_service_discovery_supported) {
+               WDC_LOGI("service discovery is not supported\n");
+               __WDC_LOG_FUNC_END__;
+               return;
+       }
+
        if (!client->service_cb) {
                WDC_LOGI("service_cb is NULL!!\n");
                __WDC_LOG_FUNC_END__;
@@ -617,6 +629,12 @@ void wifi_direct_process_service_discovery_found(GDBusConnection *connection,
        const gchar* peer_mac_address = NULL;
        wifi_direct_client_info_s *client = __wfd_get_control();
 
+       if (!client->is_service_discovery_supported) {
+               WDC_LOGI("service discovery is not supported\n");
+               __WDC_LOG_FUNC_END__;
+               return;
+       }
+
        if (!parameters) {
                __WDC_LOG_FUNC_END__;
                return;
@@ -652,6 +670,12 @@ void wifi_direct_process_service_discovery_finished(GDBusConnection *connection,
        __WDC_LOG_FUNC_START__;
        wifi_direct_client_info_s *client = __wfd_get_control();
 
+       if (!client->is_service_discovery_supported) {
+               WDC_LOGI("service discovery is not supported\n");
+               __WDC_LOG_FUNC_END__;
+               return;
+       }
+
        if (!client->service_cb) {
                WDC_LOGI("service_cb is NULL!!\n");
                __WDC_LOG_FUNC_END__;
@@ -667,7 +691,6 @@ void wifi_direct_process_service_discovery_finished(GDBusConnection *connection,
 
        __WDC_LOG_FUNC_END__;
 }
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
 
 #if 0
 void __wfd_client_print_entry_list(wfd_discovery_entry_s *list, int num)
@@ -842,6 +865,11 @@ int wifi_direct_initialize(void)
        else
                g_client_info.is_display_supported = FALSE;
 
+       if (__wfd_check_service_discovery_feature() == WIFI_DIRECT_ERROR_NONE)
+               g_client_info.is_service_discovery_supported = TRUE;
+       else
+               g_client_info.is_service_discovery_supported = FALSE;
+
        /* Initialize callbacks */
        g_client_info.activation_cb = NULL;
        g_client_info.user_data_for_cb_activation = NULL;
@@ -858,10 +886,8 @@ int wifi_direct_initialize(void)
        g_client_info.peer_found_cb = NULL;
        g_client_info.user_data_for_cb_peer_found = NULL;
 
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        g_client_info.service_cb = NULL;
        g_client_info.user_data_for_cb_service = NULL;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
 
        __WDC_LOG_FUNC_END__;
        return WIFI_DIRECT_ERROR_NONE;
@@ -896,10 +922,8 @@ int wifi_direct_deinitialize(void)
        g_client_info.peer_found_cb = NULL;
        g_client_info.user_data_for_cb_peer_found = NULL;
 
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        g_client_info.service_cb = NULL;
        g_client_info.user_data_for_cb_service = NULL;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
 
        g_client_info.is_registered = FALSE;
 
@@ -1051,7 +1075,6 @@ int wifi_direct_unset_peer_found_cb(void)
 int wifi_direct_set_service_state_changed_cb(wifi_direct_service_state_changed_cb cb,
                                             void *user_data)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -1073,17 +1096,13 @@ int wifi_direct_set_service_state_changed_cb(wifi_direct_service_state_changed_c
        g_client_info.user_data_for_cb_service = user_data;
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return WIFI_DIRECT_ERROR_NONE;
 }
 
 
 int wifi_direct_unset_service_state_changed_cb(void)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -1099,11 +1118,8 @@ int wifi_direct_unset_service_state_changed_cb(void)
        g_client_info.user_data_for_cb_service = NULL;
 
        __WDC_LOG_FUNC_END__;
-       return WIFI_DIRECT_ERROR_NONE;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return WIFI_DIRECT_ERROR_NONE;
 }
 
 int wifi_direct_set_connection_state_changed_cb(wifi_direct_connection_state_changed_cb cb,
@@ -3496,7 +3512,6 @@ int wifi_direct_remove_persistent_group(char *mac_address, const char *ssid)
 int wifi_direct_start_service_discovery(char *mac_address,
                wifi_direct_service_type_e type)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -3541,18 +3556,14 @@ int wifi_direct_start_service_discovery(char *mac_address,
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-       return ret;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return ret;
 }
 
 
 int wifi_direct_cancel_service_discovery(char *mac_address,
                wifi_direct_service_type_e type)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -3595,16 +3606,12 @@ int wifi_direct_cancel_service_discovery(char *mac_address,
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-       return ret;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return ret;
 }
 
 int wifi_direct_register_service(wifi_direct_service_type_e type, char *info1, char *info2, unsigned int *service_id)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -3672,16 +3679,12 @@ int wifi_direct_register_service(wifi_direct_service_type_e type, char *info1, c
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-       return ret;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return ret;
 }
 
 int wifi_direct_deregister_service(unsigned int service_id)
 {
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        __WDC_LOG_FUNC_START__;
 
        CHECK_FEATURE_SUPPORTED(WIFIDIRECT_SERVICE_DISCOVERY_FEATURE);
@@ -3711,11 +3714,8 @@ int wifi_direct_deregister_service(unsigned int service_id)
 
        WDC_LOGD("%s() return : [%d]", __func__, ret);
        __WDC_LOG_FUNC_END__;
-       return ret;
 //LCOV_EXCL_STOP
-#else /* TIZEN_FEATURE_SERVICE_DISCOVERY */
-       return WIFI_DIRECT_ERROR_NOT_SUPPORTED;
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
+       return ret;
 }
 
 int wifi_direct_init_miracast(bool enable)
index cc9750e33cea2835a85d80cfe8af7b7ec8b93a3e..abb969841d3853413a88d236f20da911a67dbdf3 100644 (file)
@@ -120,7 +120,6 @@ static struct {
                "Destroyed",
                wifi_direct_process_group_destroyed
        },
-#ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
        {
                0,
                WFD_MANAGER_SERVICE_INTERFACE,
@@ -139,7 +138,6 @@ static struct {
                "DiscoveryFinished",
                wifi_direct_process_service_discovery_finished
        },
-#endif /* TIZEN_FEATURE_SERVICE_DISCOVERY */
        {
                0,
                NULL,
index f0deaac9f13875d4c0cd3cc51b688456e596b033..cea2af75c400c82a43f9cc6731c58470305896a5 100644 (file)
@@ -18,11 +18,6 @@ IF("${ARCH}" STREQUAL "arm")
        ADD_DEFINITIONS("-DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
-IF(TIZEN_FEATURE_SERVICE_DISCOVERY)
-       ADD_DEFINITIONS(-DTIZEN_FEATURE_SERVICE_DISCOVERY)
-       SET(FEATURES "${FEATURES} -DTIZEN_FEATURE_SERVICE_DISCOVERY")
-ENDIF(TIZEN_FEATURE_SERVICE_DISCOVERY)
-
 FOREACH (flag ${TEST_APP_REQ_PKGS_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)