Methods Summary |
---|
public int | describeContents()
return 0;
|
public double | getBiasInNs()Gets the clock's sub-nanosecond bias.
The reported bias includes {@link #getBiasUncertaintyInNs()}.
The value is only available if {@link #hasBiasInNs()} is true.
return mBiasInNs;
|
public double | getBiasUncertaintyInNs()Gets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
The value is only available if {@link #hasBiasUncertaintyInNs()} is true.
return mBiasUncertaintyInNs;
|
public double | getDriftInNsPerSec()Gets the clock's Drift in nanoseconds per second.
A positive value indicates that the frequency is higher than the nominal frequency.
The reported drift includes {@link #getDriftUncertaintyInNsPerSec()}.
The value is only available if {@link #hasDriftInNsPerSec()} is true.
return mDriftInNsPerSec;
|
public double | getDriftUncertaintyInNsPerSec()Gets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
The value is only available if {@link #hasDriftUncertaintyInNsPerSec()} is true.
return mDriftUncertaintyInNsPerSec;
|
public long | getFullBiasInNs()Gets the difference between hardware clock ({@link #getTimeInNs()}) inside GPS receiver and
the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
This value is available if {@link #TYPE_LOCAL_HW_TIME} is set, and GPS receiver has solved
the clock for GPS time.
{@link #getBiasUncertaintyInNs()} should be used for quality check.
The sign of the value is defined by the following equation:
true time (GPS time) = time_ns + (full_bias_ns + bias_ns)
The reported full bias includes {@link #getBiasUncertaintyInNs()}.
The value is onl available if {@link #hasFullBiasInNs()} is true.
return mFullBiasInNs;
|
public short | getLeapSecond()Gets the leap second associated with the clock's time.
The sign of the value is defined by the following equation:
utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000
The value is only available if {@link #hasLeapSecond()} is true.
return mLeapSecond;
|
public long | getTimeInNs()Gets the GPS receiver internal clock value in nanoseconds.
This can be either the 'local hardware clock' value ({@link #TYPE_LOCAL_HW_TIME}), or the
current GPS time derived inside GPS receiver ({@link #TYPE_GPS_TIME}).
{@link #getType()} defines the time reported.
For 'local hardware clock' this value is expected to be monotonically increasing during the
reporting session. The real GPS time can be derived by compensating
{@link #getFullBiasInNs()} (when it is available) from this value.
For 'GPS time' this value is expected to be the best estimation of current GPS time that GPS
receiver can achieve. {@link #getTimeUncertaintyInNs()} should be available when GPS time is
specified.
Sub-nanosecond accuracy can be provided by means of {@link #getBiasInNs()}.
The reported time includes {@link #getTimeUncertaintyInNs()}.
return mTimeInNs;
|
public double | getTimeUncertaintyInNs()Gets the clock's time Uncertainty (1-Sigma) in nanoseconds.
The uncertainty is represented as an absolute (single sided) value.
The value is only available if {@link #hasTimeUncertaintyInNs()} is true.
return mTimeUncertaintyInNs;
|
public byte | getType()Gets the type of time reported by {@link #getTimeInNs()}.
return mType;
|
private java.lang.String | getTypeString()Gets a string representation of the 'type'.
For internal and logging use only.
switch (mType) {
case TYPE_UNKNOWN:
return "Unknown";
case TYPE_GPS_TIME:
return "GpsTime";
case TYPE_LOCAL_HW_TIME:
return "LocalHwClock";
default:
return "<Invalid>";
}
|
public boolean | hasBiasInNs()Returns true if {@link #getBiasInNs()} is available, false otherwise.
return isFlagSet(HAS_BIAS);
|
public boolean | hasBiasUncertaintyInNs()Returns true if {@link #getBiasUncertaintyInNs()} is available, false otherwise.
return isFlagSet(HAS_BIAS_UNCERTAINTY);
|
public boolean | hasDriftInNsPerSec()Returns true if {@link #getDriftInNsPerSec()} is available, false otherwise.
return isFlagSet(HAS_DRIFT);
|
public boolean | hasDriftUncertaintyInNsPerSec()Returns true if {@link #getDriftUncertaintyInNsPerSec()} is available, false otherwise.
return isFlagSet(HAS_DRIFT_UNCERTAINTY);
|
public boolean | hasFullBiasInNs()Returns true if {@link @getFullBiasInNs()} is available, false otherwise.
return isFlagSet(HAS_FULL_BIAS);
|
public boolean | hasLeapSecond()Returns true if {@link #getLeapSecond()} is available, false otherwise.
return isFlagSet(HAS_LEAP_SECOND);
|
public boolean | hasTimeUncertaintyInNs()Returns true if {@link #getTimeUncertaintyInNs()} is available, false otherwise.
return isFlagSet(HAS_TIME_UNCERTAINTY);
|
private void | initialize()
mFlags = HAS_NO_FLAGS;
resetLeapSecond();
setType(TYPE_UNKNOWN);
setTimeInNs(Long.MIN_VALUE);
resetTimeUncertaintyInNs();
resetFullBiasInNs();
resetBiasInNs();
resetBiasUncertaintyInNs();
resetDriftInNsPerSec();
resetDriftUncertaintyInNsPerSec();
|
private boolean | isFlagSet(short flag)
return (mFlags & flag) == flag;
|
public void | reset()Resets all the contents to its original state.
initialize();
|
public void | resetBiasInNs()Resets the clock's Bias in nanoseconds.
resetFlag(HAS_BIAS);
mBiasInNs = Double.NaN;
|
public void | resetBiasUncertaintyInNs()Resets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
resetFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = Double.NaN;
|
public void | resetDriftInNsPerSec()Resets the clock's Drift in nanoseconds per second.
resetFlag(HAS_DRIFT);
mDriftInNsPerSec = Double.NaN;
|
public void | resetDriftUncertaintyInNsPerSec()Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
resetFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = Double.NaN;
|
private void | resetFlag(short flag)
mFlags &= ~flag;
|
public void | resetFullBiasInNs()Resets the full bias in nanoseconds.
resetFlag(HAS_FULL_BIAS);
mFullBiasInNs = Long.MIN_VALUE;
|
public void | resetLeapSecond()Resets the leap second associated with the clock's time.
resetFlag(HAS_LEAP_SECOND);
mLeapSecond = Short.MIN_VALUE;
|
public void | resetTimeUncertaintyInNs()Resets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
resetFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = Double.NaN;
|
public void | set(android.location.GpsClock clock)Sets all contents to the values stored in the provided object.
mFlags = clock.mFlags;
mLeapSecond = clock.mLeapSecond;
mType = clock.mType;
mTimeInNs = clock.mTimeInNs;
mTimeUncertaintyInNs = clock.mTimeUncertaintyInNs;
mFullBiasInNs = clock.mFullBiasInNs;
mBiasInNs = clock.mBiasInNs;
mBiasUncertaintyInNs = clock.mBiasUncertaintyInNs;
mDriftInNsPerSec = clock.mDriftInNsPerSec;
mDriftUncertaintyInNsPerSec = clock.mDriftUncertaintyInNsPerSec;
|
public void | setBiasInNs(double biasInNs)Sets the sub-nanosecond bias.
setFlag(HAS_BIAS);
mBiasInNs = biasInNs;
|
public void | setBiasUncertaintyInNs(double biasUncertaintyInNs)Sets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
setFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = biasUncertaintyInNs;
|
public void | setDriftInNsPerSec(double driftInNsPerSec)Sets the clock's Drift in nanoseconds per second.
setFlag(HAS_DRIFT);
mDriftInNsPerSec = driftInNsPerSec;
|
public void | setDriftUncertaintyInNsPerSec(double driftUncertaintyInNsPerSec)Sets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
setFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = driftUncertaintyInNsPerSec;
|
private void | setFlag(short flag)
mFlags |= flag;
|
public void | setFullBiasInNs(long value)Sets the full bias in nanoseconds.
setFlag(HAS_FULL_BIAS);
mFullBiasInNs = value;
|
public void | setLeapSecond(short leapSecond)Sets the leap second associated with the clock's time.
setFlag(HAS_LEAP_SECOND);
mLeapSecond = leapSecond;
|
public void | setTimeInNs(long timeInNs)Sets the GPS receiver internal clock in nanoseconds.
mTimeInNs = timeInNs;
|
public void | setTimeUncertaintyInNs(double timeUncertaintyInNs)Sets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
setFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = timeUncertaintyInNs;
|
public void | setType(byte value)Sets the type of time reported.
switch (value) {
case TYPE_UNKNOWN:
case TYPE_GPS_TIME:
case TYPE_LOCAL_HW_TIME:
mType = value;
break;
default:
Log.d(TAG, "Sanitizing invalid 'type': " + value);
mType = TYPE_UNKNOWN;
break;
}
|
public java.lang.String | toString()
final String format = " %-15s = %s\n";
final String formatWithUncertainty = " %-15s = %-25s %-26s = %s\n";
StringBuilder builder = new StringBuilder("GpsClock:\n");
builder.append(String.format(format, "Type", getTypeString()));
builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null));
builder.append(String.format(
formatWithUncertainty,
"TimeInNs",
mTimeInNs,
"TimeUncertaintyInNs",
hasTimeUncertaintyInNs() ? mTimeUncertaintyInNs : null));
builder.append(String.format(
format,
"FullBiasInNs",
hasFullBiasInNs() ? mFullBiasInNs : null));
builder.append(String.format(
formatWithUncertainty,
"BiasInNs",
hasBiasInNs() ? mBiasInNs : null,
"BiasUncertaintyInNs",
hasBiasUncertaintyInNs() ? mBiasUncertaintyInNs : null));
builder.append(String.format(
formatWithUncertainty,
"DriftInNsPerSec",
hasDriftInNsPerSec() ? mDriftInNsPerSec : null,
"DriftUncertaintyInNsPerSec",
hasDriftUncertaintyInNsPerSec() ? mDriftUncertaintyInNsPerSec : null));
return builder.toString();
|
public void | writeToParcel(android.os.Parcel parcel, int flags)
parcel.writeInt(mFlags);
parcel.writeInt(mLeapSecond);
parcel.writeByte(mType);
parcel.writeLong(mTimeInNs);
parcel.writeDouble(mTimeUncertaintyInNs);
parcel.writeLong(mFullBiasInNs);
parcel.writeDouble(mBiasInNs);
parcel.writeDouble(mBiasUncertaintyInNs);
parcel.writeDouble(mDriftInNsPerSec);
parcel.writeDouble(mDriftUncertaintyInNsPerSec);
|