summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yu-Han Yang <yuhany@google.com> 2018-12-07 15:13:31 -0800
committer Yu-Han Yang <yuhany@google.com> 2018-12-19 14:36:13 -0800
commit5400946b92076fbf3870a81a341d5a03f2da48d7 (patch)
tree397a377837a4431aef3cf129332ac6d338ab5895
parent473b204fa6537e5eaa6b64c2217ad021af1defe6 (diff)
Add CodeType to GnssMeasurement API
Bug: 120277977 Test: builds and tests passed. Change-Id: Id7f59d083b52e3179e60db560a2d84d1a94c402f
-rw-r--r--api/current.txt17
-rw-r--r--api/test-current.txt2
-rw-r--r--location/java/android/location/GnssMeasurement.java199
3 files changed, 214 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt
index 97a127d1dc7e..772a40d5cdd1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22515,6 +22515,7 @@ package android.location {
method public deprecated double getCarrierPhase();
method public deprecated double getCarrierPhaseUncertainty();
method public double getCn0DbHz();
+ method public int getCodeType();
method public int getConstellationType();
method public int getMultipathIndicator();
method public double getPseudorangeRateMetersPerSecond();
@@ -22530,6 +22531,7 @@ package android.location {
method public boolean hasCarrierFrequencyHz();
method public deprecated boolean hasCarrierPhase();
method public deprecated boolean hasCarrierPhaseUncertainty();
+ method public boolean hasCodeType();
method public boolean hasSnrInDb();
method public void writeToParcel(android.os.Parcel, int);
field public static final int ADR_STATE_CYCLE_SLIP = 4; // 0x4
@@ -22538,6 +22540,21 @@ package android.location {
field public static final int ADR_STATE_RESET = 2; // 0x2
field public static final int ADR_STATE_UNKNOWN = 0; // 0x0
field public static final int ADR_STATE_VALID = 1; // 0x1
+ field public static final int CODE_TYPE_A = 0; // 0x0
+ field public static final int CODE_TYPE_B = 1; // 0x1
+ field public static final int CODE_TYPE_C = 2; // 0x2
+ field public static final int CODE_TYPE_CODELESS = 13; // 0xd
+ field public static final int CODE_TYPE_I = 3; // 0x3
+ field public static final int CODE_TYPE_L = 4; // 0x4
+ field public static final int CODE_TYPE_M = 5; // 0x5
+ field public static final int CODE_TYPE_P = 6; // 0x6
+ field public static final int CODE_TYPE_Q = 7; // 0x7
+ field public static final int CODE_TYPE_S = 8; // 0x8
+ field public static final int CODE_TYPE_UNKNOWN = -1; // 0xffffffff
+ field public static final int CODE_TYPE_W = 9; // 0x9
+ field public static final int CODE_TYPE_X = 10; // 0xa
+ field public static final int CODE_TYPE_Y = 11; // 0xb
+ field public static final int CODE_TYPE_Z = 12; // 0xc
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
field public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2; // 0x2
diff --git a/api/test-current.txt b/api/test-current.txt
index dff3f28721d5..6d2291ed85a4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -572,6 +572,7 @@ package android.location {
method public void resetCarrierFrequencyHz();
method public deprecated void resetCarrierPhase();
method public deprecated void resetCarrierPhaseUncertainty();
+ method public void resetCodeType();
method public void resetSnrInDb();
method public void set(android.location.GnssMeasurement);
method public void setAccumulatedDeltaRangeMeters(double);
@@ -583,6 +584,7 @@ package android.location {
method public deprecated void setCarrierPhase(double);
method public deprecated void setCarrierPhaseUncertainty(double);
method public void setCn0DbHz(double);
+ method public void setCodeType(int);
method public void setConstellationType(int);
method public void setMultipathIndicator(int);
method public void setPseudorangeRateMetersPerSecond(double);
diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java
index f179bc3f9d3d..602cc3e6d0fd 100644
--- a/location/java/android/location/GnssMeasurement.java
+++ b/location/java/android/location/GnssMeasurement.java
@@ -48,6 +48,7 @@ public final class GnssMeasurement implements Parcelable {
private int mMultipathIndicator;
private double mSnrInDb;
private double mAutomaticGainControlLevelInDb;
+ private int mCodeType;
// The following enumerations must be in sync with the values declared in gps.h
@@ -58,6 +59,7 @@ public final class GnssMeasurement implements Parcelable {
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);
+ private static final int HAS_CODE_TYPE = (1 << 14);
/**
* The status of the multipath indicator.
@@ -202,6 +204,104 @@ public final class GnssMeasurement implements Parcelable {
public static final int ADR_STATE_HALF_CYCLE_REPORTED = (1<<4);
/**
+ * GNSS measurement code type.
+ * @hide
+ */
+ @IntDef(prefix = { "CODE_TYPE_" }, value = {
+ CODE_TYPE_UNKNOWN, CODE_TYPE_A, CODE_TYPE_B, CODE_TYPE_C, CODE_TYPE_I, CODE_TYPE_L,
+ CODE_TYPE_M, CODE_TYPE_P, CODE_TYPE_Q, CODE_TYPE_S, CODE_TYPE_W, CODE_TYPE_X,
+ CODE_TYPE_Y, CODE_TYPE_Z, CODE_TYPE_CODELESS
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CodeType {}
+
+ /** The GNSS Measurement's code type is unknown. */
+ public static final int CODE_TYPE_UNKNOWN = -1;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GALILEO E1A, GALILEO E6A, IRNSS
+ * L5A, IRNSS SA.
+ */
+ public static final int CODE_TYPE_A = 0;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GALILEO E1B, GALILEO E6B, IRNSS
+ * L5B, IRNSS SB.
+ */
+ public static final int CODE_TYPE_B = 1;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1 C/A, GPS L2 C/A, GLONASS G1
+ * C/A, GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C.
+ */
+ public static final int CODE_TYPE_C = 2;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L5 I, GLONASS G3 I, GALILEO E5a
+ * I, GALILEO E5b I, GALILEO E5a+b I, SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I.
+ */
+ public static final int CODE_TYPE_I = 3;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1C (P), GPS L2C (L), QZSS L1C
+ * (P), QZSS L2C (L), LEX(6) L.
+ */
+ public static final int CODE_TYPE_L = 4;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1M, GPS L2M.
+ */
+ public static final int CODE_TYPE_M = 5;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1P, GPS L2P, GLONASS G1P,
+ * GLONASS G2P.
+ */
+ public static final int CODE_TYPE_P = 6;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L5 Q, GLONASS G3 Q, GALILEO E5a
+ * Q, GALILEO E5b Q, GALILEO E5a+b Q, SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+ */
+ public static final int CODE_TYPE_Q = 7;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1C (D), GPS L2C (M), QZSS L1C
+ * (D), QZSS L2C (M), LEX(6) S.
+ */
+ public static final int CODE_TYPE_S = 8;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1 Z-tracking, GPS L2
+ * Z-tracking.
+ */
+ public static final int CODE_TYPE_W = 9;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1C (D+P), GPS L2C (M+L), GPS
+ * L5 (I+Q), GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO E5a (I+Q), GALILEO E5b (I+Q), GALILEO
+ * E5a+b(I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q),
+ * LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q), BDS B3 (I+Q), IRNSS L5 (B+C).
+ */
+ public static final int CODE_TYPE_X = 10;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1Y, GPS L2Y.
+ */
+ public static final int CODE_TYPE_Y = 11;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GALILEO E1 (A+B+C), GALILEO E6
+ * (A+B+C), QZSS L1-SAIF.
+ */
+ public static final int CODE_TYPE_Z = 12;
+
+ /**
+ * The GNSS Measurement's code type is one of the following: GPS L1 codeless, GPS L2 codeless.
+ */
+ public static final int CODE_TYPE_CODELESS = 13;
+
+ /**
* All the 'Accumulated Delta Range' flags.
* @hide
*/
@@ -248,6 +348,7 @@ public final class GnssMeasurement implements Parcelable {
mMultipathIndicator = measurement.mMultipathIndicator;
mSnrInDb = measurement.mSnrInDb;
mAutomaticGainControlLevelInDb = measurement.mAutomaticGainControlLevelInDb;
+ mCodeType = measurement.mCodeType;
}
/**
@@ -967,7 +1068,7 @@ public final class GnssMeasurement implements Parcelable {
* <p>For internal and logging use only.
*/
private String getMultipathIndicatorString() {
- switch(mMultipathIndicator) {
+ switch (mMultipathIndicator) {
case MULTIPATH_INDICATOR_UNKNOWN:
return "Unknown";
case MULTIPATH_INDICATOR_DETECTED:
@@ -1063,6 +1164,89 @@ public final class GnssMeasurement implements Parcelable {
mAutomaticGainControlLevelInDb = Double.NaN;
}
+ /**
+ * Returns {@code true} if {@link #getCodeType()} is available,
+ * {@code false} otherwise.
+ */
+ public boolean hasCodeType() {
+ return isFlagSet(HAS_CODE_TYPE);
+ }
+
+ /**
+ * Gets the GNSS measurement's code type.
+ *
+ * <p>Similar to the Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table
+ * A2 at the Rinex 3.03 Update 1 Document.
+ */
+ @CodeType
+ public int getCodeType() {
+ return mCodeType;
+ }
+
+ /**
+ * Sets the GNSS measurement's code type.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setCodeType(@CodeType int codeType) {
+ setFlag(HAS_CODE_TYPE);
+ mCodeType = codeType;
+ }
+
+ /**
+ * Resets the GNSS measurement's code type.
+ *
+ * @hide
+ */
+ @TestApi
+ public void resetCodeType() {
+ resetFlag(HAS_CODE_TYPE);
+ mCodeType = CODE_TYPE_UNKNOWN;
+ }
+
+ /**
+ * Gets a string representation of the 'code type'.
+ *
+ * <p>For internal and logging use only.
+ */
+ private String getCodeTypeString() {
+ switch (mCodeType) {
+ case CODE_TYPE_UNKNOWN:
+ return "CODE_TYPE_UNKNOWN";
+ case CODE_TYPE_A:
+ return "CODE_TYPE_A";
+ case CODE_TYPE_B:
+ return "CODE_TYPE_B";
+ case CODE_TYPE_C:
+ return "CODE_TYPE_C";
+ case CODE_TYPE_I:
+ return "CODE_TYPE_I";
+ case CODE_TYPE_L:
+ return "CODE_TYPE_L";
+ case CODE_TYPE_M:
+ return "CODE_TYPE_M";
+ case CODE_TYPE_P:
+ return "CODE_TYPE_P";
+ case CODE_TYPE_Q:
+ return "CODE_TYPE_Q";
+ case CODE_TYPE_S:
+ return "CODE_TYPE_S";
+ case CODE_TYPE_W:
+ return "CODE_TYPE_W";
+ case CODE_TYPE_X:
+ return "CODE_TYPE_X";
+ case CODE_TYPE_Y:
+ return "CODE_TYPE_Y";
+ case CODE_TYPE_Z:
+ return "CODE_TYPE_Z";
+ case CODE_TYPE_CODELESS:
+ return "CODE_TYPE_CODELESS";
+ default:
+ return "<Invalid: " + mCodeType + ">";
+ }
+ }
+
public static final Creator<GnssMeasurement> CREATOR = new Creator<GnssMeasurement>() {
@Override
public GnssMeasurement createFromParcel(Parcel parcel) {
@@ -1088,6 +1272,7 @@ public final class GnssMeasurement implements Parcelable {
gnssMeasurement.mMultipathIndicator = parcel.readInt();
gnssMeasurement.mSnrInDb = parcel.readDouble();
gnssMeasurement.mAutomaticGainControlLevelInDb = parcel.readDouble();
+ gnssMeasurement.mCodeType = parcel.readInt();
return gnssMeasurement;
}
@@ -1120,6 +1305,7 @@ public final class GnssMeasurement implements Parcelable {
parcel.writeInt(mMultipathIndicator);
parcel.writeDouble(mSnrInDb);
parcel.writeDouble(mAutomaticGainControlLevelInDb);
+ parcel.writeInt(mCodeType);
}
@Override
@@ -1191,9 +1377,13 @@ public final class GnssMeasurement implements Parcelable {
"SnrInDb",
hasSnrInDb() ? mSnrInDb : null));
builder.append(String.format(
- format,
- "AgcLevelDb",
- hasAutomaticGainControlLevelDb() ? mAutomaticGainControlLevelInDb : null));
+ format,
+ "AgcLevelDb",
+ hasAutomaticGainControlLevelDb() ? mAutomaticGainControlLevelInDb : null));
+ builder.append(String.format(
+ format,
+ "CodeType",
+ hasCodeType() ? getCodeTypeString() : null));
return builder.toString();
}
@@ -1218,6 +1408,7 @@ public final class GnssMeasurement implements Parcelable {
setMultipathIndicator(MULTIPATH_INDICATOR_UNKNOWN);
resetSnrInDb();
resetAutomaticGainControlLevel();
+ resetCodeType();
}
private void setFlag(int flag) {