Measurement
A piece of collected data with the time it was measured.
A probe or task produces Data; the client wraps it in a Measurement with a timestamp and passes it on for storage and upload, e.g. in a DataStreamBatch. This is the unit of data collected in CARP. When sensorEndTime is set, the data pertains to an interval in time; otherwise, a point in time.
The unit of sensorStartTime and sensorEndTime is either determined by the sensor that collected the data, or, in case the sensor does not provide this information, by the phone. For example, the timestamps could be a simple clock increment since the device powered up. Note that in CARP we prefer microseconds over milliseconds for higher precision.
// Timestamp is now, in microseconds since epoch.
var measurement = Measurement.fromData(StepCount(steps: 12));
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
Measurement.fromData
Create a measurement from data based on the sensorStartTime provided by the sensor. If sensorStartTime is not specified, the phones current time stamp as microseconds since epoch is used.
Measurement.fromJson
Measurement
Create a new measurement based on data.
Properties
data
The Data collected in this measurement.
dataType
The type of the data.
sensorEndTime
End time as set by the sensor, if available.
sensorStartTime
Start time as set by the sensor.
If this timestamp has been provided by the sensor, the unit is determined by the sensor. If this timestamp is provided by the phone (e.g., by using the Measurement.fromData method), this timestamp is in microseconds since epoch.
taskControl
- @JsonKey(includeFromJson: false, includeToJson: false)
The TaskControl which triggered the collection of this measurement. Set at runtime only; not serialized.