Add wifi location dependency 89/260589/2
authorAbhay Agarwal <ay.agarwal@samsung.com>
Wed, 6 Jan 2021 10:57:13 +0000 (16:27 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 1 Jul 2021 06:39:46 +0000 (12:09 +0530)
Change-Id: Ie1dc5885980851ffc6040291b042bc34b282e4a2
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
CMakeLists.txt
include/wifi-location-plugin.h
packaging/ua-plugin-wifi-location.spec
src/wifi-location-plugin.c

index 506098e..f9df50d 100644 (file)
@@ -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")
index a88d213..dd37193 100755 (executable)
@@ -21,6 +21,7 @@
 #define __WIFI_LOCATION_PLUGIN_H__
 
 #include <ua-plugin.h>
+#include "wifi-location.h"
 
 #include "log.h"
 
index 4cee874..0598fd1 100755 (executable)
@@ -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
index a14a56c..1753e41 100755 (executable)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <glib.h>
-#include <system_info.h>
 #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)