From: Abhay Agarwal Date: Wed, 6 Jan 2021 10:57:13 +0000 (+0530) Subject: Add wifi location dependency X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F260589%2F2;p=platform%2Fcore%2Fconnectivity%2Fua-plugin-wifi-location.git Add wifi location dependency Change-Id: Ie1dc5885980851ffc6040291b042bc34b282e4a2 Signed-off-by: Abhay Agarwal --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 506098e..f9df50d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,25 +10,23 @@ SET(VERSION ${VERSION_MAJOR}.0.0) # Set required packages INCLUDE(FindPkgConfig) -pkg_check_modules(PKGS_BLE REQUIRED +pkg_check_modules(PKGS_WIFI_LOCATION REQUIRED dlog gio-2.0 gio-unix-2.0 glib-2.0 ua-plugins capi-system-info + capi-network-wifi-location ) -FOREACH(flag ${PKGS_BLE_CFLAGS}) +FOREACH(flag ${PKGS_WIFI_LOCATION_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -D_FORTIFY_SOURCE=2 -O") ENDFOREACH(flag) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -#INCLUDE_DIRECTORIES(${PKGS_INCLUDE_DIRS}) -#LINK_DIRECTORIES(${PKGS_LIBRARY_DIRS}) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Werror") SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") SET(CMAKE_C_FLAGS_RELEASE "-O2") diff --git a/include/wifi-location-plugin.h b/include/wifi-location-plugin.h index a88d213..dd37193 100755 --- a/include/wifi-location-plugin.h +++ b/include/wifi-location-plugin.h @@ -21,6 +21,7 @@ #define __WIFI_LOCATION_PLUGIN_H__ #include +#include "wifi-location.h" #include "log.h" diff --git a/packaging/ua-plugin-wifi-location.spec b/packaging/ua-plugin-wifi-location.spec index 4cee874..0598fd1 100755 --- a/packaging/ua-plugin-wifi-location.spec +++ b/packaging/ua-plugin-wifi-location.spec @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(ua-plugins) BuildRequires: pkgconfig(capi-system-info) +BuildRequires: pkgconfig(capi-network-wifi-location) %if 0%{?gtests:1} BuildRequires: pkgconfig(gmock) @@ -46,7 +47,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr \ -DSBIN_DIR=%{_sbindir} \ -DNETWORK_FW_DATADIR=%{NETWORK_FW_DATADIR} \ -DDBDIR=%{DBDIR} \ - -DSUPPORT_BLE_ADV=%{?leadv:1}%{!?leadv:0} \ -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \ -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} make %{?jobs:-j%jobs} @@ -54,8 +54,8 @@ make %{?jobs:-j%jobs} %cmake %install -mkdir -p %{buildroot}{NETWORK_FW_DATADIR}/ua/lib/sensor -cp -af *.so %{buildroot}{NETWORK_FW_DATADIR}/ua/lib/sensor +mkdir -p %{buildroot}/%{TZ_SYS_RO_SHARE}/network/ua/lib/sensor +cp -af *.so %{buildroot}/%{TZ_SYS_RO_SHARE}/network/ua/lib/sensor %make_install %post -p /sbin/ldconfig diff --git a/src/wifi-location-plugin.c b/src/wifi-location-plugin.c index a14a56c..1753e41 100755 --- a/src/wifi-location-plugin.c +++ b/src/wifi-location-plugin.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "wifi-location-plugin.h" #include "wifi-location-plugin-util.h" @@ -46,12 +45,15 @@ static int init(const uas_callbacks_t *callbacks) /* TODO: Check wifi location system support */ - /* TODO: Initialize wifi-location */ + /* Initialize wifi-location */ + ret = wifi_location_initialize(); + retv_if_with_log(WIFI_LOCATION_ERROR_NONE != ret, + UAS_STATUS_FAIL, "return %d", ret); uas_cbs = callbacks; FUNC_EXIT; - return ret; + return UAS_STATUS_SUCCESS; } static int deinit(void) @@ -64,11 +66,15 @@ static int deinit(void) dev_list = NULL; } - /* TODO: Deinitialize wifi-location */ + /* Deinitialize wifi-location */ + ret = wifi_location_deinitialize(); + retv_if_with_log(WIFI_LOCATION_ERROR_NONE != ret, + UAS_STATUS_FAIL, "return %d", ret); + uas_cbs = NULL; FUNC_EXIT; - return ret; + return UAS_STATUS_SUCCESS; } static int get_state(int *state)