Change nmea logging path 54/161154/1 accepted/tizen/unified/20171127.083135 submit/tizen/20171124.081621
authorkj7.sung <kj7.sung@samsung.com>
Wed, 22 Nov 2017 02:34:20 +0000 (11:34 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Wed, 22 Nov 2017 02:34:20 +0000 (11:34 +0900)
Change-Id: I1fccca9a3bc562a0566afba9ea2364af83b60d32
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
CMakeLists.txt
lbs-server/src/nmea_logger.c
packaging/lbs-server.spec

index 8323827d5501031039e84c12fd9129ba643abb80..665910b8405e24a0f5c3f5066833c9e42f4e57de 100644 (file)
@@ -8,7 +8,7 @@ SET(BIN_DIR "${PREFIX}/bin")
 
 #Dependencies
 SET(common_dp "glib-2.0 lbs-dbus dlog gio-2.0 lbs-location")
-SET(server_dp "${common_dp} network tapi vconf vconf-internal-keys gthread-2.0  gio-unix-2.0 capi-network-wifi capi-system-info")
+SET(server_dp "${common_dp} network tapi vconf vconf-internal-keys gthread-2.0  gio-unix-2.0 capi-network-wifi capi-system-info libtzplatform-config")
 SET(module_dp "${common_dp} gmodule-2.0")
 
 # Set required packages
index 4b53c8662085ef7af9c5ef22f66fbdd120477477..662ee80e7f96212f92b5b8a2bfcb25044879d065 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
+#include <tzplatform_config.h>
 #include "nmea_logger.h"
 #include "debug_util.h"
 
 #define MAX_NMEA_RAW_DATA_LOG_FILE_CNT (999)
 #define MAX_NMEA_LOG_FILE_PATH         (100)
 
-#define PHONE_FOLDER                   "/opt/usr/media"
-#define GPS_FOLDER             PHONE_FOLDER"/lbs-server"
-#define NMEA_FOLDER                    GPS_FOLDER"/NMEA"
-#define NMEA_LOGGING_FILE_PATH         NMEA_FOLDER"/nmea_data"
+#define NMEA_LOGGING_FILE_PATH         tzplatform_mkpath(TZ_SYS_SHARE, "location/nmea")
 
 int raw_nmea_fd = -1;
 
 static int generate_nmea_log_file(char *);
-
 void start_nmea_log()
 {
        char filepath[MAX_NMEA_LOG_FILE_PATH];
 
-       /* File Open */
-       struct stat st = {0};
-
-       if (stat(GPS_FOLDER, &st) == -1) {
-               if (mkdir(GPS_FOLDER, 0777) == -1) {
-                       LOG_GPS(DBG_ERR, "Fail to make lbs-server folder");
-                       raw_nmea_fd = -1;
-                       return;
-               } else {
-                       if (mkdir(NMEA_FOLDER, 0777) == -1) {
-                               LOG_GPS(DBG_ERR, "Fail to make NMEA folder");
-                               raw_nmea_fd = -1;
-                               return;
-                       }
-               }
-       } else {
-               if (stat(NMEA_FOLDER, &st) == -1) {
-                       if (mkdir(NMEA_FOLDER, 0777) == -1) {
-                               LOG_GPS(DBG_ERR, "Fail to make NMEA folder");
-                               raw_nmea_fd = -1;
-                               return;
-                       }
-               }
-       }
-
        if (generate_nmea_log_file(filepath) == -1) {
                LOG_GPS(DBG_ERR, "Starting LBS Logging for RAW NMEA data FAILED!");
                raw_nmea_fd = -1;
@@ -122,7 +94,7 @@ static int generate_nmea_log_file(char *filepath)
        char fn[MAX_NMEA_LOG_FILE_PATH] = {0,};
 
        for (idx = 0; idx < MAX_NMEA_RAW_DATA_LOG_FILE_CNT; idx++) {
-               g_snprintf(fn, MAX_NMEA_LOG_FILE_PATH, "%s%03d.txt", NMEA_LOGGING_FILE_PATH, idx);
+               g_snprintf(fn, MAX_NMEA_LOG_FILE_PATH, "%s/nmea_data%03d.txt", NMEA_LOGGING_FILE_PATH, idx);
                if ((fd = access(fn, R_OK)) == -1) {
                        LOG_GPS(DBG_LOW, "Next log file [%s]", fn);
                        g_strlcpy(filepath, fn, strlen(fn) + 1);
index 4503cff150540c0402230da93b8590cbde0d9453..1c031e66179e67f332c05a78ac674a431f9f6f35 100644 (file)
@@ -1,6 +1,6 @@
 Name:    lbs-server
 Summary: LBS Server for Tizen
-Version: 1.3.1
+Version: 1.3.2
 Release: 1
 Group:   Location/Service
 License: Apache-2.0
@@ -23,6 +23,7 @@ BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(vconf-internal-keys)
 BuildRequires: pkgconfig(gthread-2.0)
 BuildRequires: pkgconfig(gmodule-2.0)
+BuildRequires: pkgconfig(libtzplatform-config)
 
 %description
 LBS Server for Tizen
@@ -74,6 +75,9 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
+mkdir -p %{buildroot}%{TZ_SYS_SHARE}/location
+mkdir -p %{buildroot}%{TZ_SYS_SHARE}/location/nmea
+
 mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
 install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/lbs-server.service
 %install_service multi-user.target.wants lbs-server.service
@@ -113,6 +117,9 @@ rm -rf %{buildroot}
 %{_unitdir}/multi-user.target.wants/lbs-server.service
 /opt/etc/dump.d/module.d/dump_gps.sh
 
+%defattr(-,location,location,-)
+%{TZ_SYS_SHARE}/location/nmea
+
 %files -n location-lbs-server
 %manifest location-lbs-server.manifest
 %license LICENSE