DataManager class abstract

Stores or uploads the Measurements collected in a study deployment.

A data manager listens to the measurement stream of one deployment and saves each measurement, e.g. to a file, a database, or a server. Which one is used is set by the protocol's DataEndPoint: the SmartphoneStudyController asks the DataManagerRegistry for a data manager of DataEndPoint.type and calls configure with the deployment's measurements.

Key points:

  • One instance per deployment. Several deployments can run at the same time, so implementations must not share resources like the same file or network socket.
  • onMeasurement is called for each measurement; onError and onDone for errors and the end of the stream.
  • Call close to flush buffered data. The data manager cannot be used after that.

See also AbstractDataManager to extend, the built-in SQLiteDataManager, FileDataManager, and ConsoleDataManager, and DataManagerFactory to register your own.

Implementers

Constructors

DataManager()

Properties

deployment → PrimaryDeviceDeployment
The deployment using this data manager.
no setter
events → Stream<DataManagerEvent>
Stream of data manager events, see DataManagerEventTypes.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
studyDeploymentId → String
The ID of the study deployment that this manager is handling.
no setter
type → String
The type of this data manager as enumerated in DataEndPointTypes.
no setter

Methods

close() → Future<void>
Flushes any buffered data and closes this data manager.
configure({required DataEndPoint dataEndPoint, required SmartphoneDeployment deployment, required Stream<Measurement> measurements}) → Future<void>
Configures the data manager with the study deployment, the dataEndPoint, and the stream of measurements to handle.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDone() → Future<void>
When the data stream closes, the onDone handler is called.
onError(Object error) → Future<void>
When an error event is sent on the stream, the onError handler is called.
onMeasurement(Measurement measurement) → Future<void>
On each measurement collected, the onMeasurement handler is called.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited