From 4402af6be9de4782d218170203033618f079551d Mon Sep 17 00:00:00 2001 From: gomo Date: Wed, 11 Jan 2017 13:20:13 -0800 Subject: [PATCH] GNSS O Features according to go/o-gps-hal Added "Tow Known" as a possible gnss measurement state. As well added Automatic Gain Control (AGC) to allow jammer detection. Also added the GNSS carrier frequeny to SV status. Also added vertical GPS position uncertainty, speed uncertainty and bearing uncertainty. Also propagate locaton new fields to geofence engine. Test: Existing unit tests still pass. Change-Id: I472b2fd2516cb7614877dea4bb054a34f50844dc --- .../android/location/GnssMeasurement.java | 140 ++++++++-- .../java/android/location/GnssStatus.java | 30 ++- .../android/location/IGnssStatusListener.aidl | 3 +- location/java/android/location/Location.java | 247 +++++++++++++++--- .../android/location/LocationManager.java | 5 +- .../server/location/GnssLocationProvider.java | 160 ++++++------ .../location/GnssStatusListenerHelper.java | 6 +- ...d_server_location_GnssLocationProvider.cpp | 39 ++- 8 files changed, 480 insertions(+), 150 deletions(-) diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java index 70339005581fe..d2873e968e33b 100644 --- a/location/java/android/location/GnssMeasurement.java +++ b/location/java/android/location/GnssMeasurement.java @@ -47,6 +47,7 @@ public final class GnssMeasurement implements Parcelable { private double mCarrierPhaseUncertainty; private int mMultipathIndicator; private double mSnrInDb; + private double mAgcLevelDb; // The following enumerations must be in sync with the values declared in gps.h @@ -56,6 +57,7 @@ public final class GnssMeasurement implements Parcelable { private static final int HAS_CARRIER_CYCLES = (1<<10); private static final int HAS_CARRIER_PHASE = (1<<11); private static final int HAS_CARRIER_PHASE_UNCERTAINTY = (1<<12); + private static final int HAS_AUTOMATIC_GAIN_CONTROL = (1<<13); /** * The status of the multipath indicator. @@ -111,6 +113,20 @@ public final class GnssMeasurement implements Parcelable { public static final int STATE_GAL_E1B_PAGE_SYNC = (1<<12); /** This SBAS measurement's tracking state has whole second level sync. */ public static final int STATE_SBAS_SYNC = (1<<13); + /** + * This GNSS measurement's tracking state has time-of-week known, possibly not decoded + * over the air but has been determined from other sources. If TOW decoded is set then TOW Known + * will also be set. + * @hide + */ + public static final int STATE_TOW_KNOWN = (1<<14); + /** + * This Glonass measurement's tracking state has time-of-day known, possibly not decoded + * over the air but has been determined from other sources. If TOD decoded is set then TOD Known + * will also be set. + * @hide + */ + public static final int STATE_GLO_TOD_KNOWN = (1<<15); /** * All the GNSS receiver state flags, for bit masking purposes (not a sensible state for any @@ -180,6 +196,7 @@ public final class GnssMeasurement implements Parcelable { mCarrierPhaseUncertainty = measurement.mCarrierPhaseUncertainty; mMultipathIndicator = measurement.mMultipathIndicator; mSnrInDb = measurement.mSnrInDb; + mAgcLevelDb = measurement.mAgcLevelDb; } /** @@ -299,6 +316,9 @@ public final class GnssMeasurement implements Parcelable { if ((mState & STATE_TOW_DECODED) != 0) { builder.append("TowDecoded|"); } + if ((mState & STATE_TOW_KNOWN) != 0) { + builder.append("TowKnown|"); + } if ((mState & STATE_MSEC_AMBIGUOUS) != 0) { builder.append("MsecAmbiguous|"); } @@ -311,6 +331,9 @@ public final class GnssMeasurement implements Parcelable { if ((mState & STATE_GLO_TOD_DECODED) != 0) { builder.append("GloTodDecoded|"); } + if ((mState & STATE_GLO_TOD_KNOWN) != 0) { + builder.append("GloTodKnown|"); + } if ((mState & STATE_BDS_D2_BIT_SYNC) != 0) { builder.append("BdsD2BitSync|"); } @@ -356,10 +379,14 @@ public final class GnssMeasurement implements Parcelable { * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC is set * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC is set - * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED is set + * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED is set + * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set + * + * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has + * been determined from other sources. If TOW decoded is set then TOW Known must also be set. * *

Note well: if there is any ambiguity in integer millisecond, {@code STATE_MSEC_AMBIGUOUS} - * should be set accordingly, in the 'state' field. + * must be set accordingly, in the 'state' field. * *

This value must be populated if 'state' != {@code STATE_UNKNOWN}. * @@ -371,12 +398,17 @@ public final class GnssMeasurement implements Parcelable { *

Given the highest sync state that can be achieved, per each satellite, valid range for * this field can be: *

-     *     Searching       : [ 0       ]   : STATE_UNKNOWN
-     *     C/A code lock   : [ 0   1ms ]   : STATE_CODE_LOCK is set
-     *     Symbol sync     : [ 0  10ms ]   : STATE_SYMBOL_SYNC is set
-     *     Bit sync        : [ 0  20ms ]   : STATE_BIT_SYNC is set
-     *     String sync     : [ 0    2s ]   : STATE_GLO_STRING_SYNC is set
-     *     Time of day     : [ 0  1day ]   : STATE_GLO_TOD_DECODED is set
+ * Searching : [ 0 ] : STATE_UNKNOWN + * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set + * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC is set + * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC is set + * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC is set + * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED is set + * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set + * + * Note: Time of day known refers to the case where it is possibly not decoded over the air but + * has been determined from other sources. If Time of day decoded is set then Time of day known + * must also be set. * *

For Beidou, this is: *