summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2020-01-08 10:49:30 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2020-01-08 10:49:30 -0800
commit7a736851d49f0eb3fffb0c3bf4ecbf4036086d46 (patch)
tree88ca5d7ac3be8fc3c704e4ef47b417d010781b8d
parente28fe313452b08fef7fcdf0b15bfb76ac2cf2c1b (diff)
parentf8883789e3c1eeb0e6b6b0c26c75a5f70a7af73c (diff)
downloadgps-7a736851d49f0eb3fffb0c3bf4ecbf4036086d46.tar.gz
Merge "FR 53788: DGNSS info for SPE position and SV measurement report"
-rw-r--r--location/LocationDataTypes.h6
-rw-r--r--utils/gps_extended_c.h83
-rw-r--r--utils/loc_nmea.cpp81
3 files changed, 158 insertions, 12 deletions
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index 65b5e13..fb651c0 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2018-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
@@ -538,7 +538,7 @@ typedef enum {
GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3),
GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4),
GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5),
- GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6)
+ GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6),
} GnssConstellationTypeBits;
#define GNSS_CONSTELLATION_TYPE_MASK_ALL\
@@ -624,7 +624,7 @@ typedef enum
GNSS_LOC_SV_SYSTEM_QZSS = 6,
/**< QZSS satellite. */
GNSS_LOC_SV_SYSTEM_NAVIC = 7,
- /**< QZSS satellite. */
+ /**< NAVIC satellite. */
GNSS_LOC_SV_SYSTEM_MAX = 7,
/**< Max enum of valid SV system. */
} Gnss_LocSvSystemEnumType;
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));