FileDocCategorySizeDatePackage
GpsMeasurement.javaAPI DocAndroid 5.1 API45848Thu Mar 12 22:22:30 GMT 2015android.location

GpsMeasurement

public class GpsMeasurement extends Object implements android.os.Parcelable
A class representing a GPS satellite measurement, containing raw and computed information.
hide

Fields Summary
private static final String
TAG
private int
mFlags
private byte
mPrn
private double
mTimeOffsetInNs
private short
mState
private long
mReceivedGpsTowInNs
private long
mReceivedGpsTowUncertaintyInNs
private double
mCn0InDbHz
private double
mPseudorangeRateInMetersPerSec
private double
mPseudorangeRateUncertaintyInMetersPerSec
private short
mAccumulatedDeltaRangeState
private double
mAccumulatedDeltaRangeInMeters
private double
mAccumulatedDeltaRangeUncertaintyInMeters
private double
mPseudorangeInMeters
private double
mPseudorangeUncertaintyInMeters
private double
mCodePhaseInChips
private double
mCodePhaseUncertaintyInChips
private float
mCarrierFrequencyInHz
private long
mCarrierCycles
private double
mCarrierPhase
private double
mCarrierPhaseUncertainty
private byte
mLossOfLock
private int
mBitNumber
private short
mTimeFromLastBitInMs
private double
mDopplerShiftInHz
private double
mDopplerShiftUncertaintyInHz
private byte
mMultipathIndicator
private double
mSnrInDb
private double
mElevationInDeg
private double
mElevationUncertaintyInDeg
private double
mAzimuthInDeg
private double
mAzimuthUncertaintyInDeg
private boolean
mUsedInFix
private static final int
HAS_NO_FLAGS
private static final int
HAS_SNR
private static final int
HAS_ELEVATION
private static final int
HAS_ELEVATION_UNCERTAINTY
private static final int
HAS_AZIMUTH
private static final int
HAS_AZIMUTH_UNCERTAINTY
private static final int
HAS_PSEUDORANGE
private static final int
HAS_PSEUDORANGE_UNCERTAINTY
private static final int
HAS_CODE_PHASE
private static final int
HAS_CODE_PHASE_UNCERTAINTY
private static final int
HAS_CARRIER_FREQUENCY
private static final int
HAS_CARRIER_CYCLES
private static final int
HAS_CARRIER_PHASE
private static final int
HAS_CARRIER_PHASE_UNCERTAINTY
private static final int
HAS_BIT_NUMBER
private static final int
HAS_TIME_FROM_LAST_BIT
private static final int
HAS_DOPPLER_SHIFT
private static final int
HAS_DOPPLER_SHIFT_UNCERTAINTY
public static final byte
LOSS_OF_LOCK_UNKNOWN
The indicator is not available or it is unknown.
public static final byte
LOSS_OF_LOCK_OK
The measurement does not present any indication of 'loss of lock'.
public static final byte
LOSS_OF_LOCK_CYCLE_SLIP
'Loss of lock' detected between the previous and current observation: cycle slip possible.
public static final byte
MULTIPATH_INDICATOR_UNKNOWN
The indicator is not available or it is unknown.
public static final byte
MULTIPATH_INDICATOR_DETECTED
The measurement has been indicated to use multi-path.
public static final byte
MULTIPATH_INDICATOR_NOT_USED
The measurement has been indicated not tu use multi-path.
public static final short
STATE_UNKNOWN
The state of GPS receiver the measurement is invalid or unknown.
public static final short
STATE_CODE_LOCK
The state of the GPS receiver is ranging code lock.
public static final short
STATE_BIT_SYNC
The state of the GPS receiver is in bit sync.
public static final short
STATE_SUBFRAME_SYNC
The state of the GPS receiver is in sub-frame sync.
public static final short
STATE_TOW_DECODED
The state of the GPS receiver has TOW decoded.
public static final short
ADR_STATE_UNKNOWN
The state of the 'Accumulated Delta Range' is invalid or unknown.
public static final short
ADR_STATE_VALID
The state of the 'Accumulated Delta Range' is valid.
public static final short
ADR_STATE_RESET
The state of the 'Accumulated Delta Range' has detected a reset.
public static final short
ADR_STATE_CYCLE_SLIP
The state of the 'Accumulated Delta Range' has a cycle slip detected.
public static final Creator
CREATOR
Constructors Summary
GpsMeasurement()


    // End enumerations in sync with gps.h

     
        initialize();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public doublegetAccumulatedDeltaRangeInMeters()
Gets the accumulated delta range since the last channel reset, in meters. The reported value includes {@link #getAccumulatedDeltaRangeUncertaintyInMeters()}. The availability of the value is represented by {@link #getAccumulatedDeltaRangeState()}.

        return mAccumulatedDeltaRangeInMeters;
    
public shortgetAccumulatedDeltaRangeState()
Gets 'Accumulated Delta Range' state. It indicates whether {@link #getAccumulatedDeltaRangeInMeters()} is reset or there is a cycle slip (indicating 'loss of lock').

        return mAccumulatedDeltaRangeState;
    
private java.lang.StringgetAccumulatedDeltaRangeStateString()
Gets a string representation of the 'Accumulated Delta Range state'. For internal and logging use only.

        switch (mAccumulatedDeltaRangeState) {
            case ADR_STATE_UNKNOWN:
                return "Unknown";
            case ADR_STATE_VALID:
                return "Valid";
            case ADR_STATE_RESET:
                return "Reset";
            case ADR_STATE_CYCLE_SLIP:
                return "CycleSlip";
            default:
                return "<Invalid>";
        }
    
public doublegetAccumulatedDeltaRangeUncertaintyInMeters()
Gets the accumulated delta range's uncertainty (1-Sigma) in meters. The uncertainty is represented as an absolute (single sided) value.

        return mAccumulatedDeltaRangeUncertaintyInMeters;
    
public doublegetAzimuthInDeg()
Gets the azimuth in degrees. Range: [0, 360). The reported azimuth includes {@link #getAzimuthUncertaintyInDeg()}. The value is only available if {@link #hasAzimuthInDeg()} is true.

        return mAzimuthInDeg;
    
public doublegetAzimuthUncertaintyInDeg()
Gets the azimuth's uncertainty (1-Sigma) in degrees. Range: [0, 180]. The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasAzimuthUncertaintyInDeg()} is true.

        return mAzimuthUncertaintyInDeg;
    
public intgetBitNumber()
Gets the number of GPS bits transmitted since Sat-Sun midnight (GPS week). The value is only available if {@link #hasBitNumber()} is true.

        return mBitNumber;
    
public longgetCarrierCycles()
The number of full carrier cycles between the satellite and the receiver. The reference frequency is given by the value of {@link #getCarrierFrequencyInHz()}. The value is only available if {@link #hasCarrierCycles()} is true.

        return mCarrierCycles;
    
public floatgetCarrierFrequencyInHz()
Gets the carrier frequency at which codes and messages are modulated, it can be L1 or L2. If the field is not set, the carrier frequency corresponds to L1. The value is only available if {@link #hasCarrierFrequencyInHz()} is true.

        return mCarrierFrequencyInHz;
    
public doublegetCarrierPhase()
Gets the RF phase detected by the receiver. Range: [0.0, 1.0]. This is usually the fractional part of the complete carrier phase measurement. The reference frequency is given by the value of {@link #getCarrierFrequencyInHz()}. The reported carrier-phase includes {@link #getCarrierPhaseUncertainty()}. The value is only available if {@link #hasCarrierPhase()} is true.

        return mCarrierPhase;
    
public doublegetCarrierPhaseUncertainty()
Gets the carrier-phase's uncertainty (1-Sigma). The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasCarrierPhaseUncertainty()} is true.

        return mCarrierPhaseUncertainty;
    
public doublegetCn0InDbHz()
Gets the Carrier-to-noise density in dB-Hz. Range: [0, 63]. The value contains the measured C/N0 for the signal at the antenna input.

        return mCn0InDbHz;
    
public doublegetCodePhaseInChips()
Gets the fraction of the current C/A code cycle. Range: [0, 1023] The reference frequency is given by the value of {@link #getCarrierFrequencyInHz()}. The reported code-phase includes {@link #getCodePhaseUncertaintyInChips()}. The value is only available if {@link #hasCodePhaseInChips()} is true.

        return mCodePhaseInChips;
    
public doublegetCodePhaseUncertaintyInChips()
Gets the code-phase's uncertainty (1-Sigma) as a fraction of chips. The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasCodePhaseUncertaintyInChips()} is true.

        return mCodePhaseUncertaintyInChips;
    
public doublegetDopplerShiftInHz()
Gets the Doppler Shift in Hz. A positive value indicates that the SV is moving toward the receiver. The reference frequency is given by the value of {@link #getCarrierFrequencyInHz()}. The reported doppler shift includes {@link #getDopplerShiftUncertaintyInHz()}. The value is only available if {@link #hasDopplerShiftInHz()} is true.

        return mDopplerShiftInHz;
    
public doublegetDopplerShiftUncertaintyInHz()
Gets the Doppler's Shift uncertainty (1-Sigma) in Hz. The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasDopplerShiftUncertaintyInHz()} is true.

        return mDopplerShiftUncertaintyInHz;
    
public doublegetElevationInDeg()
Gets the Elevation in degrees. Range: [-90, 90] The reported elevation includes {@link #getElevationUncertaintyInDeg()}. The value is only available if {@link #hasElevationInDeg()} is true.

        return mElevationInDeg;
    
public doublegetElevationUncertaintyInDeg()
Gets the elevation's uncertainty (1-Sigma) in degrees. Range: [0, 90] The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasElevationUncertaintyInDeg()} is true.

        return mElevationUncertaintyInDeg;
    
public bytegetLossOfLock()
Gets a value indicating the 'loss of lock' state of the event.

        return mLossOfLock;
    
private java.lang.StringgetLossOfLockString()
Gets a string representation of the 'loss of lock'. For internal and logging use only.

        switch (mLossOfLock) {
            case LOSS_OF_LOCK_UNKNOWN:
                return "Unknown";
            case LOSS_OF_LOCK_OK:
                return "Ok";
            case LOSS_OF_LOCK_CYCLE_SLIP:
                return "CycleSlip";
            default:
                return "<Invalid>";
        }
    
public bytegetMultipathIndicator()
Gets a value indicating the 'multipath' state of the event.

        return mMultipathIndicator;
    
private java.lang.StringgetMultipathIndicatorString()
Gets a string representation of the 'multi-path indicator'. For internal and logging use only.

        switch(mMultipathIndicator) {
            case MULTIPATH_INDICATOR_UNKNOWN:
                return "Unknown";
            case MULTIPATH_INDICATOR_DETECTED:
                return "Detected";
            case MULTIPATH_INDICATOR_NOT_USED:
                return "NotUsed";
            default:
                return "<Invalid>";
        }
    
public bytegetPrn()
Gets the Pseudo-random number (PRN). Range: [1, 32]

        return mPrn;
    
public doublegetPseudorangeInMeters()
Gets the best derived pseudorange by the chipset, in meters. The reported pseudorange includes {@link #getPseudorangeUncertaintyInMeters()}. The value is only available if {@link #hasPseudorangeInMeters()} is true.

        return mPseudorangeInMeters;
    
public doublegetPseudorangeRateInMetersPerSec()
Gets the Pseudorange rate at the timestamp in m/s. The reported value includes {@link #getPseudorangeRateUncertaintyInMetersPerSec()}.

        return mPseudorangeRateInMetersPerSec;
    
public doublegetPseudorangeRateUncertaintyInMetersPerSec()
Gets the pseudorange's rate uncertainty (1-Sigma) in m/s. The uncertainty is represented as an absolute (single sided) value.

        return mPseudorangeRateUncertaintyInMetersPerSec;
    
public doublegetPseudorangeUncertaintyInMeters()
Gets the pseudorange's uncertainty (1-Sigma) in meters. The value contains the 'pseudorange' and 'clock' uncertainty in it. The uncertainty is represented as an absolute (single sided) value. The value is only available if {@link #hasPseudorangeUncertaintyInMeters()} is true.

        return mPseudorangeUncertaintyInMeters;
    
public longgetReceivedGpsTowInNs()
Gets the received GPS Time-of-Week at the measurement time, in nanoseconds. The value is relative to the beginning of the current GPS week. Given {@link #getState()} of the GPS receiver, the range of this field can be: Searching : [ 0 ] : {@link #STATE_UNKNOWN} is set Ranging code lock : [ 0 1 ms ] : {@link #STATE_CODE_LOCK} is set Bit sync : [ 0 20 ms ] : {@link #STATE_BIT_SYNC} is set Subframe sync : [ 0 6 ms ] : {@link #STATE_SUBFRAME_SYNC} is set TOW decoded : [ 0 1 week ] : {@link #STATE_TOW_DECODED} is set

        return mReceivedGpsTowInNs;
    
public longgetReceivedGpsTowUncertaintyInNs()
Gets the received GPS time-of-week's uncertainty (1-Sigma) in nanoseconds.

        return mReceivedGpsTowUncertaintyInNs;
    
public doublegetSnrInDb()
Gets the Signal-to-Noise ratio (SNR) in dB. The value is only available if {@link #hasSnrInDb()} is true.

        return mSnrInDb;
    
public shortgetState()
Gets per-satellite sync state. It represents the current sync state for the associated satellite. This value helps interpret {@link #getReceivedGpsTowInNs()}.

        return mState;
    
private java.lang.StringgetStateString()
Gets a string representation of the 'sync state'. For internal and logging use only.

        switch (mState) {
            case STATE_UNKNOWN:
                return "Unknown";
            case STATE_BIT_SYNC:
                return "BitSync";
            case STATE_CODE_LOCK:
                return "CodeLock";
            case STATE_SUBFRAME_SYNC:
                return "SubframeSync";
            case STATE_TOW_DECODED:
                return "TowDecoded";
            default:
                return "<Invalid>";
        }
    
public shortgetTimeFromLastBitInMs()
Gets the elapsed time since the last received bit in milliseconds. Range: [0, 20]. The value is only available if {@link #hasTimeFromLastBitInMs()} is true.

        return mTimeFromLastBitInMs;
    
public doublegetTimeOffsetInNs()
Gets the time offset at which the measurement was taken in nanoseconds. The reference receiver's time is specified by {@link GpsClock#getTimeInNs()} and should be interpreted in the same way as indicated by {@link GpsClock#getType()}. The sign of this value is given by the following equation: measurement time = time_ns + time_offset_ns The value provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy.

        return mTimeOffsetInNs;
    
public booleanhasAzimuthInDeg()
Returns true if {@link #getAzimuthInDeg()} is available, false otherwise.

        return isFlagSet(HAS_AZIMUTH);
    
public booleanhasAzimuthUncertaintyInDeg()
Returns true if {@link #getAzimuthUncertaintyInDeg()} is available, false otherwise.

        return isFlagSet(HAS_AZIMUTH_UNCERTAINTY);
    
public booleanhasBitNumber()
Returns true if {@link #getBitNumber()} is available, false otherwise.

        return isFlagSet(HAS_BIT_NUMBER);
    
public booleanhasCarrierCycles()
Returns true if {@link #getCarrierCycles()} is available, false otherwise.

        return isFlagSet(HAS_CARRIER_CYCLES);
    
public booleanhasCarrierFrequencyInHz()
Returns true if {@link #getCarrierFrequencyInHz()} is available, false otherwise.

        return isFlagSet(HAS_CARRIER_FREQUENCY);
    
public booleanhasCarrierPhase()
Returns true if {@link #getCarrierPhase()} is available, false otherwise.

        return isFlagSet(HAS_CARRIER_PHASE);
    
public booleanhasCarrierPhaseUncertainty()
Returns true if {@link #getCarrierPhaseUncertainty()} is available, false otherwise.

        return isFlagSet(HAS_CARRIER_PHASE_UNCERTAINTY);
    
public booleanhasCodePhaseInChips()
Returns true if {@link #getCodePhaseInChips()} is available, false otherwise.

        return isFlagSet(HAS_CODE_PHASE);
    
public booleanhasCodePhaseUncertaintyInChips()
Returns true if {@link #getCodePhaseUncertaintyInChips()} is available, false otherwise.

        return isFlagSet(HAS_CODE_PHASE_UNCERTAINTY);
    
public booleanhasDopplerShiftInHz()
Returns true if {@link #getDopplerShiftInHz()} is available, false otherwise.

        return isFlagSet(HAS_DOPPLER_SHIFT);
    
public booleanhasDopplerShiftUncertaintyInHz()
Returns true if {@link #getDopplerShiftUncertaintyInHz()} is available, false otherwise.

        return isFlagSet(HAS_DOPPLER_SHIFT_UNCERTAINTY);
    
public booleanhasElevationInDeg()
Returns true if {@link #getElevationInDeg()} is available, false otherwise.

        return isFlagSet(HAS_ELEVATION);
    
public booleanhasElevationUncertaintyInDeg()
Returns true if {@link #getElevationUncertaintyInDeg()} is available, false otherwise.

        return isFlagSet(HAS_ELEVATION_UNCERTAINTY);
    
public booleanhasPseudorangeInMeters()
Returns true if {@link #getPseudorangeInMeters()} is available, false otherwise.

        return isFlagSet(HAS_PSEUDORANGE);
    
public booleanhasPseudorangeUncertaintyInMeters()
Returns true if {@link #getPseudorangeUncertaintyInMeters()} is available, false otherwise.

        return isFlagSet(HAS_PSEUDORANGE_UNCERTAINTY);
    
public booleanhasSnrInDb()
Returns true if {@link #getSnrInDb()} is available, false otherwise.

        return isFlagSet(HAS_SNR);
    
public booleanhasTimeFromLastBitInMs()
Returns true if {@link #getTimeFromLastBitInMs()} is available, false otherwise.

        return isFlagSet(HAS_TIME_FROM_LAST_BIT);
    
private voidinitialize()

        mFlags = HAS_NO_FLAGS;
        setPrn(Byte.MIN_VALUE);
        setTimeOffsetInNs(Long.MIN_VALUE);
        setState(STATE_UNKNOWN);
        setReceivedGpsTowInNs(Long.MIN_VALUE);
        setReceivedGpsTowUncertaintyInNs(Long.MAX_VALUE);
        setCn0InDbHz(Double.MIN_VALUE);
        setPseudorangeRateInMetersPerSec(Double.MIN_VALUE);
        setPseudorangeRateUncertaintyInMetersPerSec(Double.MIN_VALUE);
        setAccumulatedDeltaRangeState(ADR_STATE_UNKNOWN);
        setAccumulatedDeltaRangeInMeters(Double.MIN_VALUE);
        setAccumulatedDeltaRangeUncertaintyInMeters(Double.MIN_VALUE);
        resetPseudorangeInMeters();
        resetPseudorangeUncertaintyInMeters();
        resetCodePhaseInChips();
        resetCodePhaseUncertaintyInChips();
        resetCarrierFrequencyInHz();
        resetCarrierCycles();
        resetCarrierPhase();
        resetCarrierPhaseUncertainty();
        setLossOfLock(LOSS_OF_LOCK_UNKNOWN);
        resetBitNumber();
        resetTimeFromLastBitInMs();
        resetDopplerShiftInHz();
        resetDopplerShiftUncertaintyInHz();
        setMultipathIndicator(MULTIPATH_INDICATOR_UNKNOWN);
        resetSnrInDb();
        resetElevationInDeg();
        resetElevationUncertaintyInDeg();
        resetAzimuthInDeg();
        resetAzimuthUncertaintyInDeg();
        setUsedInFix(false);
    
private booleanisFlagSet(int flag)

        return (mFlags & flag) == flag;
    
public booleanisUsedInFix()
Gets a flag indicating whether the GPS represented by the measurement was used for computing the most recent fix.

return
A non-null value if the data is available, null otherwise.

        return mUsedInFix;
    
public voidreset()
Resets all the contents to its original state.

        initialize();
    
public voidresetAzimuthInDeg()
Resets the Azimuth in degrees.

        resetFlag(HAS_AZIMUTH);
        mAzimuthInDeg = Double.NaN;
    
public voidresetAzimuthUncertaintyInDeg()
Resets the Azimuth's uncertainty (1-Sigma) in degrees.

        resetFlag(HAS_AZIMUTH_UNCERTAINTY);
        mAzimuthUncertaintyInDeg = Double.NaN;
    
public voidresetBitNumber()
Resets the bit number within the broadcast frame.

        resetFlag(HAS_BIT_NUMBER);
        mBitNumber = Integer.MIN_VALUE;
    
public voidresetCarrierCycles()
Resets the number of full carrier cycles between the satellite and the receiver.

        resetFlag(HAS_CARRIER_CYCLES);
        mCarrierCycles = Long.MIN_VALUE;
    
public voidresetCarrierFrequencyInHz()
Resets the Carrier frequency (L1 or L2) in Hz.

        resetFlag(HAS_CARRIER_FREQUENCY);
        mCarrierFrequencyInHz = Float.NaN;
    
public voidresetCarrierPhase()
Resets the RF phase detected by the receiver.

        resetFlag(HAS_CARRIER_PHASE);
        mCarrierPhase = Double.NaN;
    
public voidresetCarrierPhaseUncertainty()
Resets the Carrier-phase's uncertainty (1-Sigma) in cycles.

        resetFlag(HAS_CARRIER_PHASE_UNCERTAINTY);
        mCarrierPhaseUncertainty = Double.NaN;
    
public voidresetCodePhaseInChips()
Resets the Code-phase in chips.

        resetFlag(HAS_CODE_PHASE);
        mCodePhaseInChips = Double.NaN;
    
public voidresetCodePhaseUncertaintyInChips()
Resets the Code-phase's uncertainty (1-Sigma) in fractions of chips.

        resetFlag(HAS_CODE_PHASE_UNCERTAINTY);
        mCodePhaseUncertaintyInChips = Double.NaN;
    
public voidresetDopplerShiftInHz()
Resets the Doppler shift in Hz.

        resetFlag(HAS_DOPPLER_SHIFT);
        mDopplerShiftInHz = Double.NaN;
    
public voidresetDopplerShiftUncertaintyInHz()
Resets the Doppler's shift uncertainty (1-Sigma) in Hz.

        resetFlag(HAS_DOPPLER_SHIFT_UNCERTAINTY);
        mDopplerShiftUncertaintyInHz = Double.NaN;
    
public voidresetElevationInDeg()
Resets the Elevation in degrees.

        resetFlag(HAS_ELEVATION);
        mElevationInDeg = Double.NaN;
    
public voidresetElevationUncertaintyInDeg()
Resets the elevation's uncertainty (1-Sigma) in degrees.

        resetFlag(HAS_ELEVATION_UNCERTAINTY);
        mElevationUncertaintyInDeg = Double.NaN;
    
private voidresetFlag(int flag)

        mFlags &= ~flag;
    
public voidresetPseudorangeInMeters()
Resets the Pseudo-range in meters.

        resetFlag(HAS_PSEUDORANGE);
        mPseudorangeInMeters = Double.NaN;
    
public voidresetPseudorangeUncertaintyInMeters()
Resets the pseudo-range's uncertainty (1-Sigma) in meters.

        resetFlag(HAS_PSEUDORANGE_UNCERTAINTY);
        mPseudorangeUncertaintyInMeters = Double.NaN;
    
public voidresetSnrInDb()
Resets the Signal-to-noise ratio (SNR) in dB.

        resetFlag(HAS_SNR);
        mSnrInDb = Double.NaN;
    
public voidresetTimeFromLastBitInMs()
Resets the elapsed time since the last received bit in milliseconds.

        resetFlag(HAS_TIME_FROM_LAST_BIT);
        mTimeFromLastBitInMs = Short.MIN_VALUE;
    
public voidset(android.location.GpsMeasurement measurement)
Sets all contents to the values stored in the provided object.

        mFlags = measurement.mFlags;
        mPrn = measurement.mPrn;
        mTimeOffsetInNs = measurement.mTimeOffsetInNs;
        mState = measurement.mState;
        mReceivedGpsTowInNs = measurement.mReceivedGpsTowInNs;
        mReceivedGpsTowUncertaintyInNs = measurement.mReceivedGpsTowUncertaintyInNs;
        mCn0InDbHz = measurement.mCn0InDbHz;
        mPseudorangeRateInMetersPerSec = measurement.mPseudorangeRateInMetersPerSec;
        mPseudorangeRateUncertaintyInMetersPerSec =
                measurement.mPseudorangeRateUncertaintyInMetersPerSec;
        mAccumulatedDeltaRangeState = measurement.mAccumulatedDeltaRangeState;
        mAccumulatedDeltaRangeInMeters = measurement.mAccumulatedDeltaRangeInMeters;
        mAccumulatedDeltaRangeUncertaintyInMeters =
                measurement.mAccumulatedDeltaRangeUncertaintyInMeters;
        mPseudorangeInMeters = measurement.mPseudorangeInMeters;
        mPseudorangeUncertaintyInMeters = measurement.mPseudorangeUncertaintyInMeters;
        mCodePhaseInChips = measurement.mCodePhaseInChips;
        mCodePhaseUncertaintyInChips = measurement.mCodePhaseUncertaintyInChips;
        mCarrierFrequencyInHz = measurement.mCarrierFrequencyInHz;
        mCarrierCycles = measurement.mCarrierCycles;
        mCarrierPhase = measurement.mCarrierPhase;
        mCarrierPhaseUncertainty = measurement.mCarrierPhaseUncertainty;
        mLossOfLock = measurement.mLossOfLock;
        mBitNumber = measurement.mBitNumber;
        mTimeFromLastBitInMs = measurement.mTimeFromLastBitInMs;
        mDopplerShiftInHz = measurement.mDopplerShiftInHz;
        mDopplerShiftUncertaintyInHz = measurement.mDopplerShiftUncertaintyInHz;
        mMultipathIndicator = measurement.mMultipathIndicator;
        mSnrInDb = measurement.mSnrInDb;
        mElevationInDeg = measurement.mElevationInDeg;
        mElevationUncertaintyInDeg = measurement.mElevationUncertaintyInDeg;
        mAzimuthInDeg = measurement.mAzimuthInDeg;
        mAzimuthUncertaintyInDeg = measurement.mAzimuthUncertaintyInDeg;
        mUsedInFix = measurement.mUsedInFix;
    
public voidsetAccumulatedDeltaRangeInMeters(double value)
Sets the accumulated delta range in meters.

        mAccumulatedDeltaRangeInMeters = value;
    
public voidsetAccumulatedDeltaRangeState(short value)
Sets the 'Accumulated Delta Range' state.

        switch (value) {
            case ADR_STATE_UNKNOWN:
            case ADR_STATE_VALID:
            case ADR_STATE_RESET:
            case ADR_STATE_CYCLE_SLIP:
                mAccumulatedDeltaRangeState = value;
                break;
            default:
                Log.d(TAG, "Sanitizing invalid 'Accumulated Delta Range state': " + value);
                mAccumulatedDeltaRangeState = ADR_STATE_UNKNOWN;
                break;
        }
    
public voidsetAccumulatedDeltaRangeUncertaintyInMeters(double value)
Sets the accumulated delta range's uncertainty (1-sigma) in meters. The availability of the value is represented by {@link #getAccumulatedDeltaRangeState()}.

        mAccumulatedDeltaRangeUncertaintyInMeters = value;
    
public voidsetAzimuthInDeg(double value)
Sets the Azimuth in degrees.

        setFlag(HAS_AZIMUTH);
        mAzimuthInDeg = value;
    
public voidsetAzimuthUncertaintyInDeg(double value)
Sets the Azimuth's uncertainty (1-Sigma) in degrees.

        setFlag(HAS_AZIMUTH_UNCERTAINTY);
        mAzimuthUncertaintyInDeg = value;
    
public voidsetBitNumber(int bitNumber)
Sets the bit number within the broadcast frame.

        setFlag(HAS_BIT_NUMBER);
        mBitNumber = bitNumber;
    
public voidsetCarrierCycles(long value)
Sets the number of full carrier cycles between the satellite and the receiver.

        setFlag(HAS_CARRIER_CYCLES);
        mCarrierCycles = value;
    
public voidsetCarrierFrequencyInHz(float carrierFrequencyInHz)
Sets the Carrier frequency (L1 or L2) in Hz.

        setFlag(HAS_CARRIER_FREQUENCY);
        mCarrierFrequencyInHz = carrierFrequencyInHz;
    
public voidsetCarrierPhase(double value)
Sets the RF phase detected by the receiver.

        setFlag(HAS_CARRIER_PHASE);
        mCarrierPhase = value;
    
public voidsetCarrierPhaseUncertainty(double value)
Sets the Carrier-phase's uncertainty (1-Sigma) in cycles.

        setFlag(HAS_CARRIER_PHASE_UNCERTAINTY);
        mCarrierPhaseUncertainty = value;
    
public voidsetCn0InDbHz(double value)
Sets the carrier-to-noise density in dB-Hz.

        mCn0InDbHz = value;
    
public voidsetCodePhaseInChips(double value)
Sets the Code-phase in chips.

        setFlag(HAS_CODE_PHASE);
        mCodePhaseInChips = value;
    
public voidsetCodePhaseUncertaintyInChips(double value)
Sets the Code-phase's uncertainty (1-Sigma) in fractions of chips.

        setFlag(HAS_CODE_PHASE_UNCERTAINTY);
        mCodePhaseUncertaintyInChips = value;
    
public voidsetDopplerShiftInHz(double value)
Sets the Doppler shift in Hz.

        setFlag(HAS_DOPPLER_SHIFT);
        mDopplerShiftInHz = value;
    
public voidsetDopplerShiftUncertaintyInHz(double value)
Sets the Doppler's shift uncertainty (1-Sigma) in Hz.

        setFlag(HAS_DOPPLER_SHIFT_UNCERTAINTY);
        mDopplerShiftUncertaintyInHz = value;
    
public voidsetElevationInDeg(double elevationInDeg)
Sets the Elevation in degrees.

        setFlag(HAS_ELEVATION);
        mElevationInDeg = elevationInDeg;
    
public voidsetElevationUncertaintyInDeg(double value)
Sets the elevation's uncertainty (1-Sigma) in degrees.

        setFlag(HAS_ELEVATION_UNCERTAINTY);
        mElevationUncertaintyInDeg = value;
    
private voidsetFlag(int flag)

        mFlags |= flag;
    
public voidsetLossOfLock(byte value)
Sets the 'loss of lock' status.

        switch (value) {
            case LOSS_OF_LOCK_UNKNOWN:
            case LOSS_OF_LOCK_OK:
            case LOSS_OF_LOCK_CYCLE_SLIP:
                mLossOfLock = value;
                break;
            default:
                Log.d(TAG, "Sanitizing invalid 'loss of lock': " + value);
                mLossOfLock = LOSS_OF_LOCK_UNKNOWN;
                break;
        }
    
public voidsetMultipathIndicator(byte value)
Sets the 'multi-path' indicator.

        switch (value) {
            case MULTIPATH_INDICATOR_UNKNOWN:
            case MULTIPATH_INDICATOR_DETECTED:
            case MULTIPATH_INDICATOR_NOT_USED:
                mMultipathIndicator = value;
                break;
            default:
                Log.d(TAG, "Sanitizing invalid 'muti-path indicator': " + value);
                mMultipathIndicator = MULTIPATH_INDICATOR_UNKNOWN;
                break;
        }
    
public voidsetPrn(byte value)
Sets the Pseud-random number (PRN).

        mPrn = value;
    
public voidsetPseudorangeInMeters(double value)
Sets the Pseudo-range in meters.

        setFlag(HAS_PSEUDORANGE);
        mPseudorangeInMeters = value;
    
public voidsetPseudorangeRateInMetersPerSec(double value)
Sets the pseudorange rate at the timestamp in m/s.

        mPseudorangeRateInMetersPerSec = value;
    
public voidsetPseudorangeRateUncertaintyInMetersPerSec(double value)
Sets the pseudorange's rate uncertainty (1-Sigma) in m/s.

        mPseudorangeRateUncertaintyInMetersPerSec = value;
    
public voidsetPseudorangeUncertaintyInMeters(double value)
Sets the pseudo-range's uncertainty (1-Sigma) in meters.

        setFlag(HAS_PSEUDORANGE_UNCERTAINTY);
        mPseudorangeUncertaintyInMeters = value;
    
public voidsetReceivedGpsTowInNs(long value)
Sets the received GPS time-of-week in nanoseconds.

        mReceivedGpsTowInNs = value;
    
public voidsetReceivedGpsTowUncertaintyInNs(long value)
Sets the received GPS time-of-week's uncertainty (1-Sigma) in nanoseconds.

        mReceivedGpsTowUncertaintyInNs = value;
    
public voidsetSnrInDb(double snrInDb)
Sets the Signal-to-noise ratio (SNR) in dB.

        setFlag(HAS_SNR);
        mSnrInDb = snrInDb;
    
public voidsetState(short value)
Sets the sync state.

        switch (value) {
            case STATE_UNKNOWN:
            case STATE_BIT_SYNC:
            case STATE_CODE_LOCK:
            case STATE_SUBFRAME_SYNC:
            case STATE_TOW_DECODED:
                mState = value;
                break;
            default:
                Log.d(TAG, "Sanitizing invalid 'sync state': " + value);
                mState = STATE_UNKNOWN;
                break;
        }
    
public voidsetTimeFromLastBitInMs(short value)
Sets the elapsed time since the last received bit in milliseconds.

        setFlag(HAS_TIME_FROM_LAST_BIT);
        mTimeFromLastBitInMs = value;
    
public voidsetTimeOffsetInNs(double value)
Sets the time offset at which the measurement was taken in nanoseconds.

        mTimeOffsetInNs = value;
    
public voidsetUsedInFix(boolean value)
Sets the Used-in-Fix flag.

        mUsedInFix = value;
    
public java.lang.StringtoString()

        final String format = "   %-29s = %s\n";
        final String formatWithUncertainty = "   %-29s = %-25s   %-40s = %s\n";
        StringBuilder builder = new StringBuilder("GpsMeasurement:\n");

        builder.append(String.format(format, "Prn", mPrn));

        builder.append(String.format(format, "TimeOffsetInNs", mTimeOffsetInNs));

        builder.append(String.format(format, "State", getStateString()));

        builder.append(String.format(
                formatWithUncertainty,
                "ReceivedGpsTowInNs",
                mReceivedGpsTowInNs,
                "ReceivedGpsTowUncertaintyInNs",
                mReceivedGpsTowUncertaintyInNs));

        builder.append(String.format(format, "Cn0InDbHz", mCn0InDbHz));

        builder.append(String.format(
                formatWithUncertainty,
                "PseudorangeRateInMetersPerSec",
                mPseudorangeRateInMetersPerSec,
                "PseudorangeRateUncertaintyInMetersPerSec",
                mPseudorangeRateUncertaintyInMetersPerSec));

        builder.append(String.format(
                format,
                "AccumulatedDeltaRangeState",
                getAccumulatedDeltaRangeStateString()));

        builder.append(String.format(
                formatWithUncertainty,
                "AccumulatedDeltaRangeInMeters",
                mAccumulatedDeltaRangeInMeters,
                "AccumulatedDeltaRangeUncertaintyInMeters",
                mAccumulatedDeltaRangeUncertaintyInMeters));

        builder.append(String.format(
                formatWithUncertainty,
                "PseudorangeInMeters",
                hasPseudorangeInMeters() ? mPseudorangeInMeters : null,
                "PseudorangeUncertaintyInMeters",
                hasPseudorangeUncertaintyInMeters() ? mPseudorangeUncertaintyInMeters : null));

        builder.append(String.format(
                formatWithUncertainty,
                "CodePhaseInChips",
                hasCodePhaseInChips() ? mCodePhaseInChips : null,
                "CodePhaseUncertaintyInChips",
                hasCodePhaseUncertaintyInChips() ? mCodePhaseUncertaintyInChips : null));

        builder.append(String.format(
                format,
                "CarrierFrequencyInHz",
                hasCarrierFrequencyInHz() ? mCarrierFrequencyInHz : null));

        builder.append(String.format(
                format,
                "CarrierCycles",
                hasCarrierCycles() ? mCarrierCycles : null));

        builder.append(String.format(
                formatWithUncertainty,
                "CarrierPhase",
                hasCarrierPhase() ? mCarrierPhase : null,
                "CarrierPhaseUncertainty",
                hasCarrierPhaseUncertainty() ? mCarrierPhaseUncertainty : null));

        builder.append(String.format(format, "LossOfLock", getLossOfLockString()));

        builder.append(String.format(
                format,
                "BitNumber",
                hasBitNumber() ? mBitNumber : null));

        builder.append(String.format(
                format,
                "TimeFromLastBitInMs",
                hasTimeFromLastBitInMs() ? mTimeFromLastBitInMs : null));

        builder.append(String.format(
                formatWithUncertainty,
                "DopplerShiftInHz",
                hasDopplerShiftInHz() ? mDopplerShiftInHz : null,
                "DopplerShiftUncertaintyInHz",
                hasDopplerShiftUncertaintyInHz() ? mDopplerShiftUncertaintyInHz : null));

        builder.append(String.format(format, "MultipathIndicator", getMultipathIndicatorString()));

        builder.append(String.format(
                format,
                "SnrInDb",
                hasSnrInDb() ? mSnrInDb : null));

        builder.append(String.format(
                formatWithUncertainty,
                "ElevationInDeg",
                hasElevationInDeg() ? mElevationInDeg : null,
                "ElevationUncertaintyInDeg",
                hasElevationUncertaintyInDeg() ? mElevationUncertaintyInDeg : null));

        builder.append(String.format(
                formatWithUncertainty,
                "AzimuthInDeg",
                hasAzimuthInDeg() ? mAzimuthInDeg : null,
                "AzimuthUncertaintyInDeg",
                hasAzimuthUncertaintyInDeg() ? mAzimuthUncertaintyInDeg : null));

        builder.append(String.format(format, "UsedInFix", mUsedInFix));

        return builder.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)


          
        parcel.writeInt(mFlags);
        parcel.writeByte(mPrn);
        parcel.writeDouble(mTimeOffsetInNs);
        parcel.writeInt(mState);
        parcel.writeLong(mReceivedGpsTowInNs);
        parcel.writeLong(mReceivedGpsTowUncertaintyInNs);
        parcel.writeDouble(mCn0InDbHz);
        parcel.writeDouble(mPseudorangeRateInMetersPerSec);
        parcel.writeDouble(mPseudorangeRateUncertaintyInMetersPerSec);
        parcel.writeInt(mAccumulatedDeltaRangeState);
        parcel.writeDouble(mAccumulatedDeltaRangeInMeters);
        parcel.writeDouble(mAccumulatedDeltaRangeUncertaintyInMeters);
        parcel.writeDouble(mPseudorangeInMeters);
        parcel.writeDouble(mPseudorangeUncertaintyInMeters);
        parcel.writeDouble(mCodePhaseInChips);
        parcel.writeDouble(mCodePhaseUncertaintyInChips);
        parcel.writeFloat(mCarrierFrequencyInHz);
        parcel.writeLong(mCarrierCycles);
        parcel.writeDouble(mCarrierPhase);
        parcel.writeDouble(mCarrierPhaseUncertainty);
        parcel.writeByte(mLossOfLock);
        parcel.writeInt(mBitNumber);
        parcel.writeInt(mTimeFromLastBitInMs);
        parcel.writeDouble(mDopplerShiftInHz);
        parcel.writeDouble(mDopplerShiftUncertaintyInHz);
        parcel.writeByte(mMultipathIndicator);
        parcel.writeDouble(mSnrInDb);
        parcel.writeDouble(mElevationInDeg);
        parcel.writeDouble(mElevationUncertaintyInDeg);
        parcel.writeDouble(mAzimuthInDeg);
        parcel.writeDouble(mAzimuthUncertaintyInDeg);
        parcel.writeInt(mUsedInFix ? 1 : 0);