AbstractDataManager
A base DataManager to extend when you write your own data manager.
configure subscribes to the measurement stream and calls onMeasurement for each measurement; you implement onMeasurement to store or upload it. Errors on the stream are saved as Error measurements. Emits the DataManagerEventTypes.configured and DataManagerEventTypes.closed events.
- Implemented types
- Implementers
Constructors
AbstractDataManager
Properties
dataEndPoint
The DataEndPoint that this data manager is handling.
null until configure is called.
deployment
The deployment using this data manager.
events
Stream of data manager events, see DataManagerEventTypes.
studyDeploymentId
The ID of the study deployment that this manager is handling.
Methods
addEvent
- DataManagerEvent event
Adds event to the events stream.
close
Flushes any buffered data and closes this data manager.
After calling close the data manager can no longer be used.
configure
- required DataEndPoint dataEndPoint,
- required SmartphoneDeployment deployment,
- required Stream<
Measurement> measurements,
Configures the data manager with the study deployment, the dataEndPoint, and the stream of measurements to handle.
Call this before any data is handled.
onDone
When the data stream closes, the onDone handler is called. Default implementation is a no-op function. If another behavior is wanted, implementations of this abstract data manager should handle closing of the data stream.
onError
Saves error as an Error measurement via onMeasurement.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.