Merge "Optimized the memory consumption and renamed PRN" into nyc-dev
This commit is contained in:
@@ -19221,7 +19221,6 @@ package android.location {
|
||||
method public double getElevationUncertaintyInDeg();
|
||||
method public byte getLossOfLock();
|
||||
method public byte getMultipathIndicator();
|
||||
method public byte getPrn();
|
||||
method public double getPseudorangeInMeters();
|
||||
method public double getPseudorangeRateCarrierInMetersPerSec();
|
||||
method public double getPseudorangeRateCarrierUncertaintyInMetersPerSec();
|
||||
@@ -19232,6 +19231,7 @@ package android.location {
|
||||
method public long getReceivedGpsTowUncertaintyInNs();
|
||||
method public double getSnrInDb();
|
||||
method public short getState();
|
||||
method public short getSvid();
|
||||
method public short getTimeFromLastBitInMs();
|
||||
method public double getTimeOffsetInNs();
|
||||
method public boolean hasAzimuthInDeg();
|
||||
@@ -19291,7 +19291,6 @@ package android.location {
|
||||
method public void setElevationUncertaintyInDeg(double);
|
||||
method public void setLossOfLock(byte);
|
||||
method public void setMultipathIndicator(byte);
|
||||
method public void setPrn(byte);
|
||||
method public void setPseudorangeInMeters(double);
|
||||
method public void setPseudorangeRateCarrierInMetersPerSec(double);
|
||||
method public void setPseudorangeRateCarrierUncertaintyInMetersPerSec(double);
|
||||
@@ -19302,6 +19301,7 @@ package android.location {
|
||||
method public void setReceivedGpsTowUncertaintyInNs(long);
|
||||
method public void setSnrInDb(double);
|
||||
method public void setState(short);
|
||||
method public void setSvid(short);
|
||||
method public void setTimeFromLastBitInMs(short);
|
||||
method public void setTimeOffsetInNs(double);
|
||||
method public void setUsedInFix(boolean);
|
||||
@@ -19356,17 +19356,17 @@ package android.location {
|
||||
method public int describeContents();
|
||||
method public byte[] getData();
|
||||
method public short getMessageId();
|
||||
method public byte getPrn();
|
||||
method public short getStatus();
|
||||
method public short getSubmessageId();
|
||||
method public short getSvid();
|
||||
method public byte getType();
|
||||
method public void reset();
|
||||
method public void set(android.location.GnssNavigationMessage);
|
||||
method public void setData(byte[]);
|
||||
method public void setMessageId(short);
|
||||
method public void setPrn(byte);
|
||||
method public void setStatus(short);
|
||||
method public void setSubmessageId(short);
|
||||
method public void setSvid(short);
|
||||
method public void setType(byte);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
|
||||
@@ -19412,8 +19412,8 @@ package android.location {
|
||||
method public int getConstellationType(int);
|
||||
method public float getElevation(int);
|
||||
method public int getNumSatellites();
|
||||
method public int getPrn(int);
|
||||
method public float getSnr(int);
|
||||
method public int getSvid(int);
|
||||
method public boolean hasAlmanac(int);
|
||||
method public boolean hasEphemeris(int);
|
||||
method public boolean usedInFix(int);
|
||||
|
||||
@@ -20401,7 +20401,6 @@ package android.location {
|
||||
method public double getElevationUncertaintyInDeg();
|
||||
method public byte getLossOfLock();
|
||||
method public byte getMultipathIndicator();
|
||||
method public byte getPrn();
|
||||
method public double getPseudorangeInMeters();
|
||||
method public double getPseudorangeRateCarrierInMetersPerSec();
|
||||
method public double getPseudorangeRateCarrierUncertaintyInMetersPerSec();
|
||||
@@ -20412,6 +20411,7 @@ package android.location {
|
||||
method public long getReceivedGpsTowUncertaintyInNs();
|
||||
method public double getSnrInDb();
|
||||
method public short getState();
|
||||
method public short getSvid();
|
||||
method public short getTimeFromLastBitInMs();
|
||||
method public double getTimeOffsetInNs();
|
||||
method public boolean hasAzimuthInDeg();
|
||||
@@ -20471,7 +20471,6 @@ package android.location {
|
||||
method public void setElevationUncertaintyInDeg(double);
|
||||
method public void setLossOfLock(byte);
|
||||
method public void setMultipathIndicator(byte);
|
||||
method public void setPrn(byte);
|
||||
method public void setPseudorangeInMeters(double);
|
||||
method public void setPseudorangeRateCarrierInMetersPerSec(double);
|
||||
method public void setPseudorangeRateCarrierUncertaintyInMetersPerSec(double);
|
||||
@@ -20482,6 +20481,7 @@ package android.location {
|
||||
method public void setReceivedGpsTowUncertaintyInNs(long);
|
||||
method public void setSnrInDb(double);
|
||||
method public void setState(short);
|
||||
method public void setSvid(short);
|
||||
method public void setTimeFromLastBitInMs(short);
|
||||
method public void setTimeOffsetInNs(double);
|
||||
method public void setUsedInFix(boolean);
|
||||
@@ -20536,17 +20536,17 @@ package android.location {
|
||||
method public int describeContents();
|
||||
method public byte[] getData();
|
||||
method public short getMessageId();
|
||||
method public byte getPrn();
|
||||
method public short getStatus();
|
||||
method public short getSubmessageId();
|
||||
method public short getSvid();
|
||||
method public byte getType();
|
||||
method public void reset();
|
||||
method public void set(android.location.GnssNavigationMessage);
|
||||
method public void setData(byte[]);
|
||||
method public void setMessageId(short);
|
||||
method public void setPrn(byte);
|
||||
method public void setStatus(short);
|
||||
method public void setSubmessageId(short);
|
||||
method public void setSvid(short);
|
||||
method public void setType(byte);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
|
||||
@@ -20592,8 +20592,8 @@ package android.location {
|
||||
method public int getConstellationType(int);
|
||||
method public float getElevation(int);
|
||||
method public int getNumSatellites();
|
||||
method public int getPrn(int);
|
||||
method public float getSnr(int);
|
||||
method public int getSvid(int);
|
||||
method public boolean hasAlmanac(int);
|
||||
method public boolean hasEphemeris(int);
|
||||
method public boolean usedInFix(int);
|
||||
|
||||
@@ -19229,7 +19229,6 @@ package android.location {
|
||||
method public double getElevationUncertaintyInDeg();
|
||||
method public byte getLossOfLock();
|
||||
method public byte getMultipathIndicator();
|
||||
method public byte getPrn();
|
||||
method public double getPseudorangeInMeters();
|
||||
method public double getPseudorangeRateCarrierInMetersPerSec();
|
||||
method public double getPseudorangeRateCarrierUncertaintyInMetersPerSec();
|
||||
@@ -19240,6 +19239,7 @@ package android.location {
|
||||
method public long getReceivedGpsTowUncertaintyInNs();
|
||||
method public double getSnrInDb();
|
||||
method public short getState();
|
||||
method public short getSvid();
|
||||
method public short getTimeFromLastBitInMs();
|
||||
method public double getTimeOffsetInNs();
|
||||
method public boolean hasAzimuthInDeg();
|
||||
@@ -19299,7 +19299,6 @@ package android.location {
|
||||
method public void setElevationUncertaintyInDeg(double);
|
||||
method public void setLossOfLock(byte);
|
||||
method public void setMultipathIndicator(byte);
|
||||
method public void setPrn(byte);
|
||||
method public void setPseudorangeInMeters(double);
|
||||
method public void setPseudorangeRateCarrierInMetersPerSec(double);
|
||||
method public void setPseudorangeRateCarrierUncertaintyInMetersPerSec(double);
|
||||
@@ -19310,6 +19309,7 @@ package android.location {
|
||||
method public void setReceivedGpsTowUncertaintyInNs(long);
|
||||
method public void setSnrInDb(double);
|
||||
method public void setState(short);
|
||||
method public void setSvid(short);
|
||||
method public void setTimeFromLastBitInMs(short);
|
||||
method public void setTimeOffsetInNs(double);
|
||||
method public void setUsedInFix(boolean);
|
||||
@@ -19364,17 +19364,17 @@ package android.location {
|
||||
method public int describeContents();
|
||||
method public byte[] getData();
|
||||
method public short getMessageId();
|
||||
method public byte getPrn();
|
||||
method public short getStatus();
|
||||
method public short getSubmessageId();
|
||||
method public short getSvid();
|
||||
method public byte getType();
|
||||
method public void reset();
|
||||
method public void set(android.location.GnssNavigationMessage);
|
||||
method public void setData(byte[]);
|
||||
method public void setMessageId(short);
|
||||
method public void setPrn(byte);
|
||||
method public void setStatus(short);
|
||||
method public void setSubmessageId(short);
|
||||
method public void setSvid(short);
|
||||
method public void setType(byte);
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
|
||||
@@ -19420,8 +19420,8 @@ package android.location {
|
||||
method public int getConstellationType(int);
|
||||
method public float getElevation(int);
|
||||
method public int getNumSatellites();
|
||||
method public int getPrn(int);
|
||||
method public float getSnr(int);
|
||||
method public int getSvid(int);
|
||||
method public boolean hasAlmanac(int);
|
||||
method public boolean hasEphemeris(int);
|
||||
method public boolean usedInFix(int);
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public final class GnssMeasurement implements Parcelable {
|
||||
private int mFlags;
|
||||
private byte mPrn;
|
||||
private short mSvid;
|
||||
private double mTimeOffsetInNs;
|
||||
private short mState;
|
||||
private long mReceivedGpsTowInNs;
|
||||
@@ -198,7 +198,7 @@ public final class GnssMeasurement implements Parcelable {
|
||||
*/
|
||||
public void set(GnssMeasurement measurement) {
|
||||
mFlags = measurement.mFlags;
|
||||
mPrn = measurement.mPrn;
|
||||
mSvid = measurement.mSvid;
|
||||
mTimeOffsetInNs = measurement.mTimeOffsetInNs;
|
||||
mState = measurement.mState;
|
||||
mReceivedGpsTowInNs = measurement.mReceivedGpsTowInNs;
|
||||
@@ -248,15 +248,15 @@ public final class GnssMeasurement implements Parcelable {
|
||||
* Gets the Pseudo-random number (PRN).
|
||||
* Range: [1, 32]
|
||||
*/
|
||||
public byte getPrn() {
|
||||
return mPrn;
|
||||
public short getSvid() {
|
||||
return mSvid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Pseud-random number (PRN).
|
||||
*/
|
||||
public void setPrn(byte value) {
|
||||
mPrn = value;
|
||||
public void setSvid(short value) {
|
||||
mSvid = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1210,7 +1210,7 @@ public final class GnssMeasurement implements Parcelable {
|
||||
GnssMeasurement gnssMeasurement = new GnssMeasurement();
|
||||
|
||||
gnssMeasurement.mFlags = parcel.readInt();
|
||||
gnssMeasurement.mPrn = parcel.readByte();
|
||||
gnssMeasurement.mSvid = (short) parcel.readInt();
|
||||
gnssMeasurement.mTimeOffsetInNs = parcel.readDouble();
|
||||
gnssMeasurement.mState = (short) parcel.readInt();
|
||||
gnssMeasurement.mReceivedGpsTowInNs = parcel.readLong();
|
||||
@@ -1253,9 +1253,10 @@ public final class GnssMeasurement implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int flags) {
|
||||
parcel.writeInt(mFlags);
|
||||
parcel.writeByte(mPrn);
|
||||
parcel.writeInt(mSvid);
|
||||
parcel.writeDouble(mTimeOffsetInNs);
|
||||
parcel.writeInt(mState);
|
||||
parcel.writeLong(mReceivedGpsTowInNs);
|
||||
@@ -1301,7 +1302,7 @@ public final class GnssMeasurement implements Parcelable {
|
||||
final String formatWithUncertainty = " %-29s = %-25s %-40s = %s\n";
|
||||
StringBuilder builder = new StringBuilder("GnssMeasurement:\n");
|
||||
|
||||
builder.append(String.format(format, "Prn", mPrn));
|
||||
builder.append(String.format(format, "Svid", mSvid));
|
||||
|
||||
builder.append(String.format(format, "TimeOffsetInNs", mTimeOffsetInNs));
|
||||
|
||||
@@ -1422,7 +1423,7 @@ public final class GnssMeasurement implements Parcelable {
|
||||
|
||||
private void initialize() {
|
||||
mFlags = HAS_NO_FLAGS;
|
||||
setPrn(Byte.MIN_VALUE);
|
||||
setSvid((short) 0);
|
||||
setTimeOffsetInNs(Long.MIN_VALUE);
|
||||
setState(STATE_UNKNOWN);
|
||||
setReceivedGpsTowInNs(Long.MIN_VALUE);
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
/**
|
||||
* A class containing a GPS satellite Navigation Message.
|
||||
* A class containing a GNSS satellite Navigation Message.
|
||||
*/
|
||||
public final class GnssNavigationMessage implements Parcelable {
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
// End enumerations in sync with gps.h
|
||||
|
||||
private byte mType;
|
||||
private byte mPrn;
|
||||
private short mSvid;
|
||||
private short mMessageId;
|
||||
private short mSubmessageId;
|
||||
private byte[] mData;
|
||||
@@ -99,7 +99,7 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
*/
|
||||
public void set(GnssNavigationMessage navigationMessage) {
|
||||
mType = navigationMessage.mType;
|
||||
mPrn = navigationMessage.mPrn;
|
||||
mSvid = navigationMessage.mSvid;
|
||||
mMessageId = navigationMessage.mMessageId;
|
||||
mSubmessageId = navigationMessage.mSubmessageId;
|
||||
mData = navigationMessage.mData;
|
||||
@@ -153,15 +153,15 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
* Gets the Pseudo-random number.
|
||||
* Range: [1, 32].
|
||||
*/
|
||||
public byte getPrn() {
|
||||
return mPrn;
|
||||
public short getSvid() {
|
||||
return mSvid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Pseud-random number.
|
||||
*/
|
||||
public void setPrn(byte value) {
|
||||
mPrn = value;
|
||||
public void setSvid(short value) {
|
||||
mSvid = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,7 +256,7 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
GnssNavigationMessage navigationMessage = new GnssNavigationMessage();
|
||||
|
||||
navigationMessage.setType(parcel.readByte());
|
||||
navigationMessage.setPrn(parcel.readByte());
|
||||
navigationMessage.setSvid((short) parcel.readInt());
|
||||
navigationMessage.setMessageId((short) parcel.readInt());
|
||||
navigationMessage.setSubmessageId((short) parcel.readInt());
|
||||
|
||||
@@ -281,9 +281,10 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int flags) {
|
||||
parcel.writeByte(mType);
|
||||
parcel.writeByte(mPrn);
|
||||
parcel.writeInt(mSvid);
|
||||
parcel.writeInt(mMessageId);
|
||||
parcel.writeInt(mSubmessageId);
|
||||
parcel.writeInt(mData.length);
|
||||
@@ -302,7 +303,7 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
StringBuilder builder = new StringBuilder("GnssNavigationMessage:\n");
|
||||
|
||||
builder.append(String.format(format, "Type", getTypeString()));
|
||||
builder.append(String.format(format, "Prn", mPrn));
|
||||
builder.append(String.format(format, "Svid", mSvid));
|
||||
builder.append(String.format(format, "Status", getStatusString()));
|
||||
builder.append(String.format(format, "MessageId", mMessageId));
|
||||
builder.append(String.format(format, "SubmessageId", mSubmessageId));
|
||||
@@ -321,7 +322,7 @@ public final class GnssNavigationMessage implements Parcelable {
|
||||
|
||||
private void initialize() {
|
||||
mType = MESSAGE_TYPE_UNKNOWN;
|
||||
mPrn = 0;
|
||||
mSvid = 0;
|
||||
mMessageId = -1;
|
||||
mSubmessageId = -1;
|
||||
mData = EMPTY_ARRAY;
|
||||
|
||||
@@ -47,24 +47,26 @@ public final class GnssStatus {
|
||||
public static final int GNSS_SV_FLAGS_USED_IN_FIX = (1 << 2);
|
||||
|
||||
/** @hide */
|
||||
public static final int PRN_SHIFT_WIDTH = 3;
|
||||
public static final int SVID_SHIFT_WIDTH = 7;
|
||||
/** @hide */
|
||||
public static final int CONSTELLATION_TYPE_SHIFT_WIDTH = 3;
|
||||
/** @hide */
|
||||
public static final int CONSTELLATION_TYPE_MASK = 0xf;
|
||||
|
||||
/* These package private values are modified by the LocationManager class */
|
||||
/* package */ int[] mPrnWithFlags;
|
||||
/* package */ int[] mSvidWithFlags;
|
||||
/* package */ float[] mSnrs;
|
||||
/* package */ float[] mElevations;
|
||||
/* package */ float[] mAzimuths;
|
||||
/* package */ int[] mConstellationTypes;
|
||||
/* package */ int mSvCount;
|
||||
|
||||
GnssStatus(int svCount, int[] prnWithFlags, float[] snrs, float[] elevations, float[] azimuths,
|
||||
int[] constellationTypes) {
|
||||
GnssStatus(int svCount, int[] svidWithFlags, float[] snrs, float[] elevations,
|
||||
float[] azimuths) {
|
||||
mSvCount = svCount;
|
||||
mPrnWithFlags = prnWithFlags;
|
||||
mSvidWithFlags = svidWithFlags;
|
||||
mSnrs = snrs;
|
||||
mElevations = elevations;
|
||||
mAzimuths = azimuths;
|
||||
mConstellationTypes = constellationTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,15 +81,16 @@ public final class GnssStatus {
|
||||
* @param satIndex the index of the satellite in the list.
|
||||
*/
|
||||
public int getConstellationType(int satIndex) {
|
||||
return mConstellationTypes[satIndex];
|
||||
return (mSvidWithFlags[satIndex] >> CONSTELLATION_TYPE_SHIFT_WIDTH)
|
||||
& CONSTELLATION_TYPE_MASK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the pseudo-random number of the satellite at the specified position.
|
||||
* @param satIndex the index of the satellite in the list.
|
||||
*/
|
||||
public int getPrn(int satIndex) {
|
||||
return mPrnWithFlags[satIndex] >> PRN_SHIFT_WIDTH;
|
||||
public int getSvid(int satIndex) {
|
||||
return mSvidWithFlags[satIndex] >> SVID_SHIFT_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +122,7 @@ public final class GnssStatus {
|
||||
* @param satIndex the index of the satellite in the list.
|
||||
*/
|
||||
public boolean hasEphemeris(int satIndex) {
|
||||
return (mPrnWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
|
||||
return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +130,7 @@ public final class GnssStatus {
|
||||
* @param satIndex the index of the satellite in the list.
|
||||
*/
|
||||
public boolean hasAlmanac(int satIndex) {
|
||||
return (mPrnWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_ALMANAC_DATA) != 0;
|
||||
return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_ALMANAC_DATA) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,6 +138,6 @@ public final class GnssStatus {
|
||||
* @param satIndex the index of the satellite in the list.
|
||||
*/
|
||||
public boolean usedInFix(int satIndex) {
|
||||
return (mPrnWithFlags[satIndex] & GNSS_SV_FLAGS_USED_IN_FIX) != 0;
|
||||
return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_USED_IN_FIX) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,15 +138,19 @@ public final class GpsStatus {
|
||||
// For API-compat a public ctor() is not available
|
||||
GpsStatus() {}
|
||||
|
||||
private void setStatus(int svCount, int[] prnWithFlags, float[] snrs, float[] elevations,
|
||||
float[] azimuths, int[] constellationTypes) {
|
||||
private void setStatus(int svCount, int[] svidWithFlags, float[] snrs, float[] elevations,
|
||||
float[] azimuths) {
|
||||
clearSatellites();
|
||||
for (int i = 0; i < svCount; i++) {
|
||||
final int constellationType =
|
||||
(svidWithFlags[i] >> GnssStatus.CONSTELLATION_TYPE_SHIFT_WIDTH)
|
||||
& GnssStatus.CONSTELLATION_TYPE_MASK;
|
||||
// Skip all non-GPS satellites.
|
||||
if (constellationTypes[i] != GnssStatus.CONSTELLATION_GPS) {
|
||||
if (constellationType != GnssStatus.CONSTELLATION_GPS) {
|
||||
// TODO: translate the defacto pre-N use of prn's >32 to new struct
|
||||
continue;
|
||||
}
|
||||
int prn = prnWithFlags[i] >> GnssStatus.PRN_SHIFT_WIDTH;
|
||||
int prn = svidWithFlags[i] >> GnssStatus.SVID_SHIFT_WIDTH;
|
||||
if (prn > 0 && prn <= NUM_SATELLITES) {
|
||||
GpsSatellite satellite = mSatellites.get(prn);
|
||||
if (satellite == null) {
|
||||
@@ -159,11 +163,11 @@ public final class GpsStatus {
|
||||
satellite.mElevation = elevations[i];
|
||||
satellite.mAzimuth = azimuths[i];
|
||||
satellite.mHasEphemeris =
|
||||
(prnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
|
||||
(svidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
|
||||
satellite.mHasAlmanac =
|
||||
(prnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_ALMANAC_DATA) != 0;
|
||||
(svidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_ALMANAC_DATA) != 0;
|
||||
satellite.mUsedInFix =
|
||||
(prnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) != 0;
|
||||
(svidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,8 +180,8 @@ public final class GpsStatus {
|
||||
*/
|
||||
void setStatus(GnssStatus status, int timeToFirstFix) {
|
||||
mTimeToFirstFix = timeToFirstFix;
|
||||
setStatus(status.mSvCount, status.mPrnWithFlags, status.mSnrs, status.mElevations,
|
||||
status.mAzimuths, status.mConstellationTypes);
|
||||
setStatus(status.mSvCount, status.mSvidWithFlags, status.mSnrs, status.mElevations,
|
||||
status.mAzimuths);
|
||||
}
|
||||
|
||||
void setTimeToFirstFix(int ttff) {
|
||||
|
||||
@@ -26,7 +26,7 @@ oneway interface IGnssStatusListener
|
||||
void onGnssStarted();
|
||||
void onGnssStopped();
|
||||
void onFirstFix(int ttff);
|
||||
void onSvStatusChanged(int svCount, in int[] prnWithFlags, in float[] snrs,
|
||||
in float[] elevations, in float[] azimuths, in int[] constellationTypes);
|
||||
void onSvStatusChanged(int svCount, in int[] svidWithFlags, in float[] snrs,
|
||||
in float[] elevations, in float[] azimuths);
|
||||
void onNmeaReceived(long timestamp, String nmea);
|
||||
}
|
||||
|
||||
@@ -1562,10 +1562,9 @@ public class LocationManager {
|
||||
|
||||
@Override
|
||||
public void onSvStatusChanged(int svCount, int[] prnWithFlags,
|
||||
float[] snrs, float[] elevations, float[] azimuths, int[] constellationTypes) {
|
||||
float[] snrs, float[] elevations, float[] azimuths) {
|
||||
if (mGnssCallback != null) {
|
||||
mGnssStatus = new GnssStatus(svCount, prnWithFlags, snrs, elevations, azimuths,
|
||||
constellationTypes);
|
||||
mGnssStatus = new GnssStatus(svCount, prnWithFlags, snrs, elevations, azimuths);
|
||||
|
||||
Message msg = Message.obtain();
|
||||
msg.what = GpsStatus.GPS_EVENT_SATELLITE_STATUS;
|
||||
|
||||
@@ -1557,15 +1557,13 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
||||
* called from native code to update SV info
|
||||
*/
|
||||
private void reportSvStatus() {
|
||||
int svCount = native_read_sv_status(mPrnWithFlags, mSnrs, mSvElevations, mSvAzimuths,
|
||||
mConstellationTypes);
|
||||
int svCount = native_read_sv_status(mSvidWithFlags, mSnrs, mSvElevations, mSvAzimuths);
|
||||
mListenerHelper.onSvStatusChanged(
|
||||
svCount,
|
||||
mPrnWithFlags,
|
||||
mSvidWithFlags,
|
||||
mSnrs,
|
||||
mSvElevations,
|
||||
mSvAzimuths,
|
||||
mConstellationTypes);
|
||||
mSvAzimuths);
|
||||
|
||||
if (VERBOSE) {
|
||||
Log.v(TAG, "SV count: " + svCount);
|
||||
@@ -1573,19 +1571,19 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
||||
// Calculate number of sets used in fix.
|
||||
int usedInFixCount = 0;
|
||||
for (int i = 0; i < svCount; i++) {
|
||||
if ((mPrnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) != 0) {
|
||||
if ((mSvidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) != 0) {
|
||||
++usedInFixCount;
|
||||
}
|
||||
if (VERBOSE) {
|
||||
Log.v(TAG, "prn: " + (mPrnWithFlags[i] >> GnssStatus.PRN_SHIFT_WIDTH) +
|
||||
Log.v(TAG, "svid: " + (mSvidWithFlags[i] >> GnssStatus.SVID_SHIFT_WIDTH) +
|
||||
" snr: " + mSnrs[i]/10 +
|
||||
" elev: " + mSvElevations[i] +
|
||||
" azimuth: " + mSvAzimuths[i] +
|
||||
((mPrnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) == 0
|
||||
((mSvidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) == 0
|
||||
? " " : " E") +
|
||||
((mPrnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_ALMANAC_DATA) == 0
|
||||
((mSvidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_HAS_ALMANAC_DATA) == 0
|
||||
? " " : " A") +
|
||||
((mPrnWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) == 0
|
||||
((mSvidWithFlags[i] & GnssStatus.GNSS_SV_FLAGS_USED_IN_FIX) == 0
|
||||
? "" : "U"));
|
||||
}
|
||||
}
|
||||
@@ -2398,14 +2396,13 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
||||
}
|
||||
|
||||
// for GPS SV statistics
|
||||
private static final int MAX_SVS = 512;
|
||||
private static final int MAX_SVS = 64;
|
||||
|
||||
// preallocated arrays, to avoid memory allocation in reportStatus()
|
||||
private int mPrnWithFlags[] = new int[MAX_SVS];
|
||||
private int mSvidWithFlags[] = new int[MAX_SVS];
|
||||
private float mSnrs[] = new float[MAX_SVS];
|
||||
private float mSvElevations[] = new float[MAX_SVS];
|
||||
private float mSvAzimuths[] = new float[MAX_SVS];
|
||||
private int mConstellationTypes[] = new int[MAX_SVS];
|
||||
private int mSvCount;
|
||||
// preallocated to avoid memory allocation in reportNmea()
|
||||
private byte[] mNmeaBuffer = new byte[120];
|
||||
@@ -2426,7 +2423,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
|
||||
// returns number of SVs
|
||||
// mask[0] is ephemeris mask and mask[1] is almanac mask
|
||||
private native int native_read_sv_status(int[] prnWithFlags, float[] snrs, float[] elevations,
|
||||
float[] azimuths, int[] constellationTypes);
|
||||
float[] azimuths);
|
||||
private native int native_read_nmea(byte[] buffer, int bufferSize);
|
||||
private native void native_inject_location(double latitude, double longitude, float accuracy);
|
||||
|
||||
|
||||
@@ -77,8 +77,7 @@ abstract class GnssStatusListenerHelper extends RemoteListenerHelper<IGnssStatus
|
||||
final int[] prnWithFlags,
|
||||
final float[] snrs,
|
||||
final float[] elevations,
|
||||
final float[] azimuths,
|
||||
final int[] constellationTypes) {
|
||||
final float[] azimuths) {
|
||||
Operation operation = new Operation() {
|
||||
@Override
|
||||
public void execute(IGnssStatusListener listener) throws RemoteException {
|
||||
@@ -87,8 +86,7 @@ abstract class GnssStatusListenerHelper extends RemoteListenerHelper<IGnssStatus
|
||||
prnWithFlags,
|
||||
snrs,
|
||||
elevations,
|
||||
azimuths,
|
||||
constellationTypes);
|
||||
azimuths);
|
||||
}
|
||||
};
|
||||
foreach(operation);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user