summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Schmidt <Helmut.3.Schmidt@continental-corporation.com>2014-07-23 14:47:20 +0200
committerHelmut Schmidt <Helmut.3.Schmidt@continental-corporation.com>2014-07-23 14:47:20 +0200
commita1de9b82dd3aac47ad3ac6252997fb7e1d1b64d2 (patch)
treedd6d8068a56169b35314ce508de38e6505b71549
parent5885a28cf64a591340b698ab633c88e319118816 (diff)
downloadpositioning-a1de9b82dd3aac47ad3ac6252997fb7e1d1b64d2.tar.gz
GT-3012 changes as decided in 02-July-2014 conference call: proposal to merge the header files
-rw-r--r--enhanced-position-service/src/enhanced-position.cpp406
-rw-r--r--enhanced-position-service/src/enhanced-position.h14
-rw-r--r--gnss-service/api/gnss-ext.h237
-rw-r--r--gnss-service/api/gnss-simple.h211
-rw-r--r--gnss-service/src/CMakeLists.txt2
-rw-r--r--gnss-service/src/globals.h17
-rw-r--r--gnss-service/src/gnss-ext.c88
-rw-r--r--gnss-service/src/gnss-simple.c146
-rw-r--r--gnss-service/src/gnss-use-gpsd.c334
-rw-r--r--gnss-service/src/gnss-use-replayer.c222
-rw-r--r--gnss-service/test/compliance-test/gnss-service-compliance-test.c46
-rw-r--r--gnss-service/test/gnss-service-client.c107
12 files changed, 423 insertions, 1407 deletions
diff --git a/enhanced-position-service/src/enhanced-position.cpp b/enhanced-position-service/src/enhanced-position.cpp
index a934883..3895909 100644
--- a/enhanced-position-service/src/enhanced-position.cpp
+++ b/enhanced-position-service/src/enhanced-position.cpp
@@ -84,8 +84,7 @@ std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetData(const std::vecto
{
std::map< uint16_t, ::DBus::Variant > Data;
- TGNSSPosition pos;
- TGNSSCourse course;
+ TGNSSSpatial spatial;
bool isPosRequested = false;
bool isCourseRequested = false;
@@ -96,7 +95,6 @@ std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetData(const std::vecto
(valuesToReturn[i] == POS_LONGITUDE) ||
(valuesToReturn[i] == POS_ALTITUDE))
{
- //if any of the three IDs above is set, then gnssSimpleGetPosition will have to be called
isPosRequested = true;
}
@@ -104,49 +102,48 @@ std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetData(const std::vecto
(valuesToReturn[i] == POS_SPEED) ||
(valuesToReturn[i] == POS_CLIMB ))
{
- //if any of the three IDs above is set, then gnssSimpleGetCourse will have to be called
isCourseRequested = true;
}
}
if(isPosRequested)
{
- if(gnssSimpleGetPosition(&pos))
+ if(gnssExtendedGetSpatial(&spatial))
{
- if (pos.validityBits && GNSS_POSITION_LATITUDE_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_LATITUDE_VALID)
{
- Data[POS_LATITUDE] = variant_double(pos.latitude);
+ Data[POS_LATITUDE] = variant_double(spatial.latitude);
}
- if (pos.validityBits && GNSS_POSITION_LONGITUDE_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_LONGITUDE_VALID)
{
- Data[POS_LONGITUDE] = variant_double(pos.longitude);
+ Data[POS_LONGITUDE] = variant_double(spatial.longitude);
}
- if (pos.validityBits && GNSS_POSITION_ALTITUDE_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_ALTITUDEMSL_VALID)
{
- Data[POS_ALTITUDE] = variant_double(pos.altitude);
+ Data[POS_ALTITUDE] = variant_double(spatial.altitudeMSL);
}
}
}
if(isCourseRequested)
{
- if(gnssSimpleGetCourse(&course))
+ if(gnssExtendedGetSpatial(&spatial))
{
- if (course.validityBits && GNSS_COURSE_SPEED_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_HEADING_VALID)
{
- Data[POS_HEADING] = variant_double(course.heading);
+ Data[POS_HEADING] = variant_double(spatial.heading);
}
- if (course.validityBits && GNSS_COURSE_CLIMB_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_HSPEED_VALID)
{
- Data[POS_SPEED] = variant_double(course.speed);
+ Data[POS_SPEED] = variant_double(spatial.hSpeed);
}
- if (course.validityBits && GNSS_COURSE_HEADING_VALID)
+ if (spatial.validityBits & GNSS_SPATIAL_VSPEED_VALID)
{
- Data[POS_CLIMB] = variant_double(course.climb);
+ Data[POS_CLIMB] = variant_double(spatial.vSpeed);
}
}
}
@@ -157,44 +154,40 @@ std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetData(const std::vecto
std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetPosition()
{
std::map< uint16_t, ::DBus::Variant > Position;
- TGNSSPosition pos;
- TGNSSCourse course;
+ TGNSSSpatial spatial;
- if (gnssSimpleGetPosition(&pos))
- {
- if (pos.validityBits && GNSS_POSITION_LATITUDE_VALID)
+ if(gnssExtendedGetSpatial(&spatial))
{
- Position[POS_LATITUDE] = variant_double(pos.latitude);
- }
+ if (spatial.validityBits & GNSS_SPATIAL_LATITUDE_VALID)
+ {
+ Position[POS_LATITUDE] = variant_double(spatial.latitude);
+ }
- if (pos.validityBits && GNSS_POSITION_LONGITUDE_VALID)
- {
- Position[POS_LONGITUDE] = variant_double(pos.longitude);
- }
+ if (spatial.validityBits & GNSS_SPATIAL_LONGITUDE_VALID)
+ {
+ Position[POS_LONGITUDE] = variant_double(spatial.longitude);
+ }
- if (pos.validityBits && GNSS_POSITION_ALTITUDE_VALID)
- {
- Position[POS_ALTITUDE] = variant_double(pos.altitude);
- }
- }
+ if (spatial.validityBits & GNSS_SPATIAL_ALTITUDEMSL_VALID)
+ {
+ Position[POS_ALTITUDE] = variant_double(spatial.altitudeMSL);
+ }
- if(gnssSimpleGetCourse(&course))
- {
- if (pos.validityBits && GNSS_COURSE_SPEED_VALID)
- {
- Position[POS_HEADING] = variant_double(course.heading);
- }
+ if (spatial.validityBits & GNSS_SPATIAL_HEADING_VALID)
+ {
+ Position[POS_HEADING] = variant_double(spatial.heading);
+ }
- if (pos.validityBits && GNSS_COURSE_CLIMB_VALID)
- {
- Position[POS_SPEED] = variant_double(course.speed);
- }
+ if (spatial.validityBits & GNSS_SPATIAL_HSPEED_VALID)
+ {
+ Position[POS_SPEED] = variant_double(spatial.hSpeed);
+ }
- if (pos.validityBits && GNSS_COURSE_HEADING_VALID)
- {
- Position[POS_CLIMB] = variant_double(course.climb);
+ if (spatial.validityBits & GNSS_SPATIAL_VSPEED_VALID)
+ {
+ Position[POS_CLIMB] = variant_double(spatial.vSpeed);
+ }
}
- }
return Position;
}
@@ -244,17 +237,20 @@ std::map< uint16_t, ::DBus::Variant > EnhancedPosition::GetTime()
return Time;
}
-void EnhancedPosition::cbPosition(const TGNSSPosition pos[], uint16_t numElements)
+void EnhancedPosition::sigPositionUpdate(const TGNSSSpatial spatial[], uint16_t numElements)
{
bool latChanged = false;
bool lonChanged = false;
bool altChanged = false;
-
+ bool speedChanged = false;
+ bool headingChanged = false;
+ bool climbChanged = false;
+
std::vector< uint16_t > position;
- if (pos == NULL || numElements < 1)
+ if (spatial == NULL || numElements < 1)
{
- LOG_ERROR_MSG(gCtx,"cbPosition failed!");
+ LOG_ERROR_MSG(gCtx,"sigPositionUpdate failed!");
return;
}
@@ -263,23 +259,38 @@ void EnhancedPosition::cbPosition(const TGNSSPosition pos[], uint16_t numElement
LOG_INFO(gCtx,"Position Update[%d/%d]: lat=%f lon=%f alt=%f",
i+1,
numElements,
- pos[i].latitude,
- pos[i].longitude,
- pos[i].altitude);
+ spatial[i].latitude,
+ spatial[i].longitude,
+ spatial[i].altitudeMSL);
if (latChanged == false)
{
- latChanged = (pos[i].validityBits && GNSS_POSITION_LATITUDE_VALID);
+ latChanged = (spatial[i].validityBits & GNSS_SPATIAL_LATITUDE_VALID);
}
if (lonChanged == false)
{
- lonChanged = (pos[i].validityBits && GNSS_POSITION_LONGITUDE_VALID);
+ lonChanged = (spatial[i].validityBits & GNSS_SPATIAL_LONGITUDE_VALID);
}
if (altChanged == false)
{
- altChanged = (pos[i].validityBits && GNSS_POSITION_ALTITUDE_VALID);
+ altChanged = (spatial[i].validityBits & GNSS_SPATIAL_ALTITUDEMSL_VALID);
+ }
+
+ if (speedChanged == false)
+ {
+ speedChanged = (spatial[i].validityBits & GNSS_SPATIAL_HSPEED_VALID);
+ }
+
+ if (headingChanged == false)
+ {
+ headingChanged = (spatial[i].validityBits & GNSS_SPATIAL_HEADING_VALID);
+ }
+
+ if (climbChanged == false)
+ {
+ climbChanged = (spatial[i].validityBits & GNSS_SPATIAL_VSPEED_VALID);
}
}
@@ -306,6 +317,21 @@ void EnhancedPosition::cbPosition(const TGNSSPosition pos[], uint16_t numElement
it = changedValues.insert(it,POS_ALTITUDE);
}
+ if (speedChanged)
+ {
+ it = changedValues.insert(it,POS_SPEED);
+ }
+
+ if (headingChanged)
+ {
+ it = changedValues.insert(it,POS_HEADING);
+ }
+
+ if (climbChanged)
+ {
+ it = changedValues.insert(it,POS_CLIMB);
+ }
+
if (!mpSelf)
{
LOG_ERROR_MSG(gCtx,"Null pointer!");
@@ -314,182 +340,202 @@ void EnhancedPosition::cbPosition(const TGNSSPosition pos[], uint16_t numElement
//notify clients
mpSelf->PositionUpdate(changedValues);
+
+
}
-void EnhancedPosition::cbCourse(const TGNSSCourse course[], uint16_t numElements)
-{
- bool speedChanged = false;
- bool headingChanged = false;
- bool climbChanged = false;
-
- if (course == NULL || numElements < 1)
+void EnhancedPosition::sigAccuracyUpdate(const TGNSSSpatial spatial[], uint16_t numElements)
+{
+ bool pdopChanged = false;
+ bool hdopChanged = false;
+ bool vdopChanged = false;
+ bool sigmaHPosChanged = false;
+ bool sigmaAltitudeChanged = false;
+
+ if (spatial == NULL || numElements < 1)
{
- LOG_ERROR_MSG(gCtx,"cbCourse failed!");
- return;
+ LOG_ERROR_MSG(gCtx,"sigAccuracyUpdate failed!");
+ return;
}
- for (int i = 0; i < numElements; i++)
+ for (int i = 0; i< numElements; i++)
{
- LOG_INFO(gCtx,"Course Update[%d/%d]: speed=%f heading=%f climb=%f",
- i+1,
- numElements,
- course[i].speed,
- course[i].heading,
- course[i].climb);
+ LOG_INFO(gCtx,"Accuracy Update[%d/%d]: pdop=%f hdop=%f vdop=%f \
+ sigmaHPosition=%f sigmaAltitude=%f",
+ i+1,
+ numElements,
+ spatial[i].pdop,
+ spatial[i].hdop,
+ spatial[i].vdop,
+ spatial[i].sigmaHPosition,
+ spatial[i].sigmaAltitude);
- if (speedChanged == false)
+ if (pdopChanged == false)
{
- speedChanged = (course[i].validityBits && GNSS_COURSE_SPEED_VALID);
+ pdopChanged = (spatial[i].validityBits & GNSS_SPATIAL_PDOP_VALID);
}
- if (headingChanged == false)
+ if (hdopChanged == false)
{
- headingChanged = (course[i].validityBits && GNSS_COURSE_HEADING_VALID);
+ hdopChanged = (spatial[i].validityBits & GNSS_SPATIAL_HDOP_VALID);
}
- if (climbChanged == false)
+ if (vdopChanged == false)
+ {
+ vdopChanged = (spatial[i].validityBits & GNSS_SPATIAL_VDOP_VALID);
+ }
+
+ if (sigmaHPosChanged == false)
{
- climbChanged = (course[i].validityBits && GNSS_COURSE_CLIMB_VALID);
+ sigmaHPosChanged = (spatial[i].validityBits & GNSS_SPATIAL_SHPOS_VALID);
+ }
+
+ if (sigmaAltitudeChanged == false)
+ {
+ sigmaAltitudeChanged = (spatial[i].validityBits & GNSS_SPATIAL_SALT_VALID);
}
}
- //in a real product, the course would be used for dead-reckoning.
+ //in a real product, the accuracy would be used for dead-reckoning.
//in this proof of concept, the client application is simply notified
- //about changes of speed, heading and/or climb
- std::vector< uint16_t > changedValues;
+ //about accuracy changes
std::vector<uint16_t>::iterator it;
- it = changedValues.begin();
-
- if (speedChanged)
+
+ std::vector< uint16_t > changedAccuracyValues;
+ it = changedAccuracyValues.begin();
+
+ if (pdopChanged)
{
- it = changedValues.insert(it,POS_SPEED);
+ it = changedAccuracyValues.insert(it,POS_PDOP);
}
- if (headingChanged)
+ if (hdopChanged)
{
- it = changedValues.insert(it,POS_HEADING);
+ it = changedAccuracyValues.insert(it,POS_HDOP);
}
+
+ if (vdopChanged)
+ {
+ it = changedAccuracyValues.insert(it,POS_VDOP);
+ }
- if (climbChanged)
+ if (sigmaHPosChanged)
{
- it = changedValues.insert(it,POS_CLIMB);
+ it = changedAccuracyValues.insert(it,POS_SIGMA_LATITUDE);
+ it = changedAccuracyValues.insert(it,POS_SIGMA_LONGITUDE);
}
+ if (sigmaAltitudeChanged)
+ {
+ it = changedAccuracyValues.insert(it,POS_VISIBLE_SATELLITES);
+ }
+
+ //todo: handle other field-changes here (accuracy and status)
+
if (!mpSelf)
{
LOG_ERROR_MSG(gCtx,"Null pointer!");
return;
}
-
- //notify clients
- mpSelf->PositionUpdate(changedValues);
+
+ mpSelf->AccuracyUpdate(changedAccuracyValues);
}
-void EnhancedPosition::cbAccuracy(const TGNSSAccuracy accuracy[], uint16_t numElements)
+void EnhancedPosition::sigStatusUpdate(const TGNSSSpatial spatial[], uint16_t numElements)
{
- //satellite info
- bool usedSatellitesChanged = false;
- bool trackedSatellitesChanged = false;
- bool visibleSatellitesChanged = false;
-
- //status
+
bool fixStatusChanged = false;
bool fixTypeBitsChanged = false;
-
- //accuracy
- bool pdopChanged = false;
- bool hdopChanged = false;
- bool vdopChanged = false;
- bool sigmaLatitudeChanged = false;
- bool sigmaLongitudeChanged = false;
- bool sigmaAltitudeChanged = false;
- if (accuracy == NULL || numElements < 1)
+ if (spatial == NULL || numElements < 1)
{
- LOG_ERROR_MSG(gCtx,"cbAccuracy failed!");
+ LOG_ERROR_MSG(gCtx,"sigStatusUpdate failed!");
return;
}
for (int i = 0; i< numElements; i++)
{
- LOG_INFO(gCtx,"Accuracy Update[%d/%d]: usedSatellites=%d trackedSatellites=%d visibleSatellites=%d",
+ LOG_INFO(gCtx,"Status Update[%d/%d]: fixStatus=%d fixTypeBits=0x%08X",
i+1,
numElements,
- accuracy[i].usedSatellites,
- accuracy[i].trackedSatellites,
- accuracy[i].visibleSatellites);
-
- LOG_INFO(gCtx,"Accuracy Update[%d/%d]: fixStatus=%d fixTypeBits=0x%08X",
- i+1,
- numElements,
- accuracy[i].fixStatus,
- accuracy[i].fixTypeBits);
-
- LOG_INFO(gCtx,"Accuracy Update[%d/%d]: pdop=%f hdop=%f vdop=%f \
- sigmaLatitude=%f sigmaLongitude=%f sigmaAltitude=%f",
- i+1,
- numElements,
- accuracy[i].pdop,
- accuracy[i].hdop,
- accuracy[i].vdop,
- accuracy[i].sigmaLatitude,
- accuracy[i].sigmaLongitude,
- accuracy[i].sigmaAltitude);
-
- if (usedSatellitesChanged == false)
+ spatial[i].fixStatus,
+ spatial[i].fixTypeBits);
+
+ if (fixStatusChanged == false)
{
- usedSatellitesChanged = (accuracy[i].validityBits && GNSS_ACCURACY_USAT_VALID);
+ fixStatusChanged = (spatial[i].validityBits & GNSS_SPATIAL_STAT_VALID);
}
- if (trackedSatellitesChanged == false)
+ if (fixTypeBitsChanged == false)
{
- trackedSatellitesChanged = (accuracy[i].validityBits && GNSS_ACCURACY_TSAT_VALID);
+ fixTypeBitsChanged = (spatial[i].validityBits & GNSS_SPATIAL_TYPE_VALID);
}
- if (visibleSatellitesChanged == false)
- {
- visibleSatellitesChanged = (accuracy[i].validityBits && GNSS_ACCURACY_VSAT_VALID);
- }
+ }
- if (fixStatusChanged == false)
- {
- fixStatusChanged = (accuracy[i].validityBits && GNSS_ACCURACY_STAT_VALID);
- }
-
- if (fixTypeBitsChanged == false)
- {
- fixTypeBitsChanged = (accuracy[i].validityBits && GNSS_ACCURACY_TYPE_VALID);
- }
+ //in a real product, the accuracy would be used for dead-reckoning.
+ //in this proof of concept, the client application is simply notified
+ //about status changes
+ std::vector<uint16_t>::iterator it;
+
+ std::vector< uint16_t > changedStatusValues;
+ it = changedStatusValues.begin();
- if (pdopChanged == false)
- {
- pdopChanged = (accuracy[i].validityBits && GNSS_ACCURACY_PDOP_VALID);
- }
+ if (fixStatusChanged)
+ {
+ it = changedStatusValues.insert(it,POS_GNSS_FIX_STATUS);
+ }
- if (hdopChanged == false)
- {
- hdopChanged = (accuracy[i].validityBits && GNSS_ACCURACY_HDOP_VALID);
- }
+ if (!mpSelf)
+ {
+ LOG_ERROR_MSG(gCtx,"Null pointer!");
+ return;
+ }
+
+ mpSelf->StatusUpdate(changedStatusValues);
+}
- if (vdopChanged == false)
- {
- vdopChanged = (accuracy[i].validityBits && GNSS_ACCURACY_VDOP_VALID);
- }
- if (sigmaLatitudeChanged == false)
+
+void EnhancedPosition::sigSatelliteInfoUpdate(const TGNSSSpatial spatial[], uint16_t numElements)
+{
+ //satellite info
+ bool usedSatellitesChanged = false;
+ bool trackedSatellitesChanged = false;
+ bool visibleSatellitesChanged = false;
+
+
+
+ if (spatial == NULL || numElements < 1)
+ {
+ LOG_ERROR_MSG(gCtx,"sigSatelliteInfoUpdate failed!");
+ return;
+ }
+
+ for (int i = 0; i< numElements; i++)
+ {
+ LOG_INFO(gCtx,"SatelliteInfo Update[%d/%d]: usedSatellites=%d trackedSatellites=%d visibleSatellites=%d",
+ i+1,
+ numElements,
+ spatial[i].usedSatellites,
+ spatial[i].trackedSatellites,
+ spatial[i].visibleSatellites);
+
+ if (usedSatellitesChanged == false)
{
- sigmaLatitudeChanged = (accuracy[i].validityBits && GNSS_ACCURACY_SLAT_VALID);
+ usedSatellitesChanged = (spatial[i].validityBits & GNSS_SPATIAL_USAT_VALID);
}
- if (sigmaLongitudeChanged == false)
+ if (trackedSatellitesChanged == false)
{
- sigmaLongitudeChanged = (accuracy[i].validityBits && GNSS_ACCURACY_SLON_VALID);
+ trackedSatellitesChanged = (spatial[i].validityBits & GNSS_SPATIAL_TSAT_VALID);
}
- if (sigmaAltitudeChanged == false)
+ if (visibleSatellitesChanged == false)
{
- sigmaAltitudeChanged = (accuracy[i].validityBits && GNSS_ACCURACY_SALT_VALID);
+ visibleSatellitesChanged = (spatial[i].validityBits & GNSS_SPATIAL_VSAT_VALID);
}
+
}
//in a real product, the accuracy would be used for dead-reckoning.
@@ -525,11 +571,17 @@ void EnhancedPosition::cbAccuracy(const TGNSSAccuracy accuracy[], uint16_t numEl
mpSelf->SatelliteInfoUpdate(changedSatelliteInfoValues);
- //todo: send other notifications
- //mpSelf->AccuracyUpdate(changedAccuracyValues);
- //mpSelf->StatusUpdate(changedStatusValues);
}
+void EnhancedPosition::cbSpatial(const TGNSSSpatial spatial[], uint16_t numElements)
+{
+ sigPositionUpdate(spatial, numElements);
+ sigAccuracyUpdate(spatial, numElements);
+ sigStatusUpdate(spatial, numElements);
+ sigSatelliteInfoUpdate(spatial, numElements);
+}
+
+
void EnhancedPosition::cbSatelliteDetail(const TGNSSSatelliteDetail satelliteDetail[], uint16_t numElements)
{
if (satelliteDetail == NULL || numElements < 1)
@@ -589,16 +641,14 @@ void EnhancedPosition::run()
exit(EXIT_FAILURE);
}
- if(!gnssSimpleInit())
+ if(!gnssExtendedInit())
{
exit(EXIT_FAILURE);
}
LOG_INFO_MSG(gCtx,"Starting EnhancedPosition dispatcher...");
- gnssSimpleRegisterPositionCallback(&cbPosition);
- gnssSimpleRegisterCourseCallback(&cbCourse);
- gnssExtendedRegisterAccuracyCallback(&cbAccuracy);
+ gnssExtendedRegisterSpatialCallback(&cbSpatial);
gnssExtendedRegisterSatelliteDetailCallback(&cbSatelliteDetail);
}
@@ -606,11 +656,9 @@ void EnhancedPosition::shutdown()
{
LOG_INFO_MSG(gCtx,"Shutting down EnhancedPosition dispatcher...");
- gnssSimpleDeregisterPositionCallback(&cbPosition);
- gnssSimpleDeregisterCourseCallback(&cbCourse);
- gnssExtendedDeregisterAccuracyCallback(&cbAccuracy);
+ gnssExtendedDeregisterSpatialCallback(&cbSpatial);
gnssExtendedDeregisterSatelliteDetailCallback(&cbSatelliteDetail);
- gnssSimpleDestroy();
+ gnssExtendedDestroy();
gnssDestroy();
}
diff --git a/enhanced-position-service/src/enhanced-position.h b/enhanced-position-service/src/enhanced-position.h
index af76a98..ed24641 100644
--- a/enhanced-position-service/src/enhanced-position.h
+++ b/enhanced-position-service/src/enhanced-position.h
@@ -22,7 +22,6 @@
#include "enhanced-position-adaptor.h"
#include "gnss.h"
-#include "gnss-simple.h"
#include "gnss-ext.h"
class EnhancedPosition
@@ -62,11 +61,14 @@ private:
static void cbSatelliteDetail(const TGNSSSatelliteDetail satelliteDetail[], uint16_t numElements);
- static void cbAccuracy(const TGNSSAccuracy accuracy[], uint16_t numElements);
-
- static void cbCourse(const TGNSSCourse course[], uint16_t numElements);
-
- static void cbPosition(const TGNSSPosition pos[], uint16_t numElements);
+ static void cbSpatial(const TGNSSSpatial spatial[], uint16_t numElements);
+ static void sigPositionUpdate(const TGNSSSpatial spatial[], uint16_t numElements);
+ static void sigAccuracyUpdate(const TGNSSSpatial spatial[], uint16_t numElements);
+ static void sigStatusUpdate(const TGNSSSpatial spatial[], uint16_t numElements);
+ static void sigSatelliteInfoUpdate(const TGNSSSpatial spatial[], uint16_t numElements);
+
+
+
static EnhancedPosition* mpSelf;
};
diff --git a/gnss-service/api/gnss-ext.h b/gnss-service/api/gnss-ext.h
index a7c5db4..500ef1e 100644
--- a/gnss-service/api/gnss-ext.h
+++ b/gnss-service/api/gnss-ext.h
@@ -36,24 +36,6 @@ typedef struct {
} TGNSSDistance3D;
/**
- * TGNSSAccuracy::validityBits provides information about the currently valid signals of the GNSS accuracy data.
- * It is a or'ed bitmask of the EGNSSAccuracyValidityBits values.
- */
-typedef enum {
- GNSS_ACCURACY_PDOP_VALID = 0x00000001, /**< Validity bit for field TGNSSAccuracy::pdop. */
- GNSS_ACCURACY_HDOP_VALID = 0x00000002, /**< Validity bit for field TGNSSAccuracy::hdop. */
- GNSS_ACCURACY_VDOP_VALID = 0x00000004, /**< Validity bit for field TGNSSAccuracy::vdop. */
- GNSS_ACCURACY_USAT_VALID = 0x00000008, /**< Validity bit for field TGNSSAccuracy::usedSatellites. */
- GNSS_ACCURACY_TSAT_VALID = 0x00000010, /**< Validity bit for field TGNSSAccuracy::trackedSatellites. */
- GNSS_ACCURACY_VSAT_VALID = 0x00000020, /**< Validity bit for field TGNSSAccuracy::visibleSatellites. */
- GNSS_ACCURACY_SLAT_VALID = 0x00000040, /**< Validity bit for field TGNSSAccuracy::sigmaLatitude. */
- GNSS_ACCURACY_SLON_VALID = 0x00000080, /**< Validity bit for field TGNSSAccuracy::sigmaLongitude. */
- GNSS_ACCURACY_SALT_VALID = 0x00000100, /**< Validity bit for field TGNSSAccuracy::sigmaAltitude. */
- GNSS_ACCURACY_STAT_VALID = 0x00000200, /**< Validity bit for field TGNSSAccuracy::fixStatus. */
- GNSS_ACCURACY_TYPE_VALID = 0x00000400, /**< Validity bit for field TGNSSAccuracy::fixTypeBits. */
-} EGNSSAccuracyValidityBits;
-
-/**
* Description of the fix status of the GNSS reveiver.
*/
typedef enum {
@@ -107,63 +89,14 @@ typedef enum {
} EGNSSFixType;
/**
- * Accuracy and status information about the GNSS position.
- * This data structure provides accuracy information. Either the directly from most GNSS receivers
- * available DOP information or if available the error expressed in sigmas for the different axis.
- */
-typedef struct {
- uint64_t timestamp; /**< Timestamp of the acquisition of the accuracy data. */
- float pdop; /**< The positional (3D) dilution of precision. */
- float hdop; /**< The horizontal (2D) dilution of precision. */
- float vdop; /**< The vertical (altitude) dilution of precision. */
- uint16_t usedSatellites; /**< Number of used satellites. */
- uint16_t trackedSatellites; /**< Number of tracked satellites. */
- uint16_t visibleSatellites; /**< Number of visible satellites. */
- float sigmaLatitude; /**< Standard error estimate of latitude in [m]. */
- float sigmaLongitude; /**< Standard error estimate of longitude in [m]. */
- float sigmaAltitude; /**< Standard error estimate of altitude in [m]. */
- EGNSSFixStatus fixStatus; /**< Value representing the GNSS mode. */
- uint32_t fixTypeBits; /**< Bit mask indicating the sources actually used for the GNSS calculation.
- [bitwise or'ed @ref EGNSSFixType values]. */
- uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSAccuracyValidityBits values].
- Must be checked before usage. */
-} TGNSSAccuracy;
-
-/**
- * TGNSSCourse3D::validityBits provides information about the currently valid signals of the GNSS course 3D data.
- * It is a or'ed bitmask of the EGNSSCourse3DValidityBits values.
- */
-typedef enum {
- GNSS_COURSE3D_SPEEDLAT_VALID = 0x00000001, /**< Validity bit for field TGNSSCourse3D::speedLatitude. */
- GNSS_COURSE3D_SPEEDLON_VALID = 0x00000002, /**< Validity bit for field TGNSSCourse3D::speedLongitude. */
- GNSS_COURSE3D_SPEEDALT_VALID = 0x00000004, /**< Validity bit for field TGNSSCourse3D::speedAltitude. */
-} EGNSSCourse3DValidityBits;
-
-/**
- * Course 3D is an extension to the normal course information provided by the GNSS service.
- * The course information is given for each axis seperately.
- */
-typedef struct {
- uint64_t timestamp; /**< Timestamp of the acquisition of the accuracy data. */
- float speedLatitude; /**< Speed in direction of latitude in [m/s]. */
- float speedLongitude; /**< Speed in direction of longitude in [m/s]. */
- float speedAltitude; /**< Speed in direction of altitude in [m/s]. */
- uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSCourse3DValidityBits values].
- Must be checked before usage. */
-} TGNSSCourse3D;
-
-
-/**
- * TGNSSUTC::validityBits provides information about the currently valid parts of UTC date/time.
+ * TGNSSTime::validityBits provides information about the currently valid parts of UTC date/time.
* It is a or'ed bitmask of the EGNSSUTCValidityBits values.
* There are separate validity bits for date end time since a GPS receiver may be able to provide time earlier than date.
*/
typedef enum {
- GNSS_UTC_TIME_VALID = 0x00000001, /**< Validity bit for field TGNSSUTC fields hour, minute, second, ms. */
- GNSS_UTC_DATE_VALID = 0x00000002, /**< Validity bit for field TGNSSUTC fields year, month, day. */
-} EGNSSUTCValidityBits;
+ GNSS_TIME_TIME_VALID = 0x00000001, /**< Validity bit for field TGNSSTime fields hour, minute, second, ms. */
+ GNSS_TIME_DATE_VALID = 0x00000002, /**< Validity bit for field TGNSSTime fields year, month, day. */
+} EGNSSTimeValidityBits;
/**
* Provides the current date and time according UTC (Coordinated Universal Time)
@@ -180,9 +113,9 @@ typedef struct {
In case of a leap second this value is 60. */
uint16_t ms; /**< Millisecond fraction of the UTC time. Unit: [milliseconds] Number between 0 and 999 */
uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSCourse3DValidityBits values].
+ [bitwise or'ed @ref EGNSSTimeValidityBits values].
Must be checked before usage. */
-} TGNSSUTC;
+} TGNSSTime;
/**
* Enumeration to describe the type of GNSS system to which a particular GNSS satellite belongs.
@@ -250,41 +183,41 @@ typedef struct {
} TGNSSSatelliteDetail;
/**
- * TGNSSLocation::validityBits provides information about the currently valid signals
+ * TGNSSSpatial::validityBits provides information about the currently valid signals
* of the GNSS position and velocity including status and accuracy data.
* It is a or'ed bitmask of the EGNSSLocationValidityBits values.
*/
typedef enum {
//position
- GNSS_LOCATION_LATITUDE_VALID = 0x00000001, /**< Validity bit for field TGNSSLocation::latitude. */
- GNSS_LOCATION_LONGITUDE_VALID = 0x00000002, /**< Validity bit for field TGNSSLocation::longitude. */
- GNSS_LOCATION_ALTITUDEMSL_VALID = 0x00000004, /**< Validity bit for field TGNSSLocation::altitudeMSL. */
- GNSS_LOCATION_ALTITUDEELL_VALID = 0x00000008, /**< Validity bit for field TGNSSLocation::altitudeEll. */
+ GNSS_SPATIAL_LATITUDE_VALID = 0x00000001, /**< Validity bit for field TGNSSSpatial::latitude. */
+ GNSS_SPATIAL_LONGITUDE_VALID = 0x00000002, /**< Validity bit for field TGNSSSpatial::longitude. */
+ GNSS_SPATIAL_ALTITUDEMSL_VALID = 0x00000004, /**< Validity bit for field TGNSSSpatial::altitudeMSL. */
+ GNSS_SPATIAL_ALTITUDEELL_VALID = 0x00000008, /**< Validity bit for field TGNSSSpatial::altitudeEll. */
//velocity
- GNSS_LOCATION_HSPEED_VALID = 0x00000010, /**< Validity bit for field TGNSSLocation::hSpeed. */
- GNSS_LOCATION_VSPEED_VALID = 0x00000020, /**< Validity bit for field TGNSSLocation::vSpeed. */
- GNSS_LOCATION_HEADING_VALID = 0x00000040, /**< Validity bit for field TGNSSLocation::heading. */
+ GNSS_SPATIAL_HSPEED_VALID = 0x00000010, /**< Validity bit for field TGNSSSpatial::hSpeed. */
+ GNSS_SPATIAL_VSPEED_VALID = 0x00000020, /**< Validity bit for field TGNSSSpatial::vSpeed. */
+ GNSS_SPATIAL_HEADING_VALID = 0x00000040, /**< Validity bit for field TGNSSSpatial::heading. */
//quality parameters: satellite constellation
- GNSS_LOCATION_PDOP_VALID = 0x00000080, /**< Validity bit for field TGNSSLocation::pdop. */
- GNSS_LOCATION_HDOP_VALID = 0x00000100, /**< Validity bit for field TGNSSLocation::hdop. */
- GNSS_LOCATION_VDOP_VALID = 0x00000200, /**< Validity bit for field TGNSSLocation::vdop. */
+ GNSS_SPATIAL_PDOP_VALID = 0x00000080, /**< Validity bit for field TGNSSSpatial::pdop. */
+ GNSS_SPATIAL_HDOP_VALID = 0x00000100, /**< Validity bit for field TGNSSSpatial::hdop. */
+ GNSS_SPATIAL_VDOP_VALID = 0x00000200, /**< Validity bit for field TGNSSSpatial::vdop. */
- GNSS_LOCATION_USAT_VALID = 0x00000400, /**< Validity bit for field TGNSSLocation::usedSatellites. */
- GNSS_LOCATION_TSAT_VALID = 0x00000800, /**< Validity bit for field TGNSSLocation::trackedSatellites. */
- GNSS_LOCATION_VSAT_VALID = 0x00001000, /**< Validity bit for field TGNSSLocation::visibleSatellites. */
+ GNSS_SPATIAL_USAT_VALID = 0x00000400, /**< Validity bit for field TGNSSSpatial::usedSatellites. */
+ GNSS_SPATIAL_TSAT_VALID = 0x00000800, /**< Validity bit for field TGNSSSpatial::trackedSatellites. */
+ GNSS_SPATIAL_VSAT_VALID = 0x00001000, /**< Validity bit for field TGNSSSpatial::visibleSatellites. */
//quality parameters: error estimates
- GNSS_LOCATION_SHPOS_VALID = 0x00002000, /**< Validity bit for field TGNSSLocation::sigmaHPosition. */
- GNSS_LOCATION_SALT_VALID = 0x00004000, /**< Validity bit for field TGNSSLocation::sigmaAltitude. */
- GNSS_LOCATION_SHSPEED_VALID = 0x00008000, /**< Validity bit for field TGNSSLocation::sigmaHSpeed. */
- GNSS_LOCATION_SVSPEED_VALID = 0x00010000, /**< Validity bit for field TGNSSLocation::sigmaVSpeed. */
- GNSS_LOCATION_SHEADING_VALID = 0x00020000, /**< Validity bit for field TGNSSLocation::sigmaHeading. */
+ GNSS_SPATIAL_SHPOS_VALID = 0x00002000, /**< Validity bit for field TGNSSSpatial::sigmaHPosition. */
+ GNSS_SPATIAL_SALT_VALID = 0x00004000, /**< Validity bit for field TGNSSSpatial::sigmaAltitude. */
+ GNSS_SPATIAL_SHSPEED_VALID = 0x00008000, /**< Validity bit for field TGNSSSpatial::sigmaHSpeed. */
+ GNSS_SPATIAL_SVSPEED_VALID = 0x00010000, /**< Validity bit for field TGNSSSpatial::sigmaVSpeed. */
+ GNSS_SPATIAL_SHEADING_VALID = 0x00020000, /**< Validity bit for field TGNSSSpatial::sigmaHeading. */
//quality parameters: overall GNSS fix status
- GNSS_LOCATION_STAT_VALID = 0x00040000, /**< Validity bit for field TGNSSLocation::fixStatus. */
- GNSS_LOCATION_TYPE_VALID = 0x00080000, /**< Validity bit for field TGNSSLocation::fixTypeBits. */
-} EGNSSLocationValidityBits;
+ GNSS_SPATIAL_STAT_VALID = 0x00040000, /**< Validity bit for field TGNSSSpatial::fixStatus. */
+ GNSS_SPATIAL_TYPE_VALID = 0x00080000, /**< Validity bit for field TGNSSSpatial::fixTypeBits. */
+} EGNSSSpatialValidityBits;
/**
- * GNSS location, i.e. position and velocity including status and accuracy.
+ * GNSS spatial data: position and velocity including status and accuracy.
* This data structure provides all GNSS information which is typically needed
* for positioning applications such as GNSS/Dead Reckoning sensor fusion.
*/
@@ -318,34 +251,11 @@ typedef struct {
[bitwise or'ed @ref EGNSSFixType values]. */
uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSLocationValidityBits values].
+ [bitwise or'ed @ref EGNSSSpatialValidityBits values].
Must be checked before usage. */
-} TGNSSLocation;
-
+} TGNSSSpatial;
-/**
- * Callback type for extended GNSS accuracy.
- * Use this type of callback if you want to register for extended GNSS accuracy data.
- * This callback may return buffered data (numElements >1) for different reasons
- * for (large) portions of data buffered at startup
- * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
- * If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param accuracy pointer to an array of TGNSSAccuracy with size numElements
- * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
- */
-typedef void (*GNSSAccuracyCallback)(const TGNSSAccuracy accuracy[], uint16_t numElements);
-/**
- * Callback type for extended GNSS 3D course.
- * Use this type of callback if you want to register for extended GNSS 3D course data.
- * This callback may return buffered data (numElements >1) for different reasons
- * for (large) portions of data buffered at startup
- * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
- * If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param course pointer to an array of TGNSSCourse3D with size numElements
- * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
- */
-typedef void (*GNSSCourse3DCallback)(const TGNSSCourse3D course[], uint16_t numElements);
/**
* Callback type for extended GNSS UTC date and time.
@@ -354,10 +264,10 @@ typedef void (*GNSSCourse3DCallback)(const TGNSSCourse3D course[], uint16_t numE
* for (large) portions of data buffered at startup
* for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
* If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param time pointer to an array of TGNSSUTC with size numElements
+ * @param time pointer to an array of TGNSSTime with size numElements
* @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
*/
-typedef void (*GNSSUTCCallback)(const TGNSSUTC time[], uint16_t numElements);
+typedef void (*GNSSTimeCallback)(const TGNSSTime time[], uint16_t numElements);
/**
* Callback type for GNSS satellite details.
@@ -372,16 +282,16 @@ typedef void (*GNSSUTCCallback)(const TGNSSUTC time[], uint16_t numElements);
typedef void (*GNSSSatelliteDetailCallback)(const TGNSSSatelliteDetail satelliteDetail[], uint16_t numElements);
/**
- * Callback type for GNSS position, velocity, accuracy.
- * Use this type of callback if you want to register for GNSS position, velocity, accuracy.
+ * Callback type for GNSS spatial data: position and velocity including status and accuracy
+ * Use this type of callback if you want to register for GNSS spatial data.
* This callback may return buffered data (numElements >1) for different reasons
* for (large) portions of data buffered at startup
* for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
* If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param time pointer to an array of TGNSSLocation with size numElements
+ * @param time pointer to an array of TGNSSSpatial with size numElements
* @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
*/
-typedef void (*GNSSLocationCallback)(const TGNSSLocation location[], uint16_t numElements);
+typedef void (*GNSSSpatialCallback)(const TGNSSSpatial location[], uint16_t numElements);
/**
* Initialization of the extended GNSS service.
@@ -418,65 +328,12 @@ bool gnssExtendedGetMetaData(TGnssMetaData *data);
bool gnssExtendedGetAntennaPosition(TGNSSDistance3D *distance);
/**
- * Method to get the accuracy data at a specific point in time.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param accuracy After calling the method the currently available GNSS accuracy data is written into this parameter.
- * @return Is true if data can be provided and false otherwise, e.g. missing initialization
- */
-bool gnssExtendedGetAccuracy(TGNSSAccuracy *accuracy);
-
-/**
- * Register GNSS accuracy callback.
- * This is the recommended method for continuously accessing the accuracy data.
- * The callback will be invoked when new accuracy data is available from the GNSS receiver.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param callback The callback which should be registered.
- * @return True if callback has been registered successfully.
- */
-bool gnssExtendedRegisterAccuracyCallback(GNSSAccuracyCallback callback);
-
-/**
- * Deregister extended GNSS accuracy callback.
- * After calling this method no new GNSS accuracy data will be delivered to the client.
- * @param callback The callback which should be deregistered.
- * @return True if callback has been deregistered successfully.
- */
-bool gnssExtendedDeregisterAccuracyCallback(GNSSAccuracyCallback callback);
-
-/**
- * Method to get the extended 3D course data at a specific point in time.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param course After calling the method the currently available GNSS 3D course data is written into this parameter.
- * @return Is true if data can be provided and false otherwise, e.g. missing initialization
- */
-bool gnssExtendedGet3DCourse(TGNSSCourse3D *course);
-
-/**
- * Register extended GNSS 3D course callback.
- * This is the recommended method for continuously accessing the 3D course data.
- * The callback will be invoked when new course data is available from the GNSS receiver.
- * It is intended to extend the GNSS course information by data split into each axis.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param callback The callback which should be registered.
- * @return True if callback has been registered successfully.
- */
-bool gnssExtendedRegister3DCourseCallback(GNSSCourse3DCallback callback);
-
-/**
- * Deregister extended GNSS 3D course callback.
- * After calling this method no new GNSS 3D course data will be delivered to the client.
- * @param callback The callback which should be deregistered.
- * @return True if callback has been deregistered successfully.
- */
-bool gnssExtendedDeregister3DCourseCallback(GNSSCourse3DCallback callback);
-
-/**
* Method to get the UTC date / time data of the GNSS receiver at a specific point in time.
* The valid flag is updated. The data is only guaranteed to be updated when the valid flag is true.
* @param time After calling the method the current GNSS UTC date / time is written into this parameter.
* @return Is true if data can be provided and false otherwise, e.g. missing initialization
*/
-bool gnssExtendedGetUTC(TGNSSUTC *utc);
+bool gnssExtendedGetTime(TGNSSTime *utc);
/**
* Register extended GNSS UTC time callback.
@@ -485,7 +342,7 @@ bool gnssExtendedGetUTC(TGNSSUTC *utc);
* @param callback The callback which should be registered.
* @return True if callback has been registered successfully.
*/
-bool gnssExtendedRegisterUTCCallback(GNSSUTCCallback callback);
+bool gnssExtendedRegisterTimeCallback(GNSSTimeCallback callback);
/**
* Deregister extended GNSS UTC time callback.
@@ -493,7 +350,7 @@ bool gnssExtendedRegisterUTCCallback(GNSSUTCCallback callback);
* @param callback The callback which should be deregistered.
* @return True if callback has been deregistered successfully.
*/
-bool gnssExtendedDeregisterUTCCallback(GNSSUTCCallback callback);
+bool gnssExtendedDeregisterTimeCallback(GNSSTimeCallback callback);
/**
* Method to get the GNSS satellite details at a specific point in time.
@@ -523,29 +380,29 @@ bool gnssExtendedRegisterSatelliteDetailCallback(GNSSSatelliteDetailCallback cal
bool gnssExtendedDeregisterSatelliteDetailCallback(GNSSSatelliteDetailCallback callback);
/**
- * Method to get the GNSS position, velocity, accuracy at a specific point in time.
+ * Method to get the GNSS spatial data (position, velocity, accuracy) at a specific point in time.
* All valid flags are updated. The data is only guaranteed to be updated when the valid flag is true.
* @param positionVelocityAccuracy After calling the method current GNSS position, velocity, accuracy are written into this parameter.
* @return Is true if data can be provided and false otherwise, e.g. missing initialization
*/
-bool gnssExtendedGetLocation(TGNSSLocation* location);
+bool gnssExtendedGetSpatial(TGNSSSpatial* spatial);
/**
- * Register GNSS position, velocity, accuracy callback.
- * The callback will be invoked when new date data is available from the GNSS receiver.
+ * Register GNSS spatial data (position, velocity, accuracy) callback.
+ * The callback will be invoked when new spatial data data is available from the GNSS receiver.
* The valid flags is updated. The data is only guaranteed to be updated when the valid flag is true.
* @param callback The callback which should be registered.
* @return True if callback has been registered successfully.
*/
-bool gnssExtendedRegisterLocationCallback(GNSSLocationCallback callback);
+bool gnssExtendedRegisterSpatialCallback(GNSSSpatialCallback callback);
/**
- * Deregister GNSS position, velocity, accuracy callback.
+ * Deregister GNSS spatial data (position, velocity, accuracy) callback.
* After calling this method no new data will be delivered to the client.
* @param callback The callback which should be deregistered.
* @return True if callback has been deregistered successfully.
*/
-bool gnssExtendedDeregisterLocationCallback(GNSSLocationCallback callback);
+bool gnssExtendedDeregisterSpatialCallback(GNSSSpatialCallback callback);
/**
diff --git a/gnss-service/api/gnss-simple.h b/gnss-service/api/gnss-simple.h
deleted file mode 100644
index c82d250..0000000
--- a/gnss-service/api/gnss-simple.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/**************************************************************************
- * @licence app begin@
- *
- * SPDX-License-Identifier: MPL-2.0
- *
- * \ingroup GNSSService
- * \brief Compliance Level: Abstract Component
- * \copyright Copyright (C) 2012, BMW Car IT GmbH, Continental Automotive GmbH, PCA Peugeot Citroën, XS Embedded GmbH
- *
- * \license
- * This Source Code Form is subject to the terms of the
- * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
- * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * @licence end@
- **************************************************************************/
-
-#ifndef INCLUDE_GENIVI_GNSS_SIMPLE
-#define INCLUDE_GENIVI_GNSS_SIMPLE
-
-#include "gnss-meta-data.h"
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Reference level for the GNSS altitude.
- */
-typedef enum {
- GNSS_ALTITUDE_UNKNOWN = 0, /**< Reference level is unknown. */
- GNSS_ALTITUDE_ELLIPSOIDE = 1, /**< Reference level is the WGS-84 ellopsoid. */
- GNSS_ALTITUDE_ABOVE_MEAN_SEA_LEVEL = 2 /**< Reference level is the geoid (mean sea level). */
-} EGNSSAltitudeType;
-
-/**
- * TGNSSSimpleConfiguration::validityBits provides information about the currently valid values of GNSS configuration data.
- * It is a or'ed bitmask of the EGNSSSimpleConfigurationValidityBits values.
- */
-typedef enum {
- GNSS_SIMPLE_CONFIG_ALTITUDE_TYPE_VALID = 0x00000001 /**< Validity bit for field TGNSSSimpleConfiguration::typeOfAltitude. */
-} EGNSSSimpleConfigurationValidityBits;
-
-/**
- * GNSS Simple Configuration Data.
- */
-typedef struct {
- EGNSSAltitudeType altitudeType; /**< Reference level for the GNSS altitude. */
- uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSSimpleConfigurationValidityBits values].
- Must be checked before usage. */
-} TGNSSSimpleConfiguration;
-
-/**
- * TGNSSPosition::validityBits provides information about the currently valid signals of the GNSS position data.
- * It is a or'ed bitmask of the EGNSSPositionValidityBits values.
- */
-typedef enum {
- GNSS_POSITION_LATITUDE_VALID = 0x00000001, /**< Validity bit for field TGNSSPosition::latitude. */
- GNSS_POSITION_LONGITUDE_VALID = 0x00000002, /**< Validity bit for field TGNSSPosition::longitude. */
- GNSS_POSITION_ALTITUDE_VALID = 0x00000004, /**< Validity bit for field TGNSSPosition::altitude. */
-} EGNSSPositionValidityBits;
-
-/**
- * Main position information.
- */
-typedef struct {
- uint64_t timestamp; /**< Timestamp of the acquisition of the position data. [ms] */
- double latitude; /**< Latitude in WGS84 in degrees. */
- double longitude; /**< Longitude in WGS84 in degrees. */
- float altitude; /**< Altitude in [m]. See TGNSSSimpleConfiguration.typeOfAltitude for reference level (ellipsoid or MSL). */
- uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSPositionValidityBits values].
- Must be checked before usage. */
-} TGNSSPosition;
-
-/**
- * TGNSSCourse::validityBits provides information about the currently valid signals of the GNSS course data.
- * It is a or'ed bitmask of the EGNSSCourseValidityBits values.
- */
-typedef enum {
- GNSS_COURSE_SPEED_VALID = 0x00000001, /**< Validity bit for field TGNSSCourse::speed. */
- GNSS_COURSE_CLIMB_VALID = 0x00000002, /**< Validity bit for field TGNSSCourse::climb. */
- GNSS_COURSE_HEADING_VALID = 0x00000004, /**< Validity bit for field TGNSSCourse::heading. */
-} EGNSSCourseValidityBits;
-
-/**
- * GNSS course provides information about the currently course of the receiver.
- * There is an extended service providing the speed for each axis seperately in GNSS-Extended.
- */
-typedef struct {
- uint64_t timestamp; /**< Timestamp of the acquisition of the GNSS course signal in [ms].
- To enable an accurate DR filtering a defined clock has to be used. */
- float speed; /**< Speed measured by the GPS receiver [m/s]. */
- float climb; /**< Incline / decline in degrees [degree]. */
- float heading; /**< GNSS course angle [degree] (0 => north, 90 => east, 180 => south, 270 => west, no negative values). */
- uint32_t validityBits; /**< Bit mask indicating the validity of each corresponding value.
- [bitwise or'ed @ref EGNSSCourseValidityBits values].
- Must be checked before usage. */
-} TGNSSCourse;
-
-/**
- * Callback type for GNSS position.
- * Use this type of callback if you want to register for GNSS position data.
- * This callback may return buffered data (numElements >1) for different reasons
- * for (large) portions of data buffered at startup
- * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
- * If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param pos pointer to an array of TGNSSPosition with size numElements
- * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
- */
-typedef void (*GNSSPositionCallback)(const TGNSSPosition pos[], uint16_t numElements);
-
-/**
- * Callback type for GNSS course.
- * Use this type of callback if you want to register for GNSS course data.
- * This callback may return buffered data (numElements >1) for different reasons
- * for (large) portions of data buffered at startup
- * for data buffered during regular operation e.g. for performance optimization (reduction of callback invocation frequency)
- * If the array contains (numElements >1), the elements will be ordered with rising timestamps
- * @param course pointer to an array of TGNSSCourse with size numElements
- * @param numElements: allowed range: >=1. If numElements >1, buffered data are provided.
- */
-typedef void (*GNSSCourseCallback)(const TGNSSCourse course[], uint16_t numElements);
-
-/**
- * Initialization of the GNSS service.
- * Must be called before using the GNSS service to set up the service.
- * @return True if initialization has been successfull.
- */
-bool gnssSimpleInit();
-
-/**
- * Destroy the GNSS service.
- * Must be called after using the GNSS service to shut down the service.
- * @return True if shutdown has been successfull.
- */
-bool gnssSimpleDestroy();
-
-/**
- * Accessing static configuration information about the GNSS sensor.
- * @param gnssConfig After calling the method the currently available GNSS configuration data is written into gnssConfig.
- * @return Is true if data can be provided and false otherwise, e.g. missing initialization
- */
-bool gnssSimpleGetConfiguration(TGNSSSimpleConfiguration* gnssConfig);
-
-/**
- * Provide meta information about GNSS service.
- * The meta data of a service provides information about it's name, version, type, subtype, sampling frequency etc.
- * @param data Meta data content about the sensor service.
- * @return True if meta data is available.
- */
-bool gnssSimpleGetMetaData(TGnssMetaData *data);
-
-/**
- * Method to get the GNSS position data at a specific point in time.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param pos After calling the method the currently available position data is written into this parameter.
- * @return Is true if data can be provided and false otherwise, e.g. missing initialization
- */
-bool gnssSimpleGetPosition(TGNSSPosition* pos);
-
-/**
- * Register GNSS position callback.
- * The callback will be invoked when new position data is available from the GNSS receiver.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param callback The callback which should be registered.
- * @return True if callback has been registered successfully.
- */
-bool gnssSimpleRegisterPositionCallback(GNSSPositionCallback callback);
-
-/**
- * Deregister GNSS Position callback.
- * After calling this method no new GNSS position data will be delivered to the client.
- * @param callback The callback which should be deregistered.
- * @return True if callback has been deregistered successfully.
- */
-bool gnssSimpleDeregisterPositionCallback(GNSSPositionCallback callback);
-
-/**
- * Method to get the GNSS course data at a specific point in time.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param course After calling the method the currently available position data is written into this parameter.
- * @return Is true if data can be provided and false otherwise, e.g. missing initialization
- */
-bool gnssSimpleGetCourse(TGNSSCourse* course);
-
-/**
- * Register GNSS course callback.
- * The callback will be invoked when new course data is available from the GNSS receiver.
- * All valid flags are updated. The data is only guaranteed to be updated when the valid flags are true.
- * @param callback The callback which should be registered.
- * @return True if callback has been registered successfully.
- */
-bool gnssSimpleRegisterCourseCallback(GNSSCourseCallback callback);
-
-/**
- * Deregister GNSS course callback.
- * After calling this method no new GNSS course data will be delivered to the client.
- * @param callback The callback which should be deregistered.
- * @return True if callback has been deregistered successfully.
- */
-bool gnssSimpleDeregisterCourseCallback(GNSSCourseCallback callback);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* INCLUDE_GENIVI_GNSS_SIMPLE */
diff --git a/gnss-service/src/CMakeLists.txt b/gnss-service/src/CMakeLists.txt
index 1c802fe..58887e9 100644
--- a/gnss-service/src/CMakeLists.txt
+++ b/gnss-service/src/CMakeLists.txt
@@ -40,7 +40,6 @@ if(WITH_GPSD)
pkg_check_modules(GPSD libgps>=2.94)
#generate library using gpsd as input
set(LIB_SRC_USE_GPSD ${CMAKE_SOURCE_DIR}/src/gnss-use-gpsd.c
- ${CMAKE_SOURCE_DIR}/src/gnss-simple.c
${CMAKE_SOURCE_DIR}/src/gnss-ext.c
${CMAKE_SOURCE_DIR}/src/gnss-meta-data.c)
add_library(gnss-service-use-gpsd SHARED ${LIB_SRC_USE_GPSD})
@@ -48,7 +47,6 @@ if(WITH_GPSD)
elseif(WITH_REPLAYER)
#generate library using replayer as input
set(LIB_SRC_USE_REPLAYER ${CMAKE_SOURCE_DIR}/src/gnss-use-replayer.c
- ${CMAKE_SOURCE_DIR}/src/gnss-simple.c
${CMAKE_SOURCE_DIR}/src/gnss-ext.c
${CMAKE_SOURCE_DIR}/src/gnss-meta-data.c)
add_library(gnss-service-use-replayer SHARED ${LIB_SRC_USE_REPLAYER})
diff --git a/gnss-service/src/globals.h b/gnss-service/src/globals.h
index 73d8ff6..ee25efe 100644
--- a/gnss-service/src/globals.h
+++ b/gnss-service/src/globals.h
@@ -24,28 +24,21 @@
#include <time.h>
#include "gnss.h"
-#include "gnss-simple.h"
#include "gnss-ext.h"
#include "gnss-meta-data.h"
extern pthread_mutex_t mutexCb;
extern pthread_mutex_t mutexData;
-extern TGNSSPosition gPosition;
-extern TGNSSCourse gCourse;
-extern TGNSSAccuracy gAccuracy;
extern TGNSSSatelliteDetail gSatelliteDetail; //TODO: buffer full set of satellite details for one point in time
-extern TGNSSLocation gLocation;
-extern TGNSSUTC gUTC;
-extern TGNSSSimpleConfiguration gConfiguration;
+extern TGNSSSpatial gSpatial;
+extern TGNSSTime gTime;
+
extern const TGnssMetaData gMetaData;
-extern GNSSPositionCallback cbPosition;
-extern GNSSCourseCallback cbCourse;
-extern GNSSAccuracyCallback cbAccuracy;
extern GNSSSatelliteDetailCallback cbSatelliteDetail;
-extern GNSSLocationCallback cbLocation;
-extern GNSSUTCCallback cbUTC;
+extern GNSSSpatialCallback cbSpatial;
+extern GNSSTimeCallback cbTime;
#endif /* GLOBALS_H */
diff --git a/gnss-service/src/gnss-ext.c b/gnss-service/src/gnss-ext.c
index 6caf96c..b17c1a7 100644
--- a/gnss-service/src/gnss-ext.c
+++ b/gnss-service/src/gnss-ext.c
@@ -19,17 +19,14 @@
#include "globals.h"
#include "gnss-ext.h"
-TGNSSAccuracy gAccuracy;
-GNSSAccuracyCallback cbAccuracy = 0;
-
TGNSSSatelliteDetail gSatelliteDetail; //TODO: buffer full set of satellite details for one point in time
GNSSSatelliteDetailCallback cbSatelliteDetail = 0;
-TGNSSLocation gLocation;
-GNSSLocationCallback cbLocation = 0;
+TGNSSSpatial gSpatial;
+GNSSSpatialCallback cbSpatial = 0;
-TGNSSUTC gUTC;
-GNSSUTCCallback cbUTC = 0;
+TGNSSTime gTime;
+GNSSTimeCallback cbTime = 0;
bool gnssExtendedInit()
{
@@ -41,47 +38,6 @@ bool gnssExtendedDestroy()
return true;
}
-bool gnssExtendedRegisterAccuracyCallback(GNSSAccuracyCallback callback)
-{
- if(cbAccuracy != 0)
- {
- return false; //if already registered
- }
-
- pthread_mutex_lock(&mutexCb);
- cbAccuracy = callback;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
-}
-
-bool gnssExtendedDeregisterAccuracyCallback(GNSSAccuracyCallback callback)
-{
- if(cbAccuracy == callback && callback != 0)
- {
- pthread_mutex_lock(&mutexCb);
- cbAccuracy = 0;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
- }
-
- return false;
-}
-
-bool gnssExtendedGetAccuracy(TGNSSAccuracy* accuracy)
-{
- if(!accuracy)
- {
- return false;
- }
-
- pthread_mutex_lock(&mutexData);
- *accuracy = gAccuracy;
- pthread_mutex_unlock(&mutexData);
-
- return true;
-}
bool gnssExtendedRegisterSatelliteDetailCallback(GNSSSatelliteDetailCallback callback)
{
@@ -127,26 +83,26 @@ bool gnssExtendedGetSatelliteDetails(TGNSSSatelliteDetail* satelliteDetails, uin
return true;
}
-bool gnssExtendedRegisterLocationCallback(GNSSLocationCallback callback)
+bool gnssExtendedRegisterSpatialCallback(GNSSSpatialCallback callback)
{
- if(cbLocation != 0)
+ if(cbSpatial != 0)
{
return false; //if already registered
}
pthread_mutex_lock(&mutexCb);
- cbLocation = callback;
+ cbSpatial = callback;
pthread_mutex_unlock(&mutexCb);
return true;
}
-bool gnssExtendedDeregisterLocationCallback(GNSSLocationCallback callback)
+bool gnssExtendedDeregisterSpatialCallback(GNSSSpatialCallback callback)
{
- if(cbLocation == callback && callback != 0)
+ if(cbSpatial == callback && callback != 0)
{
pthread_mutex_lock(&mutexCb);
- cbLocation = 0;
+ cbSpatial = 0;
pthread_mutex_unlock(&mutexCb);
return true;
@@ -155,41 +111,41 @@ bool gnssExtendedDeregisterLocationCallback(GNSSLocationCallback callback)
return false;
}
-bool gnssExtendedGetLocation(TGNSSLocation* location)
+bool gnssExtendedGetSpatial(TGNSSSpatial* spatial)
{
- if(!location)
+ if(!spatial)
{
return false;
}
pthread_mutex_lock(&mutexData);
- *location = gLocation;
+ *spatial = gSpatial;
pthread_mutex_unlock(&mutexData);
return true;
}
-bool gnssExtendedRegisterUTCCallback(GNSSUTCCallback callback)
+bool gnssExtendedRegisterTimeCallback(GNSSTimeCallback callback)
{
- if(cbUTC != 0)
+ if(cbTime != 0)
{
return false; //if already registered
}
pthread_mutex_lock(&mutexCb);
- cbUTC = callback;
+ cbTime = callback;
pthread_mutex_unlock(&mutexCb);
return true;
}
-bool gnssExtendedDeregisterUTCCallback(GNSSUTCCallback callback)
+bool gnssExtendedDeregisterTimeCallback(GNSSTimeCallback callback)
{
- if(cbUTC == callback && callback != 0)
+ if(cbTime == callback && callback != 0)
{
pthread_mutex_lock(&mutexCb);
- cbUTC = 0;
+ cbTime = 0;
pthread_mutex_unlock(&mutexCb);
return true;
@@ -198,15 +154,15 @@ bool gnssExtendedDeregisterUTCCallback(GNSSUTCCallback callback)
return false;
}
-bool gnssExtendedGetUTC(TGNSSUTC* utc)
+bool gnssExtendedGetTime(TGNSSTime* time)
{
- if(!utc)
+ if(!time)
{
return false;
}
pthread_mutex_lock(&mutexData);
- *utc = gUTC;
+ *time = gTime;
pthread_mutex_unlock(&mutexData);
return true;
diff --git a/gnss-service/src/gnss-simple.c b/gnss-service/src/gnss-simple.c
deleted file mode 100644
index 03ad012..0000000
--- a/gnss-service/src/gnss-simple.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/**************************************************************************
-* @licence app begin@
-*
-* SPDX-License-Identifier: MPL-2.0
-*
-* \ingroup GNSSService
-* \author Marco Residori <marco.residori@xse.de>
-*
-* \copyright Copyright (C) 2013, XS Embedded GmbH
-*
-* \license
-* This Source Code Form is subject to the terms of the
-* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
-* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
-*
-* @licence end@
-**************************************************************************/
-
-#include "globals.h"
-#include "gnss-simple.h"
-
-GNSSPositionCallback cbPosition = 0;
-GNSSCourseCallback cbCourse = 0;
-TGNSSPosition gPosition;
-TGNSSCourse gCourse;
-TGNSSSimpleConfiguration gConfiguration;
-
-bool gnssSimpleInit()
-{
- gPosition.validityBits = 0;
- gConfiguration.validityBits = 0;
- gCourse.validityBits = 0;
-
- cbPosition = 0;
- cbCourse = 0;
-
- return true;
-}
-
-bool gnssSimpleDestroy()
-{
- return true;
-}
-
-bool gnssSimpleGetConfiguration(TGNSSSimpleConfiguration* gnssConfig)
-{
- if(!gnssConfig)
- {
- return false;
- }
-
- *gnssConfig = gConfiguration;
-
- return true;
-}
-
-bool gnssSimpleRegisterPositionCallback(GNSSPositionCallback callback)
-{
- //printf("gnssSimpleRegisterPositionCallback\n");
- if(cbPosition != 0)
- {
- return false;
- }
-
- pthread_mutex_lock(&mutexCb);
- cbPosition = callback;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
-}
-
-bool gnssSimpleDeregisterPositionCallback(GNSSPositionCallback callback)
-{
- //printf("gnssSimpleDeregisterPositionCallback\n");
- if (cbPosition == callback && callback != 0)
- {
- pthread_mutex_lock(&mutexCb);
- cbPosition = 0;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
- }
- return false;
-}
-
-bool gnssSimpleGetPosition(TGNSSPosition* pos)
-{
- if(!pos)
- {
- return false;
- }
-
- pthread_mutex_lock(&mutexData);
- *pos = gPosition;
- pthread_mutex_unlock(&mutexData);
-
- return true;
-}
-
-bool gnssSimpleRegisterCourseCallback(GNSSCourseCallback callback)
-{
- //printf("gnssSimpleRegisterCourseCallback\n");
- if(cbCourse != 0)
- {
- return false;
- }
-
- pthread_mutex_lock(&mutexCb);
- cbCourse = callback;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
-}
-
-bool gnssSimpleDeregisterCourseCallback(GNSSCourseCallback callback)
-{
- //printf("gnssSimpleDeregisterCourseCallback\n");
- if(cbCourse == callback && callback != 0)
- {
- pthread_mutex_lock(&mutexCb);
- cbCourse = 0;
- pthread_mutex_unlock(&mutexCb);
-
- return true;
- }
-
- return false;
-}
-
-bool gnssSimpleGetCourse(TGNSSCourse* course)
-{
- if(!course)
- {
- return false;
- }
-
- pthread_mutex_lock(&mutexData);
- *course = gCourse;
- pthread_mutex_unlock(&mutexData);
-
- return true;
-}
-
-
-
-
diff --git a/gnss-service/src/gnss-use-gpsd.c b/gnss-service/src/gnss-use-gpsd.c
index 30b55c4..eee655e 100644
--- a/gnss-service/src/gnss-use-gpsd.c
+++ b/gnss-service/src/gnss-use-gpsd.c
@@ -27,7 +27,6 @@
#include "globals.h"
#include "gnss.h"
-#include "gnss-simple.h"
#include "log.h"
#include "gps.h"
@@ -114,170 +113,7 @@ static EGNSSFixStatus convertToFixStatus(int fixMode)
return status;
}
-bool extractAccuracy(struct gps_data_t* pGpsData, TGNSSAccuracy* pAccuracy)
-{
- static EGNSSFixStatus oldFixStatus = GNSS_FIX_STATUS_NO;
- static uint16_t oldUsedSatellites = 0;
- static uint16_t oldVisibleSatellites = 0;
- bool fixStatusChanged = false;
- bool satellitesChanged = false;
-
- if(!pGpsData || !pAccuracy)
- {
- return false;
- }
-
- pAccuracy->validityBits = 0;
-
- pAccuracy->timestamp = pGpsData->fix.time;
-
- fixStatusChanged = (oldFixStatus != convertToFixStatus(pGpsData->fix.mode));
-
- satellitesChanged = ((oldUsedSatellites != (uint16_t)pGpsData->satellites_used) ||
- (oldVisibleSatellites != (uint16_t)pGpsData->satellites_visible));
-
- if(((pGpsData->set & MODE_SET) && fixStatusChanged) ||
- (pGpsData->set & DOP_SET) ||
- ((pGpsData->set & SATELLITE_SET) && satellitesChanged))
- {
- oldFixStatus = pAccuracy->fixStatus;
- pAccuracy->fixStatus = convertToFixStatus(pGpsData->fix.mode);
- pAccuracy->validityBits |= GNSS_ACCURACY_STAT_VALID;
- LOG_DEBUG(gContext,"FixStatus: %d", (int)pAccuracy->fixStatus);
-
- pAccuracy->pdop = (float)pGpsData->dop.pdop;
- pAccuracy->validityBits |= GNSS_ACCURACY_PDOP_VALID;
- LOG_DEBUG(gContext,"pdop: %lf", pAccuracy->pdop);
-
- pAccuracy->hdop = (float)pGpsData->dop.hdop;
- pAccuracy->validityBits |= GNSS_ACCURACY_HDOP_VALID;
- LOG_DEBUG(gContext,"hdop: %lf", pAccuracy->hdop);
-
- pAccuracy->vdop = (float)pGpsData->dop.vdop;
- pAccuracy->validityBits |= GNSS_ACCURACY_VDOP_VALID;
- LOG_DEBUG(gContext,"vdop: %lf", pAccuracy->vdop);
-
- if(pGpsData->satellites_used >= 0)
- {
- oldUsedSatellites = pAccuracy->usedSatellites;
- pAccuracy->usedSatellites = (uint16_t)pGpsData->satellites_used;
- pAccuracy->validityBits |= GNSS_ACCURACY_USAT_VALID;
- LOG_DEBUG(gContext,"Used Satellites: %d", pAccuracy->usedSatellites);
- }
-
- if(pGpsData->satellites_visible >= 0)
- {
- oldVisibleSatellites = pAccuracy->visibleSatellites;
- pAccuracy->visibleSatellites = (uint16_t)pGpsData->satellites_visible;
- pAccuracy->validityBits |= GNSS_ACCURACY_VSAT_VALID;
- LOG_DEBUG(gContext,"Visible Satellites: %d", pAccuracy->visibleSatellites);
- }
-
- if(cbAccuracy != 0)
- {
- cbAccuracy(pAccuracy,1);
- }
- }
- return true;
-}
-
-bool extractPosition(struct gps_data_t* pGpsData, TGNSSPosition* pPosition)
-{
- if(!pGpsData || !pPosition)
- {
- return false;
- }
-
- if( ((pGpsData->set & LATLON_SET) || (pGpsData->set & ALTITUDE_SET)) &&
- (pGpsData->set & MODE_SET) &&
- ((pGpsData->fix.mode == MODE_2D) || (pGpsData->fix.mode == MODE_3D)) )
- {
- pPosition->validityBits = 0;
-
- pPosition->timestamp = pGpsData->fix.time;
-
- if(pGpsData->set & LATLON_SET)
- {
- pPosition->validityBits |= GNSS_POSITION_LATITUDE_VALID;
- pPosition->latitude = pGpsData->fix.latitude;
-
- pPosition->validityBits |= GNSS_POSITION_LONGITUDE_VALID;
- pPosition->longitude = pGpsData->fix.longitude;
-
- LOG_DEBUG(gContext,"Latitude: %lf", pPosition->latitude);
- LOG_DEBUG(gContext,"Longitude: %lf", pPosition->longitude);
- }
-
- if((pGpsData->set & ALTITUDE_SET) && (pGpsData->fix.mode == MODE_3D))
- {
- pPosition->validityBits |= GNSS_POSITION_ALTITUDE_VALID;
- pPosition->altitude = (float)pGpsData->fix.altitude;
-
- LOG_DEBUG(gContext,"Altitude: %lf", pPosition->altitude);
- }
-
- if (cbPosition != 0)
- {
- cbPosition(pPosition,1);
- }
- }
- return true;
-}
-
-bool extractCourse(struct gps_data_t* pGpsData, TGNSSCourse* pCourse)
-{
- static float oldSpeed = 0;
- static float oldClimb = 0;
- static float oldHeading = 0;
-
- if(!pGpsData || !pCourse)
- {
- return false;
- }
-
- if( ((pGpsData->set & SPEED_SET) && (oldSpeed != (float)pGpsData->fix.speed)) ||
- ((pGpsData->set & CLIMB_SET) && (oldClimb != (float)pGpsData->fix.climb)) ||
- ((pGpsData->set & TRACK_SET) && (oldHeading != (float)pGpsData->fix.track)) )
- {
-
- pCourse->validityBits = 0;
-
- pCourse->timestamp = pGpsData->fix.time;
-
- if(pGpsData->set & SPEED_SET)
- {
- oldSpeed = pCourse->speed;
- pCourse->speed = (float)pGpsData->fix.speed;
- pCourse->validityBits |= GNSS_COURSE_SPEED_VALID;
- LOG_DEBUG(gContext,"Speed: %lf", pCourse->speed);
- }
-
- if(pGpsData->set & CLIMB_SET)
- {
- oldClimb = pCourse->climb;
- pCourse->climb = (float)pGpsData->fix.climb;
- pCourse->validityBits |= GNSS_COURSE_CLIMB_VALID;
- LOG_DEBUG(gContext,"Climb: %lf", pCourse->climb);
- }
-
- if(pGpsData->set & TRACK_SET)
- {
- oldHeading = pCourse->heading;
- pCourse->heading = (float)pGpsData->fix.track;
- pCourse->validityBits |= GNSS_COURSE_HEADING_VALID;
- LOG_DEBUG(gContext,"Heading: %lf", pCourse->heading);
- }
-
- if(cbCourse != 0)
- {
- cbCourse(pCourse,1);
- }
- }
- return true;
-}
-
-
-bool extractLocation(struct gps_data_t* pGpsData, TGNSSLocation* pLocation)
+bool extractSpatial(struct gps_data_t* pGpsData, TGNSSSpatial* pSpatial)
{
static float oldHSpeed = 0;
static float oldVSpeed = 0;
@@ -291,14 +127,14 @@ bool extractLocation(struct gps_data_t* pGpsData, TGNSSLocation* pLocation)
bool fixStatusChanged = false;
bool satellitesChanged = false;
- if(!pGpsData || !pLocation)
+ if(!pGpsData || !pSpatial)
{
return false;
}
- pLocation->validityBits = 0;
+ pSpatial->validityBits = 0;
- pLocation->timestamp = pGpsData->fix.time;
+ pSpatial->timestamp = pGpsData->fix.time;
if( ((pGpsData->set & LATLON_SET) || (pGpsData->set & ALTITUDE_SET)) &&
(pGpsData->set & MODE_SET) &&
@@ -308,22 +144,22 @@ bool extractLocation(struct gps_data_t* pGpsData, TGNSSLocation* pLocation)
if(pGpsData->set & LATLON_SET)
{
- pLocation->validityBits |= GNSS_LOCATION_LATITUDE_VALID;
- pLocation->latitude = pGpsData->fix.latitude;
+ pSpatial->validityBits |= GNSS_SPATIAL_LATITUDE_VALID;
+ pSpatial->latitude = pGpsData->fix.latitude;
- pLocation->validityBits |= GNSS_LOCATION_LONGITUDE_VALID;
- pLocation->longitude = pGpsData->fix.longitude;
+ pSpatial->validityBits |= GNSS_SPATIAL_LONGITUDE_VALID;
+ pSpatial->longitude = pGpsData->fix.longitude;
- LOG_DEBUG(gContext,"Latitude: %lf", pLocation->latitude);
- LOG_DEBUG(gContext,"Longitude: %lf", pLocation->longitude);
+ LOG_DEBUG(gContext,"Latitude: %lf", pSpatial->latitude);
+ LOG_DEBUG(gContext,"Longitude: %lf", pSpatial->longitude);
}
if((pGpsData->set & ALTITUDE_SET) && (pGpsData->fix.mode == MODE_3D))
{
- pLocation->validityBits |= GNSS_LOCATION_ALTITUDEMSL_VALID;
- pLocation->altitudeMSL = (float)pGpsData->fix.altitude;
+ pSpatial->validityBits |= GNSS_SPATIAL_ALTITUDEMSL_VALID;
+ pSpatial->altitudeMSL = (float)pGpsData->fix.altitude;
- LOG_DEBUG(gContext,"Altitude: %lf", pLocation->altitudeMSL);
+ LOG_DEBUG(gContext,"Altitude: %lf", pSpatial->altitudeMSL);
}
}
@@ -336,26 +172,26 @@ bool extractLocation(struct gps_data_t* pGpsData, TGNSSLocation* pLocation)
if(pGpsData->set & SPEED_SET)
{
- oldHSpeed = pLocation->hSpeed;
- pLocation->hSpeed = (float)pGpsData->fix.speed;
- pLocation->validityBits |= GNSS_LOCATION_HSPEED_VALID;
- LOG_DEBUG(gContext,"Speed: %lf", pLocation->hSpeed);
+ oldHSpeed = pSpatial->hSpeed;
+ pSpatial->hSpeed = (float)pGpsData->fix.speed;
+ pSpatial->validityBits |= GNSS_SPATIAL_HSPEED_VALID;
+ LOG_DEBUG(gContext,"Speed: %lf", pSpatial->hSpeed);
}
if(pGpsData->set & CLIMB_SET)
{
- oldVSpeed = pLocation->vSpeed;
- pLocation->vSpeed = (float)pGpsData->fix.climb;
- pLocation->validityBits |= GNSS_LOCATION_VSPEED_VALID;
- LOG_DEBUG(gContext,"Climb: %lf", pLocation->vSpeed);
+ oldVSpeed = pSpatial->vSpeed;
+ pSpatial->vSpeed = (float)pGpsData->fix.climb;
+ pSpatial->validityBits |= GNSS_SPATIAL_VSPEED_VALID;
+ LOG_DEBUG(gContext,"Climb: %lf", pSpatial->vSpeed);
}
if(pGpsData->set & TRACK_SET)
{
- oldHeading = pLocation->heading;
- pLocation->heading = (float)pGpsData->fix.track;
- pLocation->validityBits |= GNSS_LOCATION_HEADING_VALID;
- LOG_DEBUG(gContext,"Heading: %lf", pLocation->heading);
+ oldHeading = pSpatial->heading;
+ pSpatial->heading = (float)pGpsData->fix.track;
+ pSpatial->validityBits |= GNSS_SPATIAL_HEADING_VALID;
+ LOG_DEBUG(gContext,"Heading: %lf", pSpatial->heading);
}
}
@@ -368,72 +204,72 @@ bool extractLocation(struct gps_data_t* pGpsData, TGNSSLocation* pLocation)
(pGpsData->set & DOP_SET) ||
((pGpsData->set & SATELLITE_SET) && satellitesChanged))
{
- oldFixStatus = pLocation->fixStatus;
- pLocation->fixStatus = convertToFixStatus(pGpsData->fix.mode);
- pLocation->validityBits |= GNSS_LOCATION_STAT_VALID;
- LOG_DEBUG(gContext,"FixStatus: %d", (int)pLocation->fixStatus);
+ oldFixStatus = pSpatial->fixStatus;
+ pSpatial->fixStatus = convertToFixStatus(pGpsData->fix.mode);
+ pSpatial->validityBits |= GNSS_SPATIAL_STAT_VALID;
+ LOG_DEBUG(gContext,"FixStatus: %d", (int)pSpatial->fixStatus);
//fixTypeBits: hardcoded
- pLocation->fixTypeBits |= GNSS_FIX_TYPE_SINGLE_FREQUENCY;
- pLocation->validityBits |= GNSS_LOCATION_TYPE_VALID;
+ pSpatial->fixTypeBits |= GNSS_FIX_TYPE_SINGLE_FREQUENCY;
+ pSpatial->validityBits |= GNSS_SPATIAL_TYPE_VALID;
- pLocation->pdop = (float)pGpsData->dop.pdop;
- pLocation->validityBits |= GNSS_LOCATION_PDOP_VALID;
- LOG_DEBUG(gContext,"pdop: %lf", pLocation->pdop);
+ pSpatial->pdop = (float)pGpsData->dop.pdop;
+ pSpatial->validityBits |= GNSS_SPATIAL_PDOP_VALID;
+ LOG_DEBUG(gContext,"pdop: %lf", pSpatial->pdop);
- pLocation->hdop = (float)pGpsData->dop.hdop;
- pLocation->validityBits |= GNSS_LOCATION_HDOP_VALID;
- LOG_DEBUG(gContext,"hdop: %lf", pLocation->hdop);
+ pSpatial->hdop = (float)pGpsData->dop.hdop;
+ pSpatial->validityBits |= GNSS_SPATIAL_HDOP_VALID;
+ LOG_DEBUG(gContext,"hdop: %lf", pSpatial->hdop);
- pLocation->vdop = (float)pGpsData->dop.vdop;
- pLocation->validityBits |= GNSS_LOCATION_VDOP_VALID;
- LOG_DEBUG(gContext,"vdop: %lf", pLocation->vdop);
+ pSpatial->vdop = (float)pGpsData->dop.vdop;
+ pSpatial->validityBits |= GNSS_SPATIAL_VDOP_VALID;
+ LOG_DEBUG(gContext,"vdop: %lf", pSpatial->vdop);
- pLocation->sigmaHPosition = (float)pGpsData->fix.epx;
- pLocation->validityBits |= GNSS_LOCATION_SHPOS_VALID;
- LOG_DEBUG(gContext,"sigmaHorPosition: %lf", pLocation->sigmaHPosition);
+ pSpatial->sigmaHPosition = (float)pGpsData->fix.epx;
+ pSpatial->validityBits |= GNSS_SPATIAL_SHPOS_VALID;
+ LOG_DEBUG(gContext,"sigmaHorPosition: %lf", pSpatial->sigmaHPosition);
- pLocation->sigmaHSpeed = (float)pGpsData->fix.eps;
- pLocation->validityBits |= GNSS_LOCATION_SHSPEED_VALID;
- LOG_DEBUG(gContext,"sigmaHorSpeed: %lf", pLocation->sigmaHSpeed);
+ pSpatial->sigmaHSpeed = (float)pGpsData->fix.eps;
+ pSpatial->validityBits |= GNSS_SPATIAL_SHSPEED_VALID;
+ LOG_DEBUG(gContext,"sigmaHorSpeed: %lf", pSpatial->sigmaHSpeed);
- pLocation->sigmaHeading = (float)pGpsData->fix.epd;
- pLocation->validityBits |= GNSS_LOCATION_SHEADING_VALID;
- LOG_DEBUG(gContext,"sigmaHeading: %lf", pLocation->sigmaHeading);
+ pSpatial->sigmaHeading = (float)pGpsData->fix.epd;
+ pSpatial->validityBits |= GNSS_SPATIAL_SHEADING_VALID;
+ LOG_DEBUG(gContext,"sigmaHeading: %lf", pSpatial->sigmaHeading);
if(pGpsData->satellites_used >= 0)
{
- oldUsedSatellites = pLocation->usedSatellites;
- pLocation->usedSatellites = (uint16_t)pGpsData->satellites_used;
- pLocation->validityBits |= GNSS_LOCATION_USAT_VALID;
- LOG_DEBUG(gContext,"Used Satellites: %d", pLocation->usedSatellites);
+ oldUsedSatellites = pSpatial->usedSatellites;
+ pSpatial->usedSatellites = (uint16_t)pGpsData->satellites_used;
+ pSpatial->validityBits |= GNSS_SPATIAL_USAT_VALID;
+ LOG_DEBUG(gContext,"Used Satellites: %d", pSpatial->usedSatellites);
}
if(pGpsData->satellites_visible >= 0)
{
- oldVisibleSatellites = pLocation->visibleSatellites;
- pLocation->visibleSatellites = (uint16_t)pGpsData->satellites_visible;
- pLocation->validityBits |= GNSS_LOCATION_VSAT_VALID;
- LOG_DEBUG(gContext,"Visible Satellites: %d", pLocation->visibleSatellites);
+ oldVisibleSatellites = pSpatial->visibleSatellites;
+ pSpatial->visibleSatellites = (uint16_t)pGpsData->satellites_visible;
+ pSpatial->validityBits |= GNSS_SPATIAL_VSAT_VALID;
+ LOG_DEBUG(gContext,"Visible Satellites: %d", pSpatial->visibleSatellites);
}
}
if (positionAvailable || velocityAvailable || fixStatusChanged || satellitesChanged)
{
- if(cbLocation != 0)
+ if(cbSpatial != 0)
{
- cbLocation(pLocation,1);
+ cbSpatial(pSpatial,1);
}
}
return true;
}
-bool extractUTC(struct gps_data_t* pGpsData, TGNSSUTC* pUTC)
+bool extractTime(struct gps_data_t* pGpsData, TGNSSTime* pTime)
{
static timestamp_t oldTime = 0;
- if(!pGpsData || !pUTC)
+ if(!pGpsData || !pTime)
{
return false;
}
@@ -442,28 +278,28 @@ bool extractUTC(struct gps_data_t* pGpsData, TGNSSUTC* pUTC)
{
char month [12] [4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
- pUTC->validityBits = 0;
- pUTC->timestamp = pGpsData->fix.time;
+ pTime->validityBits = 0;
+ pTime->timestamp = pGpsData->fix.time;
if(pGpsData->set & TIME_SET)
{
oldTime = pGpsData->fix.time;
time_t unix_sec = pGpsData->fix.time;
struct tm * ptm = gmtime (&unix_sec);
- pUTC->year = ptm->tm_year+1900;
- pUTC->month = ptm->tm_mon;
- pUTC->day = ptm->tm_mday;
- pUTC->hour = ptm->tm_hour;
- pUTC->minute = ptm->tm_min;
- pUTC->second = ptm->tm_sec;
- pUTC->ms = 1000*fmod(pGpsData->fix.time, 1.0);
- pUTC->validityBits |= GNSS_UTC_TIME_VALID | GNSS_UTC_DATE_VALID;
- LOG_DEBUG(gContext,"UTC: %04d-%s-%02d %02d:%02d:%02d", pUTC->year, month[pUTC->month%12], pUTC->day, pUTC->hour, pUTC->minute, pUTC->second);
+ pTime->year = ptm->tm_year+1900;
+ pTime->month = ptm->tm_mon;
+ pTime->day = ptm->tm_mday;
+ pTime->hour = ptm->tm_hour;
+ pTime->minute = ptm->tm_min;
+ pTime->second = ptm->tm_sec;
+ pTime->ms = 1000*fmod(pGpsData->fix.time, 1.0);
+ pTime->validityBits |= GNSS_TIME_TIME_VALID | GNSS_TIME_DATE_VALID;
+ LOG_DEBUG(gContext,"UTC: %04d-%s-%02d %02d:%02d:%02d", pTime->year, month[pTime->month%12], pTime->day, pTime->hour, pTime->minute, pTime->second);
}
- if(cbUTC != 0)
+ if(cbTime != 0)
{
- cbUTC(pUTC,1);
+ cbTime(pTime,1);
}
}
return true;
@@ -515,29 +351,15 @@ void *listen( void *ptr )
{
pthread_mutex_lock(&mutexData);
- if(!extractPosition(&gpsdata,&gPosition))
- {
- LOG_ERROR_MSG(gContext,"error extracting position");
- }
-
- if(!extractCourse(&gpsdata,&gCourse))
- {
- LOG_ERROR_MSG(gContext,"error extracting course");
- }
-
- if(!extractAccuracy(&gpsdata,&gAccuracy))
- {
- LOG_ERROR_MSG(gContext,"error extracting accuracy");
- }
- if(!extractLocation(&gpsdata,&gLocation))
+ if(!extractSpatial(&gpsdata,&gSpatial))
{
- LOG_ERROR_MSG(gContext,"error extracting Location");
+ LOG_ERROR_MSG(gContext,"error extracting spatial data");
}
- if(!extractUTC(&gpsdata,&gUTC))
+ if(!extractTime(&gpsdata,&gTime))
{
- LOG_ERROR_MSG(gContext,"error extracting UTC");
+ LOG_ERROR_MSG(gContext,"error extracting Time");
}
diff --git a/gnss-service/src/gnss-use-replayer.c b/gnss-service/src/gnss-use-replayer.c
index 3145cac..0db3a6c 100644
--- a/gnss-service/src/gnss-use-replayer.c
+++ b/gnss-service/src/gnss-use-replayer.c
@@ -34,7 +34,6 @@
#include "globals.h"
#include "gnss.h"
-#include "gnss-simple.h"
#include "log.h"
#define BUFLEN 256
@@ -100,211 +99,8 @@ void gnssGetVersion(int *major, int *minor, int *micro)
}
}
-bool processGVGNSAC(char* data, TGNSSAccuracy* pAccuracy)
-{
- //parse data like: 061064000,0$GVGNSP,061064000,49.02657,12.06527,336.70000,0X07
-
- //storage for buffered data
- static TGNSSAccuracy buf_acc[MAX_BUF_MSG];
- static uint16_t buf_size = 0;
- static uint16_t last_countdown = 0;
-
- uint64_t timestamp;
- uint16_t countdown;
- TGNSSAccuracy acc = { 0 };
- uint16_t fixStatus;
- uint32_t n = 0;
-
- if(!data || !pAccuracy)
- {
- LOG_ERROR_MSG(gContext,"wrong parameter!");
- return false;
- }
-
- n = sscanf(data, "%llu,%hu$GVGNSAC,%llu,%f,%f,%f,%hu,%hu,%hu,%f,%f,%f,%hu,%x,%x",
- &timestamp, &countdown, &acc.timestamp,
- &acc.pdop, &acc.hdop, &acc.vdop,
- &acc.usedSatellites, &acc.trackedSatellites, &acc.visibleSatellites,
- &acc.sigmaLatitude, &acc.sigmaLongitude, &acc.sigmaAltitude,
- &fixStatus, &acc.fixTypeBits, &acc.validityBits);
- acc.fixStatus = fixStatus;
-
- if (n <= 0)
- {
- LOG_ERROR_MSG(gContext,"replayer: processGVGNSAC failed!");
- return false;
- }
-
- *pAccuracy = acc;
-
- //buffered data handling
- if (countdown < MAX_BUF_MSG) //enough space in buffer?
- {
- if (buf_size == 0) //a new sequence starts
- {
- buf_size = countdown+1;
- last_countdown = countdown;
- buf_acc[buf_size-countdown-1] = acc;
- }
- else if ((last_countdown-countdown) == 1) //sequence continued
- {
- last_countdown = countdown;
- buf_acc[buf_size-countdown-1] = acc;
- }
- else //sequence interrupted: clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
- }
- else //clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
-
- if((cbAccuracy != 0) && (countdown == 0) && (buf_size >0) )
- {
- cbAccuracy(buf_acc,buf_size);
- buf_size = 0;
- last_countdown = 0;
- }
-
- return true;
-}
-
-static bool processGVGNSP(char* data, TGNSSPosition* pPosition)
-{
- //parse data like: 061064000,0$GVGNSP,061064000,49.02657,12.06527,336.70000,0X07
-
- //storage for buffered data
- static TGNSSPosition buf_pos[MAX_BUF_MSG];
- static uint16_t buf_size = 0;
- static uint16_t last_countdown = 0;
-
- uint64_t timestamp;
- uint16_t countdown;
- TGNSSPosition pos = { 0 };
- uint32_t n = 0;
-
- if(!data || !pPosition)
- {
- LOG_ERROR_MSG(gContext,"wrong parameter!");
- return false;
- }
-
- n = sscanf(data, "%llu,%hu$GVGNSP,%llu,%lf,%lf,%f,%x", &timestamp, &countdown, &pos.timestamp, &pos.latitude, &pos.longitude, &pos.altitude, &pos.validityBits);
-
- if (n <= 0)
- {
- LOG_ERROR_MSG(gContext,"replayer: processGVGNSP failed!");
- return false;
- }
-
- *pPosition = pos;
-
- //buffered data handling
- if (countdown < MAX_BUF_MSG) //enough space in buffer?
- {
- if (buf_size == 0) //a new sequence starts
- {
- buf_size = countdown+1;
- last_countdown = countdown;
- buf_pos[buf_size-countdown-1] = pos;
- }
- else if ((last_countdown-countdown) == 1) //sequence continued
- {
- last_countdown = countdown;
- buf_pos[buf_size-countdown-1] = pos;
- }
- else //sequence interrupted: clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
- }
- else //clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
-
- if((cbPosition != 0) && (countdown == 0) && (buf_size >0) )
- {
- cbPosition(buf_pos,buf_size);
- buf_size = 0;
- last_countdown = 0;
- }
-
- return true;
-}
-
-static bool processGVGNSC(char* data, TGNSSCourse* pCourse)
-{
- //parse data like: 061064000,0$GVGNSC,061064000,0.00,0,131.90000,0X05
-
- //storage for buffered data
- static TGNSSCourse buf_course[MAX_BUF_MSG];
- static uint16_t buf_size = 0;
- static uint16_t last_countdown = 0;
-
- uint64_t timestamp;
- uint16_t countdown;
- TGNSSCourse course = { 0 };
- uint32_t n = 0;
-
- if(!data || !pCourse)
- {
- LOG_ERROR_MSG(gContext,"wrong parameter!");
- return false;
- }
-
- n = sscanf(data, "%llu,%hu$GVGNSC,%llu,%f,%f,%f,%x", &timestamp, &countdown, &course.timestamp, &course.speed, &course.climb, &course.heading, &course.validityBits);
-
-
- if (n <= 0)
- {
- LOG_ERROR_MSG(gContext,"replayer: processGVGNSC failed!");
- return false;
- }
-
- *pCourse = course;
-
- //buffered data handling
- if (countdown < MAX_BUF_MSG) //enough space in buffer?
- {
- if (buf_size == 0) //a new sequence starts
- {
- buf_size = countdown+1;
- last_countdown = countdown;
- buf_course[buf_size-countdown-1] = course;
- }
- else if ((last_countdown-countdown) == 1) //sequence continued
- {
- last_countdown = countdown;
- buf_course[buf_size-countdown-1] = course;
- }
- else //sequence interrupted: clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
- }
- else //clear buffer
- {
- buf_size = 0;
- last_countdown = 0;
- }
-
- if((cbCourse != 0) && (countdown == 0) && (buf_size >0) )
- {
- cbCourse(buf_course,buf_size);
- buf_size = 0;
- last_countdown = 0;
- }
-
- return true;
-}
+//TODO: add support reading of TGNSSSpatial
+// ?? retain backwards compatibility for old logs?
static bool processGVGNSSAT(char* data, TGNSSSatelliteDetail* pSatelliteDetail)
{
@@ -430,19 +226,7 @@ void *listenForMessages( void *ptr )
pthread_mutex_lock(&mutexData);
- if(strcmp("GVGNSP", msgId) == 0)
- {
- processGVGNSP(buf, &gPosition);
- }
- else if(strcmp("GVGNSC", msgId) == 0)
- {
- processGVGNSC(buf, &gCourse);
- }
- else if(strcmp("GVGNSAC", msgId) == 0)
- {
- processGVGNSAC(buf, &gAccuracy);
- }
- else if(strcmp("GVGNSSAT", msgId) == 0)
+ if(strcmp("GVGNSSAT", msgId) == 0)
{
processGVGNSSAT(buf, &gSatelliteDetail);
}
diff --git a/gnss-service/test/compliance-test/gnss-service-compliance-test.c b/gnss-service/test/compliance-test/gnss-service-compliance-test.c
index 16cef40..6212095 100644
--- a/gnss-service/test/compliance-test/gnss-service-compliance-test.c
+++ b/gnss-service/test/compliance-test/gnss-service-compliance-test.c
@@ -23,7 +23,6 @@
#include <unistd.h>
#include "gnss.h"
-#include "gnss-simple.h"
#include "gnss-ext.h"
#include "log.h"
@@ -33,37 +32,22 @@ DLT_DECLARE_CONTEXT(gCtx);
#define TEST_PASSED EXIT_SUCCESS
static int testResult = TEST_PASSED;
+static int cbSpatialSuccess = 0;
-
-static void cbPosition(const TGNSSPosition pos[], uint16_t numElements)
-{
- if(pos == NULL || numElements < 1)
- {
- LOG_ERROR_MSG(gCtx,"cbPosition failed!");
- testResult = TEST_FAILED;
- return;
- }
-}
-
-static void cbCourse(const TGNSSCourse course[], uint16_t numElements)
+static void cbSpatial(const TGNSSSpatial spatial[], uint16_t numElements)
{
- if(course == NULL || numElements < 1)
+ int i;
+ if(spatial == NULL || numElements < 1)
{
- LOG_ERROR_MSG(gCtx,"cbCourse failed!");
+ LOG_ERROR_MSG(gCtx,"cbSpatial failed!");
testResult = TEST_FAILED;
return;
}
+ cbSpatialSuccess++;
+
+
}
-static void cbAccuracy(const TGNSSAccuracy accuracy[], uint16_t numElements)
-{
- if(accuracy == NULL || numElements < 1)
- {
- LOG_ERROR_MSG(gCtx,"cbAccuracy failed!");
- testResult = TEST_FAILED;
- return;
- }
-}
bool checkMajorVersion(int expectedMajor)
{
@@ -96,7 +80,7 @@ bool init()
return false;
}
- if(!gnssSimpleInit())
+ if(!gnssExtendedInit())
{
return false;
}
@@ -116,9 +100,7 @@ int main()
if(init())
{
//register for GNSS
- gnssSimpleRegisterPositionCallback(&cbPosition);
- gnssSimpleRegisterCourseCallback(&cbCourse);
- gnssExtendedRegisterAccuracyCallback(&cbAccuracy);
+ gnssExtendedRegisterSpatialCallback(&cbSpatial);
//listen for events for about 10 seconds
for(i = 0; i < 10; i++)
@@ -127,11 +109,9 @@ int main()
}
//deregister
- gnssSimpleDeregisterPositionCallback(&cbPosition);
- gnssSimpleDeregisterCourseCallback(&cbCourse);
- gnssExtendedDeregisterAccuracyCallback(&cbAccuracy);
+ gnssExtendedDeregisterSpatialCallback(&cbSpatial);
- gnssSimpleDestroy();
+ gnssExtendedDestroy();
gnssDestroy();
}
@@ -142,7 +122,7 @@ int main()
return EXIT_FAILURE;
}
- LOG_INFO_MSG(gCtx,"TEST_PASSED");
+ LOG_INFO(gCtx,"TEST_PASSED with %d successful callbacks", cbSpatialSuccess);
return EXIT_SUCCESS;
}
diff --git a/gnss-service/test/gnss-service-client.c b/gnss-service/test/gnss-service-client.c
index a2da4cf..eddbf28 100644
--- a/gnss-service/test/gnss-service-client.c
+++ b/gnss-service/test/gnss-service-client.c
@@ -23,79 +23,18 @@
#include <unistd.h>
#include "gnss.h"
-#include "gnss-simple.h"
#include "gnss-ext.h"
#include "log.h"
DLT_DECLARE_CONTEXT(gCtx);
-static void cbPosition(const TGNSSPosition pos[], uint16_t numElements)
-{
- int i;
- if(pos == NULL || numElements < 1)
- {
- LOG_ERROR_MSG(gCtx,"cbPosition failed!");
- return;
- }
-
- for (i = 0; i<numElements; i++)
- {
- LOG_INFO(gCtx,"Position Update[%d/%d]: lat=%f lon=%f",
- i+1,
- numElements,
- pos[i].latitude,
- pos[i].longitude);
- }
-}
-
-static void cbCourse(const TGNSSCourse course[], uint16_t numElements)
-{
- int i;
- if(course == NULL || numElements < 1)
- {
- LOG_ERROR_MSG(gCtx,"cbCourse failed!");
- return;
- }
-
- for (i = 0; i<numElements; i++)
- {
- LOG_INFO(gCtx,"Course Update[%d/%d]: speed=%f heading=%f climb=%f",
- i+1,
- numElements,
- course[i].speed,
- course[i].heading,
- course[i].climb);
- }
-
-}
-
-static void cbAccuracy(const TGNSSAccuracy accuracy[], uint16_t numElements)
-{
- int i;
- if(accuracy == NULL || numElements < 1)
- {
- LOG_ERROR_MSG(gCtx,"cbAccuracy failed!");
- return;
- }
-
- for (i = 0; i<numElements; i++)
- {
- LOG_INFO(gCtx,"Accuracy Update[%d/%d]: usedSatellites=%d visibleSatellites=%d fixStatus=%d fixTypeBits=0x%08X",
- i+1,
- numElements,
- accuracy[i].usedSatellites,
- accuracy[i].visibleSatellites,
- accuracy[i].fixStatus,
- accuracy[i].fixTypeBits);
- }
-}
-static void cbLocation(const TGNSSLocation location[], uint16_t numElements)
+static void cbSpatial(const TGNSSSpatial spatial[], uint16_t numElements)
{
int i;
- if(location == NULL || numElements < 1)
+ if(spatial == NULL || numElements < 1)
{
- LOG_ERROR_MSG(gCtx,"cbLocation failed!");
+ LOG_ERROR_MSG(gCtx,"cbSpatial failed!");
return;
}
@@ -104,19 +43,19 @@ static void cbLocation(const TGNSSLocation location[], uint16_t numElements)
LOG_INFO(gCtx,"Location Update[%d/%d]: timestamp=%llu latitude=%.5f longitude=%.5f altitudeMSL=%.1f hSpeed=%.1f heading=%.1f\n hdop=%.1f usedSatellites=%d sigmaHPosition=%.1f sigmaHSpeed=%.1f sigmaHeading=%.1f fixStatus=%d fixTypeBits=0x%08X",
i+1,
numElements,
- location[i].timestamp,
- location[i].latitude,
- location[i].longitude,
- location[i].altitudeMSL,
- location[i].hSpeed,
- location[i].heading,
- location[i].hdop,
- location[i].usedSatellites,
- location[i].sigmaHPosition,
- location[i].sigmaHSpeed,
- location[i].sigmaHeading,
- location[i].fixStatus,
- location[i].fixTypeBits);
+ spatial[i].timestamp,
+ spatial[i].latitude,
+ spatial[i].longitude,
+ spatial[i].altitudeMSL,
+ spatial[i].hSpeed,
+ spatial[i].heading,
+ spatial[i].hdop,
+ spatial[i].usedSatellites,
+ spatial[i].sigmaHPosition,
+ spatial[i].sigmaHSpeed,
+ spatial[i].sigmaHeading,
+ spatial[i].fixStatus,
+ spatial[i].fixTypeBits);
}
}
@@ -171,7 +110,7 @@ void init()
exit(EXIT_FAILURE);
}
- if(!gnssSimpleInit())
+ if(!gnssExtendedInit())
{
exit(EXIT_FAILURE);
}
@@ -187,11 +126,8 @@ int main()
LOG_INFO_MSG(gCtx,"Starting gnss-service-client...");
// register for GNSS
- gnssSimpleRegisterPositionCallback(&cbPosition);
- gnssSimpleRegisterCourseCallback(&cbCourse);
- gnssExtendedRegisterAccuracyCallback(&cbAccuracy);
gnssExtendedRegisterSatelliteDetailCallback(&cbSatelliteDetail);
- gnssExtendedRegisterLocationCallback(&cbLocation);
+ gnssExtendedRegisterSpatialCallback(&cbSpatial);
// enter endless loop
while(1)
@@ -200,13 +136,10 @@ int main()
}
// deregister
- gnssSimpleDeregisterPositionCallback(&cbPosition);
- gnssSimpleDeregisterCourseCallback(&cbCourse);
- gnssExtendedDeregisterAccuracyCallback(&cbAccuracy);
gnssExtendedDeregisterSatelliteDetailCallback(&cbSatelliteDetail);
- gnssExtendedDeregisterLocationCallback(&cbLocation);
+ gnssExtendedDeregisterSpatialCallback(&cbSpatial);
- gnssSimpleDestroy();
+ gnssExtendedDestroy();
gnssDestroy();
return EXIT_SUCCESS;