location: set replay mode with location coordinates 82/126482/1 accepted/tizen/unified/20170424.153931 submit/tizen/20170424.062705 tizen_4.0.m1_release
authorMunkyu Im <munkyu.im@samsung.com>
Sat, 22 Apr 2017 11:24:18 +0000 (20:24 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Sat, 22 Apr 2017 11:24:45 +0000 (20:24 +0900)
Before set location coordinates, need to set replay mode first.
Client should guarantee this rule,
But disordered or skipped replay mode packet break this.
(Timing problem could be one of the reason.)
Location coordinates packet also includes the value of replay mode.
So, If replay mode hasn't been set,
get the value of replay mode from this packet.

Change-Id: Icc4071218e5b155e37c810ed9b10bac3f8fe3a5d
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
src/location.cpp

index 746e4d31545d128d26a804d8b9dde7f67a6b7d01..d6ecf98e9cbd25e3da4acf07b3b0f59b53ba5230 100644 (file)
@@ -192,11 +192,13 @@ static void* getting_location(void* data)
 
 void setting_location(char* databuf)
 {
+    LOGINFO("set data: %s\n", databuf);
     char *s = strchr(databuf, ',');
     int err = 0;
     char *saveptr;
     if (s == NULL) { // SET MODE
         int mode = atoi(databuf);
+        LOGINFO("set mode: %d\n", mode);
 
         // 0: STOP MODE, 1: NMEA_MODE (LOG MODE), 2: MANUAL MODE
         if (mode < 0 || mode > 2) {
@@ -206,9 +208,19 @@ void setting_location(char* databuf)
 
         err = vconf_set_int(VCONF_REPLAYMODE, mode);
         LOGFAIL(err, "Set ReplayMode failed. mode = %d", mode);
+
     } else {
         *s = '\0';
         int mode = atoi(databuf);
+        LOGINFO("mode: %d\n", mode);
+        int current_mode = 0;
+        err = vconf_get_int(VCONF_REPLAYMODE, &current_mode);
+        LOGFAIL(err, "Get ReplayMode failed");
+        if (mode != current_mode) {
+            err = vconf_set_int(VCONF_REPLAYMODE, mode);
+            LOGFAIL(err, "Set ReplayMode failed. mode = %d", mode);
+        }
+        LOGERR("ReplayMode mode = %d\n", mode);
         if (mode == 1) { // NMEA MODE (LOG MODE)
             err = vconf_set_str(VCONF_FILENAME, s+1);
             LOGFAIL(err, "Set FileName failed. name = %s", s+1);