DataPoint

public final class DataPoint extends ProtoParcelable

Object
   ↳ ProtoParcelable
     ↳ DataPoint

A data point containing a value of type dataType from either a single point in time: DataType.TimeType.SAMPLE, or a range in time: DataType.TimeType.INTERVAL.

Summary

Nested types

DataPoint.Companion

Public fields

final DataPointAccuracy

Returns the accuracy of this DataPoint.

final @NonNull DataType
final @NonNull Duration

Elapsed end time of this DataPoint.

final @NonNull Bundle

Returns any provided metadata of this DataPoint.

final @NonNull Duration

Elapsed start time of this DataPoint.

final @NonNull Value

Public methods

final @NonNull Instant
getEndInstant(Instant bootInstant)

Returns the end Instant of this DataPoint, knowing the time at which the system booted.

final @NonNull Instant
getStartInstant(Instant bootInstant)

Returns the start Instant of this DataPoint, knowing the time at which the system booted.

@NonNull String

Inherited methods

From class ProtoParcelable
int
boolean
equals(Object other)
int
void
writeToParcel(Parcel dest, int flags)

Public fields

accuracy

public final DataPointAccuracy accuracy

Returns the accuracy of this DataPoint.

The specific DataPointAccuracy implementation this refers to depends on the DataType of the data point. For example, accuracy of DataType.LOCATION data points is represented by LocationAccuracy. If there is no associated DataPointAccuracy for the DataType, this will return null.

dataType

public final @NonNull DataType dataType

endDurationFromBoot

public final @NonNull Duration endDurationFromBoot

Elapsed end time of this DataPoint.

This represents the time at which this DataPoint ends, as a Duration since boot time. This is not exposed as a timestamp as the clock may drift between when the data is generated and when it is read out. Use getStartInstant to get the start time of this DataPoint as an Instant.

For instantaneous data points, this is equal to startDurationFromBoot.

metadata

public final @NonNull Bundle metadata

Returns any provided metadata of this DataPoint.

startDurationFromBoot

public final @NonNull Duration startDurationFromBoot

Elapsed start time of this DataPoint.

This represents the time at which this DataPoint originated, as a Duration since boot time. This is not exposed as a timestamp as the clock may drift between when the data is generated and when it is read out. Use getStartInstant to get the start time of this DataPoint as an Instant.

value

public final @NonNull Value value

Public methods

getEndInstant

public final @NonNull Instant getEndInstant(Instant bootInstant)

Returns the end Instant of this DataPoint, knowing the time at which the system booted.

Parameters
Instant bootInstant

the Instant at which the system booted, this can be computed by Instant.ofEpochMilli(System.currentTimeMillis() - SystemClock.elapsedRealtime())

getStartInstant

public final @NonNull Instant getStartInstant(Instant bootInstant)

Returns the start Instant of this DataPoint, knowing the time at which the system booted.

Parameters
Instant bootInstant

the Instant at which the system booted, this can be computed by Instant.ofEpochMilli(System.currentTimeMillis() - SystemClock.elapsedRealtime())