summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorYu-Han Yang <yuhany@google.com>2020-01-14 15:31:01 -0800
committerYu-Han Yang <yuhany@google.com>2020-01-22 16:42:19 -0800
commitad03c473692b3b9aa68d8d2f0292415a2f094d6d (patch)
tree869ed5e62439a3696e8ecf4e1793436368324ee5 /location
parent805f3c1db5b9793684e310a559c4efa8c7de9eff (diff)
Add inter-signal bias fields to GnssMeasurement and GnssClock
Bug: 147500886 Test: atest GnssMeasurementTest atest GnssClockTest Change-Id: I8adaf1c1b0f6478695ca9b4768568af0ebfb11d4
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/GnssClock.java217
-rw-r--r--location/java/android/location/GnssMeasurement.java320
2 files changed, 462 insertions, 75 deletions
diff --git a/location/java/android/location/GnssClock.java b/location/java/android/location/GnssClock.java
index 8a7878b46e89..ed4bf1b2d53e 100644
--- a/location/java/android/location/GnssClock.java
+++ b/location/java/android/location/GnssClock.java
@@ -17,6 +17,7 @@
package android.location;
import android.annotation.FloatRange;
+import android.annotation.NonNull;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -39,6 +40,9 @@ public final class GnssClock implements Parcelable {
private static final int HAS_DRIFT_UNCERTAINTY = (1<<6);
private static final int HAS_ELAPSED_REALTIME_NANOS = (1 << 7);
private static final int HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS = (1 << 8);
+ private static final int HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB = (1 << 9);
+ private static final int HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB = (1 << 10);
+ private static final int HAS_REFERENCE_CODE_TYPE_FOR_ISB = (1 << 11);
// End enumerations in sync with gps.h
@@ -54,6 +58,9 @@ public final class GnssClock implements Parcelable {
private int mHardwareClockDiscontinuityCount;
private long mElapsedRealtimeNanos;
private double mElapsedRealtimeUncertaintyNanos;
+ private int mReferenceConstellationTypeForIsb;
+ private double mReferenceCarrierFrequencyHzForIsb;
+ private String mReferenceCodeTypeForIsb;
/**
* @hide
@@ -81,6 +88,9 @@ public final class GnssClock implements Parcelable {
mHardwareClockDiscontinuityCount = clock.mHardwareClockDiscontinuityCount;
mElapsedRealtimeNanos = clock.mElapsedRealtimeNanos;
mElapsedRealtimeUncertaintyNanos = clock.mElapsedRealtimeUncertaintyNanos;
+ mReferenceConstellationTypeForIsb = clock.mReferenceConstellationTypeForIsb;
+ mReferenceCarrierFrequencyHzForIsb = clock.mReferenceCarrierFrequencyHzForIsb;
+ mReferenceCodeTypeForIsb = clock.mReferenceCodeTypeForIsb;
}
/**
@@ -196,7 +206,6 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetTimeUncertaintyNanos() {
resetFlag(HAS_TIME_UNCERTAINTY);
- mTimeUncertaintyNanos = Double.NaN;
}
/**
@@ -286,7 +295,6 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetBiasNanos() {
resetFlag(HAS_BIAS);
- mBiasNanos = Double.NaN;
}
/**
@@ -327,7 +335,6 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetBiasUncertaintyNanos() {
resetFlag(HAS_BIAS_UNCERTAINTY);
- mBiasUncertaintyNanos = Double.NaN;
}
/**
@@ -371,7 +378,6 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetDriftNanosPerSecond() {
resetFlag(HAS_DRIFT);
- mDriftNanosPerSecond = Double.NaN;
}
/**
@@ -411,7 +417,6 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetDriftUncertaintyNanosPerSecond() {
resetFlag(HAS_DRIFT_UNCERTAINTY);
- mDriftUncertaintyNanosPerSecond = Double.NaN;
}
/**
@@ -495,7 +500,128 @@ public final class GnssClock implements Parcelable {
@TestApi
public void resetElapsedRealtimeUncertaintyNanos() {
resetFlag(HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS);
- mElapsedRealtimeUncertaintyNanos = Double.NaN;
+ }
+
+ /**
+ * Returns {@code true} if {@link #getReferenceConstellationTypeForIsb()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasReferenceConstellationTypeForIsb() {
+ return isFlagSet(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
+ }
+
+ /**
+ * Returns the reference constellation type for inter-signal bias.
+ *
+ * <p>The value is only available if {@link #hasReferenceConstellationTypeForIsb()} is
+ * {@code true}.
+ *
+ * <p>The return value is one of those constants with {@code CONSTELLATION_} prefix in
+ * {@link GnssStatus}.
+ */
+ @GnssStatus.ConstellationType
+ public int getReferenceConstellationTypeForIsb() {
+ return mReferenceConstellationTypeForIsb;
+ }
+
+ /**
+ * Sets the reference constellation type for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void setReferenceConstellationTypeForIsb(@GnssStatus.ConstellationType int value) {
+ setFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
+ mReferenceConstellationTypeForIsb = value;
+ }
+
+ /**
+ * Resets the reference constellation type for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void resetReferenceConstellationTypeForIsb() {
+ resetFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
+ mReferenceConstellationTypeForIsb = GnssStatus.CONSTELLATION_UNKNOWN;
+ }
+
+ /**
+ * Returns {@code true} if {@link #getReferenceCarrierFrequencyHzForIsb()} is available, {@code
+ * false} otherwise.
+ */
+ public boolean hasReferenceCarrierFrequencyHzForIsb() {
+ return isFlagSet(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
+ }
+
+ /**
+ * Returns the reference carrier frequency in Hz for inter-signal bias.
+ *
+ * <p>The value is only available if {@link #hasReferenceCarrierFrequencyHzForIsb()} is
+ * {@code true}.
+ */
+ @FloatRange(from = 0.0)
+ public double getReferenceCarrierFrequencyHzForIsb() {
+ return mReferenceCarrierFrequencyHzForIsb;
+ }
+
+ /**
+ * Sets the reference carrier frequency in Hz for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from = 0.0) double value) {
+ setFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
+ mReferenceCarrierFrequencyHzForIsb = value;
+ }
+
+ /**
+ * Resets the reference carrier frequency in Hz for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void resetReferenceCarrierFrequencyHzForIsb() {
+ resetFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
+ }
+
+ /**
+ * Returns {@code true} if {@link #getReferenceCodeTypeForIsb()} is available, {@code
+ * false} otherwise.
+ */
+ public boolean hasReferenceCodeTypeForIsb() {
+ return isFlagSet(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
+ }
+
+ /**
+ * Returns the reference code type for inter-signal bias.
+ *
+ * <p>The value is only available if {@link #hasReferenceCodeTypeForIsb()} is
+ * {@code true}.
+ *
+ * <p>The return value is one of those constants defined in
+ * {@link GnssMeasurement#getCodeType()}.
+ */
+ @NonNull
+ public String getReferenceCodeTypeForIsb() {
+ return mReferenceCodeTypeForIsb;
+ }
+
+ /**
+ * Sets the reference code type for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void setReferenceCodeTypeForIsb(@NonNull String codeType) {
+ setFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
+ mReferenceCodeTypeForIsb = codeType;
+ }
+
+ /**
+ * Resets the reference code type for inter-signal bias.
+ * @hide
+ */
+ @TestApi
+ public void resetReferenceCodeTypeForIsb() {
+ resetFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
+ mReferenceCodeTypeForIsb = "UNKNOWN";
}
/**
@@ -543,6 +669,9 @@ public final class GnssClock implements Parcelable {
gpsClock.mHardwareClockDiscontinuityCount = parcel.readInt();
gpsClock.mElapsedRealtimeNanos = parcel.readLong();
gpsClock.mElapsedRealtimeUncertaintyNanos = parcel.readDouble();
+ gpsClock.mReferenceConstellationTypeForIsb = parcel.readInt();
+ gpsClock.mReferenceCarrierFrequencyHzForIsb = parcel.readDouble();
+ gpsClock.mReferenceCodeTypeForIsb = parcel.readString();
return gpsClock;
}
@@ -567,6 +696,9 @@ public final class GnssClock implements Parcelable {
parcel.writeInt(mHardwareClockDiscontinuityCount);
parcel.writeLong(mElapsedRealtimeNanos);
parcel.writeDouble(mElapsedRealtimeUncertaintyNanos);
+ parcel.writeInt(mReferenceConstellationTypeForIsb);
+ parcel.writeDouble(mReferenceCarrierFrequencyHzForIsb);
+ parcel.writeString(mReferenceCodeTypeForIsb);
}
@Override
@@ -580,7 +712,9 @@ public final class GnssClock implements Parcelable {
final String formatWithUncertainty = " %-15s = %-25s %-26s = %s\n";
StringBuilder builder = new StringBuilder("GnssClock:\n");
- builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null));
+ if (hasLeapSecond()) {
+ builder.append(String.format(format, "LeapSecond", mLeapSecond));
+ }
builder.append(String.format(
formatWithUncertainty,
@@ -589,39 +723,57 @@ public final class GnssClock implements Parcelable {
"TimeUncertaintyNanos",
hasTimeUncertaintyNanos() ? mTimeUncertaintyNanos : null));
- builder.append(String.format(
- format,
- "FullBiasNanos",
- hasFullBiasNanos() ? mFullBiasNanos : null));
+ if (hasFullBiasNanos()) {
+ builder.append(String.format(format, "FullBiasNanos", mFullBiasNanos));
+ }
- builder.append(String.format(
- formatWithUncertainty,
- "BiasNanos",
- hasBiasNanos() ? mBiasNanos : null,
- "BiasUncertaintyNanos",
- hasBiasUncertaintyNanos() ? mBiasUncertaintyNanos : null));
+ if (hasBiasNanos() || hasBiasUncertaintyNanos()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "BiasNanos",
+ hasBiasNanos() ? mBiasNanos : null,
+ "BiasUncertaintyNanos",
+ hasBiasUncertaintyNanos() ? mBiasUncertaintyNanos : null));
+ }
- builder.append(String.format(
- formatWithUncertainty,
- "DriftNanosPerSecond",
- hasDriftNanosPerSecond() ? mDriftNanosPerSecond : null,
- "DriftUncertaintyNanosPerSecond",
- hasDriftUncertaintyNanosPerSecond() ? mDriftUncertaintyNanosPerSecond : null));
+ if (hasDriftNanosPerSecond() || hasDriftUncertaintyNanosPerSecond()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "DriftNanosPerSecond",
+ hasDriftNanosPerSecond() ? mDriftNanosPerSecond : null,
+ "DriftUncertaintyNanosPerSecond",
+ hasDriftUncertaintyNanosPerSecond() ? mDriftUncertaintyNanosPerSecond : null));
+ }
builder.append(String.format(
format,
"HardwareClockDiscontinuityCount",
mHardwareClockDiscontinuityCount));
- builder.append(String.format(
- format,
- "ElapsedRealtimeNanos",
- hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null));
+ if (hasElapsedRealtimeNanos() || hasElapsedRealtimeUncertaintyNanos()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "ElapsedRealtimeNanos",
+ hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null,
+ "ElapsedRealtimeUncertaintyNanos",
+ hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos
+ : null));
+ }
- builder.append(String.format(
- format,
- "ElapsedRealtimeUncertaintyNanos",
- hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos : null));
+ if (hasReferenceConstellationTypeForIsb()) {
+ builder.append(String.format(format, "ReferenceConstellationTypeForIsb",
+ mReferenceConstellationTypeForIsb));
+ }
+
+ if (hasReferenceCarrierFrequencyHzForIsb()) {
+ builder.append(String.format(format, "ReferenceCarrierFrequencyHzForIsb",
+ mReferenceCarrierFrequencyHzForIsb));
+ }
+
+ if (hasReferenceCodeTypeForIsb()) {
+ builder.append(
+ String.format(format, "ReferenceCodeTypeForIsb", mReferenceCodeTypeForIsb));
+ }
return builder.toString();
}
@@ -639,6 +791,9 @@ public final class GnssClock implements Parcelable {
setHardwareClockDiscontinuityCount(Integer.MIN_VALUE);
resetElapsedRealtimeNanos();
resetElapsedRealtimeUncertaintyNanos();
+ resetReferenceConstellationTypeForIsb();
+ resetReferenceCarrierFrequencyHzForIsb();
+ resetReferenceCodeTypeForIsb();
}
private void setFlag(int flag) {
diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java
index 70abbb3019fc..75097f9a3229 100644
--- a/location/java/android/location/GnssMeasurement.java
+++ b/location/java/android/location/GnssMeasurement.java
@@ -16,11 +16,21 @@
package android.location;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_AUTOMATIC_GAIN_CONTROL;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_CYCLES;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_FREQUENCY;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_PHASE;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_CARRIER_PHASE_UNCERTAINTY;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_RECEIVER_ISB;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_RECEIVER_ISB_UNCERTAINTY;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SATELLITE_ISB;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SATELLITE_ISB_UNCERTAINTY;
+import static android.hardware.gnss.V2_1.IGnssMeasurementCallback.GnssMeasurementFlags.HAS_SNR;
+
import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
-import android.hardware.gnss.V1_0.IGnssMeasurementCallback.GnssMeasurementFlags;
import android.os.Parcel;
import android.os.Parcelable;
@@ -53,19 +63,14 @@ public final class GnssMeasurement implements Parcelable {
private double mSnrInDb;
private double mAutomaticGainControlLevelInDb;
@NonNull private String mCodeType;
+ private double mReceiverInterSignalBiasNanos;
+ private double mReceiverInterSignalBiasUncertaintyNanos;
+ private double mSatelliteInterSignalBiasNanos;
+ private double mSatelliteInterSignalBiasUncertaintyNanos;
// The following enumerations must be in sync with the values declared in GNSS HAL.
private static final int HAS_NO_FLAGS = 0;
- private static final int HAS_SNR = GnssMeasurementFlags.HAS_SNR;
- private static final int HAS_CARRIER_FREQUENCY = GnssMeasurementFlags.HAS_CARRIER_FREQUENCY;
- private static final int HAS_CARRIER_CYCLES = GnssMeasurementFlags.HAS_CARRIER_CYCLES;
- private static final int HAS_CARRIER_PHASE = GnssMeasurementFlags.HAS_CARRIER_PHASE;
- private static final int HAS_CARRIER_PHASE_UNCERTAINTY =
- GnssMeasurementFlags.HAS_CARRIER_PHASE_UNCERTAINTY;
- private static final int HAS_AUTOMATIC_GAIN_CONTROL =
- GnssMeasurementFlags.HAS_AUTOMATIC_GAIN_CONTROL;
-
private static final int HAS_CODE_TYPE = (1 << 14);
private static final int HAS_BASEBAND_CN0 = (1 << 15);
@@ -263,6 +268,12 @@ public final class GnssMeasurement implements Parcelable {
mSnrInDb = measurement.mSnrInDb;
mAutomaticGainControlLevelInDb = measurement.mAutomaticGainControlLevelInDb;
mCodeType = measurement.mCodeType;
+ mReceiverInterSignalBiasNanos = measurement.mReceiverInterSignalBiasNanos;
+ mReceiverInterSignalBiasUncertaintyNanos =
+ measurement.mReceiverInterSignalBiasUncertaintyNanos;
+ mSatelliteInterSignalBiasNanos = measurement.mSatelliteInterSignalBiasNanos;
+ mSatelliteInterSignalBiasUncertaintyNanos =
+ measurement.mSatelliteInterSignalBiasUncertaintyNanos;
}
/**
@@ -835,7 +846,6 @@ public final class GnssMeasurement implements Parcelable {
@TestApi
public void resetBasebandCn0DbHz() {
resetFlag(HAS_BASEBAND_CN0);
- mBasebandCn0DbHz = Double.NaN;
}
/**
@@ -1166,7 +1176,6 @@ public final class GnssMeasurement implements Parcelable {
@Deprecated
public void resetCarrierPhase() {
resetFlag(HAS_CARRIER_PHASE);
- mCarrierPhase = Double.NaN;
}
/**
@@ -1221,7 +1230,6 @@ public final class GnssMeasurement implements Parcelable {
@Deprecated
public void resetCarrierPhaseUncertainty() {
resetFlag(HAS_CARRIER_PHASE_UNCERTAINTY);
- mCarrierPhaseUncertainty = Double.NaN;
}
/**
@@ -1292,7 +1300,6 @@ public final class GnssMeasurement implements Parcelable {
@TestApi
public void resetSnrInDb() {
resetFlag(HAS_SNR);
- mSnrInDb = Double.NaN;
}
/**
@@ -1340,7 +1347,6 @@ public final class GnssMeasurement implements Parcelable {
@TestApi
public void resetAutomaticGainControlLevel() {
resetFlag(HAS_AUTOMATIC_GAIN_CONTROL);
- mAutomaticGainControlLevelInDb = Double.NaN;
}
/**
@@ -1425,7 +1431,200 @@ public final class GnssMeasurement implements Parcelable {
mCodeType = "UNKNOWN";
}
- public static final @android.annotation.NonNull Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() {
+ /**
+ * Returns {@code true} if {@link #getReceiverInterSignalBiasNanos()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasReceiverInterSignalBiasNanos() {
+ return isFlagSet(HAS_RECEIVER_ISB);
+ }
+
+ /**
+ * Gets the GNSS measurement's receiver inter-signal bias in nanoseconds with sub-nanosecond
+ * accuracy.
+ *
+ * <p>This value is the estimated receiver-side inter-system (different from the
+ * constellation in {@link GnssClock#getReferenceConstellationTypeForIsb()} bias and
+ * inter-frequency (different from the carrier frequency in
+ * {@link GnssClock#getReferenceCarrierFrequencyHzForIsb()}) bias. The reported receiver
+ * inter-signal bias must include signal delays caused by:
+ *
+ * <ul>
+ * <li>Receiver inter-constellation bias</li>
+ * <li>Receiver inter-frequency bias</li>
+ * <li>Receiver inter-code bias</li>
+ * </ul>
+ *
+ * <p>The value does not include the inter-frequency Ionospheric bias.
+ *
+ * <p>The value is only available if {@link #hasReceiverInterSignalBiasNanos()} is {@code true}.
+ */
+ public double getReceiverInterSignalBiasNanos() {
+ return mReceiverInterSignalBiasNanos;
+ }
+
+ /**
+ * Sets the GNSS measurement's receiver inter-signal bias in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setReceiverInterSignalBiasNanos(double receiverInterSignalBiasNanos) {
+ setFlag(HAS_RECEIVER_ISB);
+ mReceiverInterSignalBiasNanos = receiverInterSignalBiasNanos;
+ }
+
+ /**
+ * Resets the GNSS measurement's receiver inter-signal bias in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void resetReceiverInterSignalBiasNanos() {
+ resetFlag(HAS_RECEIVER_ISB);
+ }
+
+ /**
+ * Returns {@code true} if {@link #getReceiverInterSignalBiasUncertaintyNanos()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasReceiverInterSignalBiasUncertaintyNanos() {
+ return isFlagSet(HAS_RECEIVER_ISB_UNCERTAINTY);
+ }
+
+ /**
+ * Gets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in
+ * nanoseconds with sub-nanosecond accuracy.
+ *
+ * <p>The value is only available if {@link #hasReceiverInterSignalBiasUncertaintyNanos()} is
+ * {@code true}.
+ */
+ @FloatRange(from = 0.0)
+ public double getReceiverInterSignalBiasUncertaintyNanos() {
+ return mReceiverInterSignalBiasUncertaintyNanos;
+ }
+
+ /**
+ * Sets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setReceiverInterSignalBiasUncertaintyNanos(@FloatRange(from = 0.0)
+ double receiverInterSignalBiasUncertaintyNanos) {
+ setFlag(HAS_RECEIVER_ISB_UNCERTAINTY);
+ mReceiverInterSignalBiasUncertaintyNanos = receiverInterSignalBiasUncertaintyNanos;
+ }
+
+ /**
+ * Resets the GNSS measurement's receiver inter-signal bias uncertainty (1 sigma) in
+ * nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void resetReceiverInterSignalBiasUncertaintyNanos() {
+ resetFlag(HAS_RECEIVER_ISB_UNCERTAINTY);
+ }
+
+ /**
+ * Returns {@code true} if {@link #getSatelliteInterSignalBiasNanos()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasSatelliteInterSignalBiasNanos() {
+ return isFlagSet(HAS_SATELLITE_ISB);
+ }
+
+ /**
+ * Gets the GNSS measurement's satellite inter-signal bias in nanoseconds with sub-nanosecond
+ * accuracy.
+ *
+ * <p>This value is the satellite-and-control-segment-side inter-system (different from the
+ * constellation in {@link GnssClock#getReferenceConstellationTypeForIsb()}) bias and
+ * inter-frequency (different from the carrier frequency in
+ * {@link GnssClock#getReferenceCarrierFrequencyHzForIsb()}) bias, including:
+ *
+ * <ul>
+ * <li>Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPT-UTC Time Offset (TauGps),
+ * BDS-GLO Time Offset (BGTO))</li>
+ * <li>Group delay (e.g., Total Group Delay (TGD))</li>
+ * <li>Satellite inter-signal bias, which includes satellite inter-frequency bias (GLO only),
+ * and satellite inter-code bias (e.g., Differential Code Bias (DCB)).</li>
+ * </ul>
+ *
+ * <p>The value is only available if {@link #hasSatelliteInterSignalBiasNanos()} is {@code
+ * true}.
+ */
+ public double getSatelliteInterSignalBiasNanos() {
+ return mSatelliteInterSignalBiasNanos;
+ }
+
+ /**
+ * Sets the GNSS measurement's satellite inter-signal bias in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setSatelliteInterSignalBiasNanos(double satelliteInterSignalBiasNanos) {
+ setFlag(HAS_SATELLITE_ISB);
+ mSatelliteInterSignalBiasNanos = satelliteInterSignalBiasNanos;
+ }
+
+ /**
+ * Resets the GNSS measurement's satellite inter-signal bias in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void resetSatelliteInterSignalBiasNanos() {
+ resetFlag(HAS_SATELLITE_ISB);
+ }
+
+ /**
+ * Returns {@code true} if {@link #getSatelliteInterSignalBiasUncertaintyNanos()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasSatelliteInterSignalBiasUncertaintyNanos() {
+ return isFlagSet(HAS_SATELLITE_ISB_UNCERTAINTY);
+ }
+
+ /**
+ * Gets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in
+ * nanoseconds with sub-nanosecond accuracy.
+ *
+ * <p>The value is only available if {@link #hasSatelliteInterSignalBiasUncertaintyNanos()} is
+ * {@code true}.
+ */
+ @FloatRange(from = 0.0)
+ public double getSatelliteInterSignalBiasUncertaintyNanos() {
+ return mSatelliteInterSignalBiasUncertaintyNanos;
+ }
+
+ /**
+ * Sets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from = 0.0)
+ double satelliteInterSignalBiasUncertaintyNanos) {
+ setFlag(HAS_SATELLITE_ISB_UNCERTAINTY);
+ mSatelliteInterSignalBiasUncertaintyNanos = satelliteInterSignalBiasUncertaintyNanos;
+ }
+
+ /**
+ * Resets the GNSS measurement's satellite inter-signal bias uncertainty (1 sigma) in
+ * nanoseconds.
+ *
+ * @hide
+ */
+ @TestApi
+ public void resetSatelliteInterSignalBiasUncertaintyNanos() {
+ resetFlag(HAS_SATELLITE_ISB_UNCERTAINTY);
+ }
+
+
+ public static final @NonNull Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() {
@Override
public GnssMeasurement createFromParcel(Parcel parcel) {
GnssMeasurement gnssMeasurement = new GnssMeasurement();
@@ -1452,6 +1651,10 @@ public final class GnssMeasurement implements Parcelable {
gnssMeasurement.mAutomaticGainControlLevelInDb = parcel.readDouble();
gnssMeasurement.mCodeType = parcel.readString();
gnssMeasurement.mBasebandCn0DbHz = parcel.readDouble();
+ gnssMeasurement.mReceiverInterSignalBiasNanos = parcel.readDouble();
+ gnssMeasurement.mReceiverInterSignalBiasUncertaintyNanos = parcel.readDouble();
+ gnssMeasurement.mSatelliteInterSignalBiasNanos = parcel.readDouble();
+ gnssMeasurement.mSatelliteInterSignalBiasUncertaintyNanos = parcel.readDouble();
return gnssMeasurement;
}
@@ -1486,6 +1689,10 @@ public final class GnssMeasurement implements Parcelable {
parcel.writeDouble(mAutomaticGainControlLevelInDb);
parcel.writeString(mCodeType);
parcel.writeDouble(mBasebandCn0DbHz);
+ parcel.writeDouble(mReceiverInterSignalBiasNanos);
+ parcel.writeDouble(mReceiverInterSignalBiasUncertaintyNanos);
+ parcel.writeDouble(mSatelliteInterSignalBiasNanos);
+ parcel.writeDouble(mSatelliteInterSignalBiasUncertaintyNanos);
}
@Override
@@ -1514,8 +1721,9 @@ public final class GnssMeasurement implements Parcelable {
builder.append(String.format(format, "Cn0DbHz", mCn0DbHz));
- builder.append(String.format(format, "BasebandCn0DbHz",
- hasBasebandCn0DbHz() ? mBasebandCn0DbHz : null));
+ if (hasBasebandCn0DbHz()) {
+ builder.append(String.format(format, "BasebandCn0DbHz", mBasebandCn0DbHz));
+ }
builder.append(String.format(
formatWithUncertainty,
@@ -1536,37 +1744,57 @@ public final class GnssMeasurement implements Parcelable {
"AccumulatedDeltaRangeUncertaintyMeters",
mAccumulatedDeltaRangeUncertaintyMeters));
- builder.append(String.format(
- format,
- "CarrierFrequencyHz",
- hasCarrierFrequencyHz() ? mCarrierFrequencyHz : null));
+ if (hasCarrierFrequencyHz()) {
+ builder.append(String.format(format, "CarrierFrequencyHz", mCarrierFrequencyHz));
+ }
- builder.append(String.format(
- format,
- "CarrierCycles",
- hasCarrierCycles() ? mCarrierCycles : null));
+ if (hasCarrierCycles()) {
+ builder.append(String.format(format, "CarrierCycles", mCarrierCycles));
+ }
- builder.append(String.format(
- formatWithUncertainty,
- "CarrierPhase",
- hasCarrierPhase() ? mCarrierPhase : null,
- "CarrierPhaseUncertainty",
- hasCarrierPhaseUncertainty() ? mCarrierPhaseUncertainty : null));
+ if (hasCarrierPhase() || hasCarrierPhaseUncertainty()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "CarrierPhase",
+ hasCarrierPhase() ? mCarrierPhase : null,
+ "CarrierPhaseUncertainty",
+ hasCarrierPhaseUncertainty() ? mCarrierPhaseUncertainty : null));
+ }
builder.append(String.format(format, "MultipathIndicator", getMultipathIndicatorString()));
- builder.append(String.format(
- format,
- "SnrInDb",
- hasSnrInDb() ? mSnrInDb : null));
- builder.append(String.format(
- format,
- "AgcLevelDb",
- hasAutomaticGainControlLevelDb() ? mAutomaticGainControlLevelInDb : null));
- builder.append(String.format(
- format,
- "CodeType",
- hasCodeType() ? mCodeType : null));
+ if (hasSnrInDb()) {
+ builder.append(String.format(format, "SnrInDb", mSnrInDb));
+ }
+
+ if (hasAutomaticGainControlLevelDb()) {
+ builder.append(String.format(format, "AgcLevelDb", mAutomaticGainControlLevelInDb));
+ }
+
+ if (hasCodeType()) {
+ builder.append(String.format(format, "CodeType", mCodeType));
+ }
+
+ if (hasReceiverInterSignalBiasNanos() || hasReceiverInterSignalBiasUncertaintyNanos()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "ReceiverInterSignalBiasNs",
+ hasReceiverInterSignalBiasNanos() ? mReceiverInterSignalBiasNanos : null,
+ "ReceiverInterSignalBiasUncertaintyNs",
+ hasReceiverInterSignalBiasUncertaintyNanos()
+ ? mReceiverInterSignalBiasUncertaintyNanos : null));
+ }
+
+ if (hasSatelliteInterSignalBiasNanos() || hasSatelliteInterSignalBiasUncertaintyNanos()) {
+ builder.append(String.format(
+ formatWithUncertainty,
+ "SatelliteInterSignalBiasNs",
+ hasSatelliteInterSignalBiasNanos() ? mSatelliteInterSignalBiasNanos : null,
+ "SatelliteInterSignalBiasUncertaintyNs",
+ hasSatelliteInterSignalBiasUncertaintyNanos()
+ ? mSatelliteInterSignalBiasUncertaintyNanos
+ : null));
+ }
return builder.toString();
}
@@ -1593,6 +1821,10 @@ public final class GnssMeasurement implements Parcelable {
resetAutomaticGainControlLevel();
resetCodeType();
resetBasebandCn0DbHz();
+ resetReceiverInterSignalBiasNanos();
+ resetReceiverInterSignalBiasUncertaintyNanos();
+ resetSatelliteInterSignalBiasNanos();
+ resetSatelliteInterSignalBiasUncertaintyNanos();
}
private void setFlag(int flag) {