CarpDataManager class
Stores CAMS data points in the CARP Web Services (CAWS) backend.
Upload of data to CAWS can happen in three ways, as specified in CarpUploadMethod:
- CarpUploadMethod.stream - Upload data as data streams (the default method).
- CarpUploadMethod.datapoint - Upload each data point separately using the old DataPoint batch endpoint in CAWS.
- CarpUploadMethod.file - Collect measurements in a SQLite DB file and
upload as a
db
file
- Inheritance
-
- Object
- AbstractDataManager
- CarpDataManager
Constructors
Properties
- buffer ↔ DataStreamBuffer
-
getter/setter pair
- carpEndPoint ↔ CarpDataEndPoint
-
getter/setter pair
- connectivity ↔ ConnectivityResult
-
The connectivity status of this data manager.
getter/setter pair
- dataEndPoint → DataEndPoint?
-
The
DataEndPoint
that this data manager is handling. Set in the initialize method.no setterinherited - dataPointReference → DataPointReference
-
no setter
- deployment → SmartphoneDeployment
-
The deployment using this data manager.
no setterinherited
-
events
→ Stream<
DataManagerEvent> -
Stream of data manager events.
no setterinherited
- 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 setterinherited
- type → String
-
The type of this data manager as enumerated in
DataEndPointTypes
.no setteroverride - uploadTimer ↔ Timer?
-
getter/setter pair
Methods
-
addEvent(
DataManagerEvent event) → void -
Add
event
to the events stream.inherited -
close(
) → Future< void> -
Flush any buffered data and close this data manager.
After calling close the data manager can no longer be used.
override
-
initialize(
DataEndPoint dataEndPoint, SmartphoneDeployment deployment, Stream< Measurement> measurements) → Future<void> -
Initialize the data manager by specifying the study
deployment
, thedataEndPoint
, and the stream ofmeasurements
events to handle.override -
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.
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.
inherited
-
onError(
Object? error) → Future< void> -
When an error event is send on the stream, the onError handler is called.
inherited
-
onMeasurement(
Measurement measurement) → Future< void> -
On each measurement collected, the onMeasurement handler is called.
override
-
toString(
) → String -
A string representation of this object.
override
-
uploadBufferedMeasurements(
) → Future< void> - Upload buffered measurements to CAWS.
-
uploadDataStreamBatchesAsDataPoint(
List< DataStreamBatch> batches) → Future<void> -
Transform all measurements in all
batches
toDataPoint
s and upload them to CAWS using the DataPoint batch upload endpoint. -
uploadFile(
FileData data) → Future< void> -
Upload a file attachment to CAWS, i.e. one that is referenced
in a
FileData
data object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
ensureInitialized(
) → void - Make sure to create and initialize the CarpDataManager.