FileDataManager class
Stores DataPoint
json objects on the device's local storage media.
Supports compression (zip) and encryption.
The path and filename format is
~/carp/deployments/<study_deployment_id>/data/carp-data-yyyy-mm-dd-hh-mm-ss-ms.json.zip
where ~
is the folder where an application can place files that are private
to the application.
On iOS, this is the NSDocumentsDirectory
and the files can be accessed via
the MacOS Finder.
On Android, Flutter files are stored in the AppData
directory, which is
located in the data/data/<package_name>/app_flutter
folder.
Files can be accessed via AndroidStudio.
- Inheritance
-
- Object
- AbstractDataManager
- FileDataManager
Constructors
Properties
-
controller
↔ StreamController<
DataManagerEvent> -
getter/setter pairinherited
- dataEndPoint → DataEndPoint?
-
The
DataEndPoint
that this data manager is handling. Set in the initialize method.no setterinherited - deployment → SmartphoneDeployment
-
The deployment using this data manager.
no setterinherited
-
events
→ Stream<
DataManagerEvent> -
Stream of data manager events.
no setterinherited
-
file
→ Future<
File> -
The current file being written to.
no setter
- fileDataEndPoint → FileDataEndPoint
-
no setter
-
filename
→ Future<
String> -
Full path and filename according to this format:
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
path
→ Future<
String> -
The full path where data files are stored on the device.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sink
→ Future<
IOSink> -
The currently used IOSink.
no setter
- studyDeploymentId → String
-
no setterinherited
- type → String
-
The type of this data manager as enumerated in
DataEndPointTypes
.no setteroverride
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
-
flush(
File flushFile, IOSink flushSink) → Future< void> - Flushes data to the file, compress, encrypt, and close it.
-
initialize(
DataEndPoint dataEndPoint, MasterDeviceDeployment deployment, Stream< DataPoint> data) → Future<void> -
Initialize the data manager by specifying the
dataEndPoint
, studydeployment
, and the stream ofdata
events to handle.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDataPoint(
DataPoint dataPoint) → Future< void> -
On each data event from the data stream, the onDataPoint handler is
called. Implementations of this interface should handle how to save
or upload the
dataPoint
.override -
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
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
DataPoint dataPoint) → Future< void> -
Writes a JSON encoded
dataPoint
to the file.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited