From: Munkyu Im Date: Sat, 22 Apr 2017 11:24:18 +0000 (+0900) Subject: location: set replay mode with location coordinates X-Git-Tag: submit/tizen/20170424.062705^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F126482%2F1;p=platform%2Fadaptation%2Femulator%2Femulator-daemon.git location: set replay mode with location coordinates 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 --- diff --git a/src/location.cpp b/src/location.cpp index 746e4d3..d6ecf98 100644 --- a/src/location.cpp +++ b/src/location.cpp @@ -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, ¤t_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);