summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorWei Chen <weic@codeaurora.org>2019-07-25 13:51:58 -0700
committerWei Chen <weic@codeaurora.org>2020-01-07 09:29:39 -0800
commitf8883789e3c1eeb0e6b6b0c26c75a5f70a7af73c (patch)
tree2fac3e6a21f122df49016bc33cf385360650b1f4 /utils
parent62e91b6c001163a7cd39adfe6261882ecb898763 (diff)
downloadgps-f8883789e3c1eeb0e6b6b0c26c75a5f70a7af73c.tar.gz
FR 53788: DGNSS info for SPE position and SV measurement report
Populating DGNSS info from SPE position and SV measurement report to be avaialble for engine plugin Change-Id: Ieeaeaef69c806410aee0abab79f896d5773da90b CRs-fixed: 2485192
Diffstat (limited to 'utils')
-rw-r--r--utils/gps_extended_c.h83
-rw-r--r--utils/loc_nmea.cpp81
2 files changed, 155 insertions, 9 deletions
diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h
index f4ad524..ad39ce2 100644
--- a/utils/gps_extended_c.h
+++ b/utils/gps_extended_c.h
@@ -390,7 +390,17 @@ typedef uint64_t GpsLocationExtendedFlags;
#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE 0x2000000000
/** GpsLocationExtended has the engine mask that indicates the
* set of engines contribute to the fix. */
-#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
+#define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000
+/** GpsLocationExtended has dgnss correction source */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000
+/** GpsLocationExtended has dgnss correction source ID */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000
+/** GpsLocationExtended has dgnss constellation usage */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000
+/** GpsLocationExtended has dgnss ref station Id */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000
+/** GpsLocationExtended has dgnss data age */
+#define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000
typedef uint32_t LocNavSolutionMask;
/* Bitmask to specify whether SBAS ionospheric correction is used */
@@ -573,6 +583,13 @@ typedef uint8_t CarrierPhaseAmbiguityType;
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1)
#define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2)
+
+typedef enum {
+ LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */
+ LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */
+ LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */
+}LocDgnssCorrectionSourceType;
+
typedef uint16_t GnssMeasUsageStatusBitMask;
/** Used in fix */
#define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul)
@@ -761,15 +778,34 @@ typedef struct {
/** Sensor calibration confidence percent. Range: 0 - 100 */
uint8_t calibrationConfidence;
DrCalibrationStatusMask calibrationStatus;
- /* location engine type. When the fix. when the type is set to
+ /** location engine type. When the fix. when the type is set to
LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
reports from all engines running on the system (e.g.:
DR/SPE/PPE). To check which location engine contributes to
the fused output, check for locOutputEngMask. */
LocOutputEngineType locOutputEngType;
- /* when loc output eng type is set to fused, this field
+ /** when loc output eng type is set to fused, this field
indicates the set of engines contribute to the fix. */
PositioningEngineMask locOutputEngMask;
+
+ /** DGNSS Correction Source for position report: RTCM, 3GPP
+ * etc. */
+ LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
+
+ /** If DGNSS is used, the SourceID is a 32bit number identifying
+ * the DGNSS source ID */
+ uint32_t dgnssCorrectionSourceID;
+
+ /** If DGNSS is used, which constellation was DGNSS used for to
+ * produce the pos report. */
+ GnssConstellationTypeMask dgnssConstellationUsage;
+
+ /** If DGNSS is used, DGNSS Reference station ID used for
+ * position report */
+ uint16_t dgnssRefStationId;
+
+ /** If DGNSS is used, DGNSS data age in milli-seconds */
+ uint32_t dgnssDataAgeMsec;
} GpsLocationExtended;
enum loc_sess_status {
@@ -1249,6 +1285,25 @@ typedef enum
/**< SV is being tracked */
}Gnss_LocSvSearchStatusEnumT;
+typedef uint32_t LocSvDgnssMeasStatusMask;
+#define LOC_MASK_DGNSS_EPOCH_TIME_VALID 0x1 /**< DGNSS Epoch time is valid */
+#define LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID 0x2 /**< Pseudo Range correction is valid */
+#define LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID 0x4 /**< Pseudo Range rate correction is valid */
+
+typedef struct {
+ LocSvDgnssMeasStatusMask dgnssMeasStatus;
+ /**< Bitmask indicating the DGNSS SV measurement status. */
+
+ uint32_t diffDataEpochTimeMsec;
+ /**< Age of differential data in Milli Seconds with respect to the Measurement time. */
+
+ float prCorrMeters;
+ /**< Pseudo Range correction in meters. */
+
+ float prrCorrMetersPerSec;
+ /**< Pseudo Range rate correction in meters per second. */
+} Gnss_LocDgnssSVMeasurement;
+
typedef struct
{
uint32_t size;
@@ -1388,7 +1443,8 @@ typedef struct
float carrierPhaseUnc;
-
+ /** < DGNSS Measurements Report for SVs */
+ Gnss_LocDgnssSVMeasurement dgnssSvMeas;
} Gnss_SVMeasurementStructType;
@@ -1420,6 +1476,9 @@ typedef uint64_t GpsSvMeasHeaderFlags;
#define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x01000000
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x02000000
#define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x04000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x08000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID 0x010000000
+#define GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID 0x020000000
typedef struct
{
@@ -1465,6 +1524,22 @@ typedef struct
Gnss_LocGnssTimeExtStructType gloSystemTimeExt;
/** NAVIC system RTC time information. */
Gnss_LocGnssTimeExtStructType navicSystemTimeExt;
+
+ /** Receiver tick at frame count */
+ uint64_t refCountTicks;
+
+ /** DGNSS corrections source type RTCM, 3GPP etc, if DGNSS was
+ * used for these measurements. */
+ LocDgnssCorrectionSourceType dgnssCorrectionSourceType;
+
+ /** DGNSS SourceID: 32bit number identifying the DGNSS source
+ * ID, if DGNSS was used for these measurements. */
+ uint32_t dgnssCorrectionSourceID;
+
+ /** DGNSS Ref station ID: 32bit number identifying the DGNSS
+ * ref station ID, if DGNSS was used for these measurements. */
+ uint16_t dgnssRefStationId;
+
} GnssSvMeasurementHeader;
typedef struct {
diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp
index 9ee2716..32ae8e4 100644
--- a/utils/loc_nmea.cpp
+++ b/utils/loc_nmea.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -1756,17 +1756,51 @@ void loc_nmea_generate_pos(const UlpLocation &location,
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
{
- length = snprintf(pMarker, lengthRemaining, "%.1lf,,",
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,",
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
}
else
{
- length = snprintf(pMarker, lengthRemaining,",,");
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
}
+ pMarker += length;
+ lengthRemaining -= length;
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1f,",
+ (float)locationExtended.dgnssDataAgeMsec / 1000);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
pMarker += length;
lengthRemaining -= length;
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%04d",
+ locationExtended.dgnssRefStationId);
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
// hardcode Navigation Status field to 'V'
length = snprintf(pMarker, lengthRemaining, ",%c", 'V');
pMarker += length;
@@ -1885,12 +1919,49 @@ void loc_nmea_generate_pos(const UlpLocation &location,
if ((location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ALTITUDE) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
{
- length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,",
ref_lla.alt - locationExtended.altitudeMeanSeaLevel);
}
else
{
- length = snprintf(pMarker, lengthRemaining,",,,");
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1f,",
+ (float)locationExtended.dgnssDataAgeMsec / 1000);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, ",");
+ }
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%04d",
+ locationExtended.dgnssRefStationId);
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
}
length = loc_nmea_put_checksum(sentence_GGA, sizeof(sentence_GGA));