summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Schmidt <Helmut.3.Schmidt@continental-corporation.com>2016-11-11 13:19:47 +0100
committerHelmut Schmidt <Helmut.3.Schmidt@continental-corporation.com>2016-11-11 13:19:47 +0100
commitd98da3f54fbd185ec571e787a423ad1c5623f7f7 (patch)
treeb039fc7ad1c8afca6412a2e588642139e7f49ff0
parent4c1d07eef5d69354dfe089de3307dc2fe00ef56a (diff)
downloadpositioning-d98da3f54fbd185ec571e787a423ad1c5623f7f7.tar.gz
GT-3402 "Positioning SensorsService API: Add sampling interval field to gyroscope, accelerometer etc data structures"
step 4: Adapt Log file format documentation and Log Reader/Writer PoC implementations
-rwxr-xr-xlog-replayer/doc/LogFileFormat.v4.00.docbin372224 -> 369152 bytes
-rw-r--r--logger/test/snslog.cpp6
-rw-r--r--sensors-service/src/sns-use-replayer.c105
3 files changed, 85 insertions, 26 deletions
diff --git a/log-replayer/doc/LogFileFormat.v4.00.doc b/log-replayer/doc/LogFileFormat.v4.00.doc
index f4fc316..c7523ac 100755
--- a/log-replayer/doc/LogFileFormat.v4.00.doc
+++ b/log-replayer/doc/LogFileFormat.v4.00.doc
Binary files differ
diff --git a/logger/test/snslog.cpp b/logger/test/snslog.cpp
index 2f2d04f..d2a6893 100644
--- a/logger/test/snslog.cpp
+++ b/logger/test/snslog.cpp
@@ -55,7 +55,7 @@ void accelerationDataToString(uint64_t timestamp, uint16_t countdown, const TAcc
snprintf(
str,
size-1, //ensure that there is space for null-terminator
- "%"PRIu64",%"PRIu16",$GVSNSACC,%"PRIu64",%7.4f,%7.4f,%7.4f,%5.1f,0X%08X",
+ "%"PRIu64",%"PRIu16",$GVSNSACC,%"PRIu64",%7.4f,%7.4f,%7.4f,%5.1f,%"PRIu16",0X%08X",
timestamp,
countdown,
accelerationData->timestamp,
@@ -63,6 +63,7 @@ void accelerationDataToString(uint64_t timestamp, uint16_t countdown, const TAcc
accelerationData->y,
accelerationData->z,
accelerationData->temperature,
+ accelerationData->measurementInterval,
accelerationData->validityBits
);
str[size-1] = 0; //ensure that string is null-terminated
@@ -89,7 +90,7 @@ void gyroscopeDataToString(uint64_t timestamp, uint16_t countdown, const TGyrosc
snprintf(
str,
size-1, //ensure that there is space for null-terminator
- "%"PRIu64",%"PRIu16",$GVSNSGYR,%"PRIu64",%6.2f,%6.2f,%6.2f,%5.1f,0X%08X",
+ "%"PRIu64",%"PRIu16",$GVSNSGYR,%"PRIu64",%6.2f,%6.2f,%6.2f,%5.1f,%"PRIu16",0X%08X",
timestamp,
countdown,
gyroData->timestamp,
@@ -97,6 +98,7 @@ void gyroscopeDataToString(uint64_t timestamp, uint16_t countdown, const TGyrosc
gyroData->pitchRate,
gyroData->rollRate,
gyroData->temperature,
+ gyroData->measurementInterval,
gyroData->validityBits
);
str[size-1] = 0; //ensure that string is null-terminated
diff --git a/sensors-service/src/sns-use-replayer.c b/sensors-service/src/sns-use-replayer.c
index 179a2b8..a39db1a 100644
--- a/sensors-service/src/sns-use-replayer.c
+++ b/sensors-service/src/sns-use-replayer.c
@@ -171,7 +171,7 @@ bool snsVehicleDataDestroy()
bool processGVSNSWHE(const char* data)
{
- //parse data like: 061076000,0$GVSNSWHTK,061076000,7,266,8,185,0,0,0,0
+ //parse data like: 15259,0,$GVSNSWHE,15200,35,45,0,0,0,0,0,0,0X0001,100,0X03
//storage for buffered data
static TWheelData buf_whtk[MAX_BUF_MSG];
@@ -189,20 +189,36 @@ bool processGVSNSWHE(const char* data)
return false;
}
- n = sscanf(data, "%llu,%hu,$GVSNSWHE,%llu,%f,%f,%f,%f,%f,%f,%f,%f,%x,%x",
- &timestamp, &countdown, &whtk.timestamp
- ,&whtk.data[0], &whtk.data[1]
- ,&whtk.data[2], &whtk.data[3]
- ,&whtk.data[4], &whtk.data[5]
- ,&whtk.data[6], &whtk.data[7]
- ,&whtk.statusBits
- ,&whtk.validityBits
- );
-
- if (n != 13) //13 fields to parse
+ //First try to read in new format with measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSWHE,%llu,%f,%f,%f,%f,%f,%f,%f,%f,%x,%hu,%x",
+ &timestamp, &countdown, &whtk.timestamp
+ ,&whtk.data[0], &whtk.data[1]
+ ,&whtk.data[2], &whtk.data[3]
+ ,&whtk.data[4], &whtk.data[5]
+ ,&whtk.data[6], &whtk.data[7]
+ ,&whtk.statusBits
+ ,&whtk.measurementInterval
+ ,&whtk.validityBits
+ );
+
+ if (n != 14) //14 fields to parse
{
- LOG_ERROR_MSG(gContext,"replayer: processGVSNSWHE failed!");
- return false;
+ //Else try to read in old format without measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSWHE,%llu,%f,%f,%f,%f,%f,%f,%f,%f,%x,%x",
+ &timestamp, &countdown, &whtk.timestamp
+ ,&whtk.data[0], &whtk.data[1]
+ ,&whtk.data[2], &whtk.data[3]
+ ,&whtk.data[4], &whtk.data[5]
+ ,&whtk.data[6], &whtk.data[7]
+ ,&whtk.statusBits
+ ,&whtk.validityBits
+ );
+
+ if (n != 13) //13 fields to parse
+ {
+ LOG_ERROR_MSG(gContext,"replayer: processGVSNSWHE failed!");
+ return false;
+ }
}
//buffered data handling
@@ -261,12 +277,33 @@ static bool processGVSNSGYR(const char* data)
return false;
}
- n = sscanf(data, "%llu,%hu,$GVSNSGYR,%llu,%f,%f,%f,%f,%x", &timestamp, &countdown, &gyro.timestamp, &gyro.yawRate, &gyro.pitchRate, &gyro.rollRate, &gyro.temperature, &gyro.validityBits);
-
- if (n != 8) //8 fields to parse
+ //First try to read in new format with measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSGYR,%llu,%f,%f,%f,%f,%hu,%x"
+ ,&timestamp, &countdown, &gyro.timestamp
+ ,&gyro.yawRate
+ ,&gyro.pitchRate
+ ,&gyro.rollRate
+ ,&gyro.temperature
+ ,&gyro.measurementInterval
+ ,&gyro.validityBits
+ );
+ if (n != 9) //9 fields to parse
{
- LOG_ERROR_MSG(gContext,"replayer: processGVSNSGYR failed!");
- return false;
+ //Else try to read in old format without measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSGYR,%llu,%f,%f,%f,%f,%x"
+ ,&timestamp, &countdown, &gyro.timestamp
+ ,&gyro.yawRate
+ ,&gyro.pitchRate
+ ,&gyro.rollRate
+ ,&gyro.temperature
+ ,&gyro.validityBits
+ );
+
+ if (n != 8) //8 fields to parse
+ {
+ LOG_ERROR_MSG(gContext,"replayer: processGVSNSGYR failed!");
+ return false;
+ }
}
//buffered data handling
@@ -327,12 +364,32 @@ static bool processGVSNSVSP(const char* data)
return false;
}
- n = sscanf(data, "%llu,%hu,$GVSNSVSP,%llu,%f,%x", &timestamp, &countdown, &vehsp.timestamp, &vehsp.vehicleSpeed, &vehsp.validityBits);
-
- if (n != 5) //5 fields to parse
+ //First try to read in new format with measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSVSP,%llu,%f,%hu,%x"
+ ,&timestamp
+ ,&countdown
+ ,&vehsp.timestamp
+ ,&vehsp.vehicleSpeed
+ ,&vehsp.measurementInterval
+ ,&vehsp.validityBits
+ );
+
+ if (n != 6) //6 fields to parse
{
- LOG_ERROR_MSG(gContext,"replayer: processGVSNSVSP failed!");
- return false;
+ //Else try to read in old format without measurementInterval
+ n = sscanf(data, "%llu,%hu,$GVSNSVSP,%llu,%f,%x"
+ ,&timestamp
+ ,&countdown
+ ,&vehsp.timestamp
+ ,&vehsp.vehicleSpeed
+ ,&vehsp.validityBits
+ );
+
+ if (n != 5) //5 fields to parse
+ {
+ LOG_ERROR_MSG(gContext,"replayer: processGVSNSVSP failed!");
+ return false;
+ }
}
//buffered data handling