public final class GnssClock extends Object implements Parcelable
It represents a measurement of the GPS receiver's clock.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<GnssClock> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
GnssClock() |
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
double |
getBiasNanos()
Gets the clock's sub-nanosecond bias.
|
double |
getBiasUncertaintyNanos()
Gets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
|
double |
getDriftNanosPerSecond()
Gets the clock's Drift in nanoseconds per second.
|
double |
getDriftUncertaintyNanosPerSecond()
Gets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
|
long |
getFullBiasNanos()
Gets the difference between hardware clock (
getTimeNanos() ) inside GPS receiver and
the true GPS time since 0000Z, January 6, 1980, in nanoseconds. |
int |
getHardwareClockDiscontinuityCount()
Gets count of hardware clock discontinuities.
|
int |
getLeapSecond()
Gets the leap second associated with the clock's time.
|
long |
getTimeNanos()
Gets the GNSS receiver internal hardware clock value in nanoseconds.
|
double |
getTimeUncertaintyNanos()
Gets the clock's time Uncertainty (1-Sigma) in nanoseconds.
|
boolean |
hasBiasNanos()
|
boolean |
hasBiasUncertaintyNanos()
|
boolean |
hasDriftNanosPerSecond()
|
boolean |
hasDriftUncertaintyNanosPerSecond()
|
boolean |
hasFullBiasNanos()
|
boolean |
hasLeapSecond()
|
boolean |
hasTimeUncertaintyNanos()
|
void |
reset()
Resets all the contents to its original state.
|
void |
resetBiasNanos()
Resets the clock's Bias in nanoseconds.
|
void |
resetBiasUncertaintyNanos()
Resets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
|
void |
resetDriftNanosPerSecond()
Resets the clock's Drift in nanoseconds per second.
|
void |
resetDriftUncertaintyNanosPerSecond()
Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
|
void |
resetFullBiasNanos()
Resets the full bias in nanoseconds.
|
void |
resetLeapSecond()
Resets the leap second associated with the clock's time.
|
void |
resetTimeUncertaintyNanos()
Resets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
|
void |
set(GnssClock clock)
Sets all contents to the values stored in the provided object.
|
void |
setBiasNanos(double biasNanos)
Sets the sub-nanosecond bias.
|
void |
setBiasUncertaintyNanos(double biasUncertaintyNanos)
Sets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
|
void |
setDriftNanosPerSecond(double driftNanosPerSecond)
Sets the clock's Drift in nanoseconds per second.
|
void |
setDriftUncertaintyNanosPerSecond(double driftUncertaintyNanosPerSecond)
Sets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
|
void |
setFullBiasNanos(long value)
Sets the full bias in nanoseconds.
|
void |
setHardwareClockDiscontinuityCount(int value)
Sets count of last hardware clock discontinuity.
|
void |
setLeapSecond(int leapSecond)
Sets the leap second associated with the clock's time.
|
void |
setTimeNanos(long timeNanos)
Sets the GNSS receiver internal clock in nanoseconds.
|
void |
setTimeUncertaintyNanos(double timeUncertaintyNanos)
Sets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
|
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel parcel,
int flags)
Flatten this object in to a Parcel.
|
public static final Parcelable.Creator<GnssClock> CREATOR
public void set(GnssClock clock)
public void reset()
public boolean hasLeapSecond()
public int getLeapSecond()
The sign of the value is defined by the following equation:
UtcTimeNanos = TimeNanos - (FullBiasNanos + BiasNanos) - LeapSecond * 1,000,000,000
The value is only available if hasLeapSecond()
is true
.
public void setLeapSecond(int leapSecond)
public void resetLeapSecond()
public long getTimeNanos()
This value is expected to be monotonically increasing while the hardware clock remains
powered on. For the case of a hardware clock that is not continuously on, see the
getHardwareClockDiscontinuityCount()
field. The GPS time can be derived by subtracting
the sum of getFullBiasNanos()
and getBiasNanos()
(when they are available)
from this value. Sub-nanosecond accuracy can be provided by means of getBiasNanos()
.
The error estimate for this value (if applicable) is getTimeUncertaintyNanos()
.
public void setTimeNanos(long timeNanos)
public boolean hasTimeUncertaintyNanos()
public double getTimeUncertaintyNanos()
The uncertainty is represented as an absolute (single sided) value.
The value is only available if hasTimeUncertaintyNanos()
is true
.
This value is often effectively zero (it is the reference clock by which all other times and time uncertainties are measured), and thus this field may often be 0, or not provided.
public void setTimeUncertaintyNanos(double timeUncertaintyNanos)
public void resetTimeUncertaintyNanos()
public boolean hasFullBiasNanos()
public long getFullBiasNanos()
getTimeNanos()
) inside GPS receiver and
the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
This value is available if the receiver has estimated GPS time. If the computed time is
for a non-GPS constellation, the time offset of that constellation to GPS has to be applied
to fill this value. The value is only available if hasFullBiasNanos()
is
true
.
The error estimate for the sum of this field and getBiasNanos()
is
getBiasUncertaintyNanos()
.
The sign of the value is defined by the following equation:
local estimate of GPS time = TimeNanos - (FullBiasNanos + BiasNanos)
public void setFullBiasNanos(long value)
public void resetFullBiasNanos()
public boolean hasBiasNanos()
public double getBiasNanos()
See the description of how this field is part of converting from hardware clock time, to
GPS time, in getFullBiasNanos()
.
The error estimate for the sum of this field and getFullBiasNanos()
is
getBiasUncertaintyNanos()
.
The value is only available if hasBiasNanos()
is true
.
public void setBiasNanos(double biasNanos)
public void resetBiasNanos()
public boolean hasBiasUncertaintyNanos()
public double getBiasUncertaintyNanos()
See the description of how this field provides the error estimate in the conversion from
hardware clock time, to GPS time, in getFullBiasNanos()
.
The value is only available if hasBiasUncertaintyNanos()
is true
.
public void setBiasUncertaintyNanos(double biasUncertaintyNanos)
public void resetBiasUncertaintyNanos()
public boolean hasDriftNanosPerSecond()
public double getDriftNanosPerSecond()
A positive value indicates that the frequency is higher than the nominal (e.g. GPS master
clock) frequency. The error estimate for this reported drift is
getDriftUncertaintyNanosPerSecond()
.
The value is only available if hasDriftNanosPerSecond()
is true
.
public void setDriftNanosPerSecond(double driftNanosPerSecond)
public void resetDriftNanosPerSecond()
public boolean hasDriftUncertaintyNanosPerSecond()
public double getDriftUncertaintyNanosPerSecond()
The value is only available if hasDriftUncertaintyNanosPerSecond()
is
true
.
public void setDriftUncertaintyNanosPerSecond(double driftUncertaintyNanosPerSecond)
public void resetDriftUncertaintyNanosPerSecond()
public int getHardwareClockDiscontinuityCount()
When this value stays the same, vs. a value in a previously reported GnssClock
, it
can be safely assumed that the TimeNanos
value has been derived from a clock that has
been running continuously - e.g. a single continuously powered crystal oscillator, and thus
the (FullBiasNanos + BiasNanos)
offset can be modelled with traditional clock bias
& drift models.
Each time this value changes, vs. the value in a previously reported GnssClock
,
that suggests the hardware clock may have experienced a discontinuity (e.g. a power cycle or
other anomaly), so that any assumptions about modelling a smoothly changing
(FullBiasNanos + BiasNanos)
offset, and a smoothly growing (TimeNanos)
between this and the previously reported GnssClock
, should be reset.
public void setHardwareClockDiscontinuityCount(int value)
public void writeToParcel(Parcel parcel, int flags)
Parcelable
writeToParcel
in interface Parcelable
parcel
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())