carp_mobile_sensing library
This library contains the software architecture for the CARP Mobile Sensing (CAMS) framework implemented in Flutter. Supports cross-platform (iOS and Android) sensing.
Classes
- AbstractDataManager
-
An abstract
DataManager
implementation useful for extension. -
AbstractExecutor<
TConfig> - An abstract implementation of a Executor to extend from.
- AccelerometerDatum
- A Datum that holds acceleration data collected from the native accelerometer on the phone. Accelerometers measure the velocity of the device. Note that these readings include the effects of gravity. Put simply, you can use accelerometer readings to tell if the device is moving in a particular direction.
- AccelerometerProbe
- A probe collecting raw data from the accelerometer.
-
AggregateExecutor<
TConfig> - An abstract class used to implement aggregated executors (i.e., executors with a set of underlying executors).
- AppTask
- A task that notifies the app when it is triggered.
- AppTaskController
- A controller of UserTasks which is accessible in the userTaskQueue.
-
AppTaskExecutor<
TConfig extends AppTask> - Executes an AppTask.
- AwesomeNotificationController
- A NotificationController based on the awesome_notifications Flutter plugin.
- BackgroundSensingUserTask
-
A non-UI sensing task that collects sensor data in the background.
For example, a
noise
datum. - BackgroundTaskExecutor
-
Executes a
BackgroundTask
. - BatteryDatum
- A Datum that holds battery level collected from the phone.
- BatteryProbe
- The BatteryProbe listens to the hardware battery and collect a BatteryDatum every time the battery state changes. For example, battery level or charging mode.
-
BTLEDeviceManager<
TDeviceRegistration extends DeviceRegistration, TDeviceDescriptor extends DeviceDescriptor> - A device manager for a connectable bluetooth device.
- BufferingAccelerometerProbe
- A probe that collects accelerometer events and buffers them and return a MultiDatum with all the buffered AccelerometerDatums.
- BufferingGyroscopeProbe
- A probe that collects gyroscope events and buffers them and return a MultiDatum with all the buffered GyroscopeDatums.
- BufferingIntervalStreamProbe
-
An abstract probe which can be used to buffer data from a stream and collect data
every
interval
. All events from the bufferingStream are buffered, and collected from the getDatum method everyinterval
and send to the main data stream. - BufferingMagnetometerProbe
- A probe that collects gyroscope events and buffers them and return a MultiDatum with all the buffered GyroscopeDatums.
- BufferingPeriodicProbe
-
An abstract probe which can be used to sample data into a buffer,
every
frequency
for a period ofduration
. These events are buffered, and once collected for theduration
, are collected from the getDatum method and send to the main data stream. - BufferingPeriodicStreamProbe
-
An abstract probe which can be used to sample data from a buffering stream,
every
interval
for a period ofduration
. These events are buffered for the specifiedduration
, and then collected from the getDatum method and send to the main data stream. - BufferingSensorProbe
- A simple abstract probe to be used to implement specific buffered sensor probes.
- BufferingUserAccelerometerProbe
- A probe that collects accelerometer events and buffers them and return a MultiDatum with all the buffered AccelerometerDatums.
- CAMSDataType
-
Enumeration of data types used in
DataType
andDataFormat
. - CarpMobileSensing
- CARPTransformerSchema
- A default DatumTransformerSchema for CARP no-operation transformers
- ConditionalEvent
- Specified the configuration of an event in a SamplingEventTrigger.
- ConditionalPeriodicTrigger
- A trigger that periodically checks if application-specific resume and pause conditions are meet.
- ConditionalPeriodicTriggerExecutor
- Executes a ConditionalPeriodicTrigger.
- ConditionalSamplingEventTrigger
- A trigger that resume and pause sampling when some (other) sampling event occurs and a application-specific condition is meet.
- ConditionalSamplingEventTriggerExecutor
- Executes a ConditionalSamplingEventTrigger based on the specified ConditionalSamplingEventTrigger.measureType and their ConditionalSamplingEventTrigger.resumeCondition and ConditionalSamplingEventTrigger.pauseCondition.
- ConsoleDataManager
- A very simple data manager that just "uploads" the data to the console (i.e., prints it). Used mainly for testing and debugging purposes.
- ConsoleDataManagerFactory
- Cron
- CronScheduledTrigger
- A trigger that resume sampling based on a cron job specification.
- CronScheduledTriggerExecutor
- Executes a CronScheduledTrigger based on the specified cron job.
- DataManagerFactory
-
A factory which can create a
DataManager
based on thetype
of anDataEndPoint
. - DataManagerRegistry
- A registry of DataManagerFactorys.
- DateTimeTrigger
- A trigger that starts sampling based on a schedule of a date and time, and runs for a specific duration.
- DateTimeTriggerExecutor
- Executes a DateTimeTrigger on the specified date and time.
- Datum
- A base (abstract) class for a single unit of sensed information.
- DatumProbe
- This probe collects one piece of Datum when resumed, send its to the data stream, and the automatically pauses.
- DatumTransformerFactory
- A factory which can create a DatumTransformer.
- DatumTransformerSchema
- An abstract class defining a transformer schema, which hold a set of DatumTransformers that can map from the native CARP namespace to another namespace. A DatumTransformerSchema must be implemented for each supported namespace.
- DelayedTrigger
- A trigger that delays sampling for delay and then starts sampling. Never stops sampling once started.
- DelayedTriggerExecutor
- Executes a DelayedTrigger, i.e. resumes sampling after the specified delay. Once started, it can be paused / resumed as any other Executor.
- DeviceController
- A DeviceController handles runtime management of all devices and services connected to this phone, including the phone itself.
- DeviceDatum
- Holds basic information about the mobile device from where the data is collected.
- DeviceInfo
- Provides (static) information about the local device.
-
DeviceManager<
TDeviceRegistration extends DeviceRegistration, TDeviceDescriptor extends DeviceDescriptor> - A DeviceManager handles a hardware device or online service on runtime.
- DeviceProbe
- A probe that collects the device info about this device.
- DeviceSamplingPackage
- ElapsedTimeTriggerExecutor
-
Executes a
ElapsedTimeTrigger
, i.e. resumes sampling after the specified delay after deployment start on this phone. - ErrorDatum
- A Datum object holding a Error, i.e. that the probe / sensor returned some sort of error, which is reported back.
-
Executor<
TConfig> -
A Executor is responsible for executing data collection based on a
configuration
TConfig
. - FHIRTransformerSchema
- A default DatumTransformerSchema for HL7 FHIR transformers
- FileDataEndPoint
-
Specify an endpoint where a file-based
DataManager
can store JSON data as files on the local device. - FileDataManager
-
Stores
DataPoint
json objects on the device's local storage media. Supports compression (zip) and encryption. - FileDataManagerEvent
- A status event for this file data manager. See FileDataManagerEventTypes for a list of possible event types.
- FileDataManagerEventTypes
- An enumeration of file data manager event types
- FileDataManagerFactory
- FileDatum
- A Datum object holding a link to a file.
- FileStudyProtocolManager
-
Retrieve and store
StudyProtocol
json definitions on the device's local file system. - FlutterLocalNotificationController
- A NotificationController based on the flutter_local_notifications Flutter plugin.
- FreeMemoryDatum
- Holds information about free memory on the phone.
- FunctionTask
- A task that can run a custom Dart function.
- FunctionTaskExecutor
-
Executes a
BackgroundTask
. - GyroscopeDatum
- A Datum that holds rotation data collected from the native gyroscope on the phone. Gyroscopes measure the rate or rotation of the device in 3D space.
- GyroscopeProbe
- A probe collecting raw data from the gyroscope.
-
HardwareDeviceManager<
TDeviceRegistration extends DeviceRegistration, TDeviceDescriptor extends DeviceDescriptor> - A DeviceManager for a hardware device.
-
HasNext<
E> -
HasPrevious<
E> - HistoricSamplingConfiguration
- A sampling configuration which allows configuring the time back in the past and into the future to collect data.
- ImmediateTrigger
- A trigger that starts sampling immediately and never stops.
- ImmediateTriggerExecutor
- Executes a ImmediateTrigger, i.e. starts sampling immediately.
- IntervalDatumProbe
- A probe which is triggered at regular intervals, specified by the interval property in an IntervalSamplingConfiguration. When triggered, the probe collect a piece of data using the getDatum method.
- IntervalSamplingConfiguration
- A sampling configuration which allows configuring the time interval in between subsequent measurements.
- IntervalTrigger
- A trigger that resume sampling every period and then pauses.
- IntervalTriggerExecutor
- Executes a IntervalTrigger, i.e. resumes sampling on a regular basis.
- LightDatum
- A Datum that holds light intensity in Lux from the light sensor on the phone.
- LightProbe
- The LightProbe listens to the phone's light sensor typically located near the front camera. Every value is in the SI unit Lux and is stored in a LightDatum object.
- MagnetometerDatum
- A Datum that holds magnetometer data collected from the native magnetometer on the phone.
- MagnetometerProbe
- A probe collecting raw data from the gyroscope.
- MapDatum
- A generic Datum that holds a map of key, value string objects.
- MemoryProbe
-
A probe that collects free virtual memory on a regular basis
as specified in
PeriodicMeasure.frequency
. - MultiDatum
- A Datum object holding multiple Datums of the same type.
- NotificationController
- A controller of user notifications based on UserTasks. Works closely with the AppTaskController.
- OMHTransformerSchema
- A default DatumTransformerSchema for Open mHealth (OMH) transformers
- OneTimeBackgroundSensingUserTask
-
A non-UI sensing task that collects sensor data once.
For example collecting a
location
datum. - OneTimeTrigger
- A trigger that triggers once during a deployment.
- OneTimeTriggerExecutor
- Executes a OneTimeTrigger, i.e. a trigger that only runs once during a study deployment.
- OnlineService
- An online service which works as a "software device" in a protocol.
-
OnlineServiceManager<
TDeviceRegistration extends DeviceRegistration, TDeviceDescriptor extends OnlineService> - A DeviceManager for an online service, like a weather service.
- PassiveTrigger
- A trigger that waits to be started until the resume method is called. Is paused by calling the pause method.
- PassiveTriggerExecutor
- Executes a PassiveTrigger.
- PedometerDatum
- Holds the step count.
- PedometerProbe
- The pedometer probe listens to the hardware step counter sensor.
- PeriodicSamplingConfiguration
- A sampling configuration specifying how to collect data on a regular basis for a specific period.
- PeriodicStreamProbe
-
A periodic probe listening on a stream. Listening is done periodically as
specified in a PeriodicSamplingConfiguration listening on intervals every
interval
for a period ofduration
. During this period, all data are forwarded to this probes data stream. - PeriodicTrigger
- A trigger that resumes sampling every period for a specific duration.
- PeriodicTriggerExecutor
- Executes a PeriodicTrigger, i.e. resumes sampling on a regular basis for a given period of time.
- PersistentSamplingConfiguration
- A sampling configuration that saves the last time it was sampled.
- PrivacySchema
- A default DatumTransformerSchema for privacy transformers
- Probe
-
A Probe is a specialized Executor responsible for collecting data from
the device sensors as configured in a
Measure
. - RandomRecurrentTrigger
- A daily trigger that triggers a random number of times within a defined period of time of the day.
- RandomRecurrentTriggerExecutor
- Executes a RandomRecurrentTrigger triggering N times per day within a defined period of time.
- RecurrentScheduledTrigger
- A trigger that resume sampling based on a recurrent scheduled date and time.
- RecurrentScheduledTriggerExecutor
- Executes a RecurrentScheduledTrigger.
- SamplingEventTrigger
- A trigger that resume and pause sampling when some (other) sampling event occurs.
- SamplingEventTriggerExecutor
- Executes a SamplingEventTrigger based on the specified SamplingEventTrigger.measureType and SamplingEventTrigger.resumeCondition.
- SamplingPackage
- Interface for a sampling package.
- SamplingPackageRegistry
- A registry of SamplingPackage packages.
- SamplingSchema
-
Specifies a set of
SamplingConfiguration
s for a set ofMeasure
types. -
ScheduleableTriggerExecutor<
TConfig extends Trigger> -
Abstract class for executors of triggers which can be scheduled
(i.e., implementing the
Scheduleable
interface). - ScreenDatum
- Holds a screen event collected from the phone.
- ScreenProbe
- A probe collecting screen events:
- SensingUserTaskFactory
- A UserTaskFactory that can create the non-UI sensing tasks:
- SensorSamplingPackage
- Settings
- Misc. settings for CAMS.
- SmartPhoneClientManager
- SmartphoneDeployment
- Contains the entire description and configuration for how a smartphone master device participates in the deployment of a study on a smartphone.
- SmartphoneDeploymentController
- A SmartphoneDeploymentController controls the execution of a SmartphoneDeployment.
- SmartphoneDeploymentListener
- A Listener that can listen on changes to a SmartphoneDeployment.
- SmartphoneDeploymentService
-
A local (in-memory) implementation of a
DeploymentService
useful in CAMS studies to be deployed locally on this phone. - SmartphoneDeviceManager
- A device manager for a smartphone.
- SmartphoneSamplingPackage
- An abstract class for all sampling packages that run on the phone itself.
- SmartphoneStudyProtocol
- A description of how a study is to be executed on a smartphone.
- SQLiteDataEndPoint
- Specify an endpoint for using the SQLiteDataManager to store JSON data in a SQLite database locally on the phone.
- SQLiteDataManager
-
Stores
DataPoint
json objects in an SQLite database on the device's local storage media. The name of the table is 'data_points'. - SQLiteDataManagerFactory
- StreamProbe
- An abstract class used to create a probe that listen continously to events from the stream of Datum objects.
- StringDatum
- A simple Datum that only holds a string datum object.
- StudyDeploymentExecutor
- The StudyDeploymentExecutor is responsible for executing a SmartphoneDeployment. For each triggered task in this deployment, it starts a TriggeredTaskExecutor.
- StudyDescription
- StudyProtocolManager
- An interface defining a manger of SmartphoneStudyProtocols.
- StudyResponsible
-
A person who is responsible for a
StudyProtocol
. Typically the Principal Investigator (PI) who is responsible for the study. -
TaskExecutor<
TConfig extends TaskDescriptor> -
The TaskExecutor is responsible for executing a
TaskDescriptor
. For each measure in the task, it looks up appropriate Probes to collect data. - TimezoneDatum
- Holds timezone information about the mobile device.
- TimezoneProbe
- A probe that collects the device's current timezone.
- TransformerSchemaRegistry
- A registry of DatumTransformerSchemas which hold a set of DatumTransformers.
- TriggeredAppTaskExecutor
-
Responsible for handling the execution of a
TriggeredTask
which contains an AppTask. - TriggeredTaskExecutor
-
Responsible for handling the execution of a
TriggeredTask
. -
TriggerExecutor<
TConfig extends Trigger> -
Responsible for handling the execution of a
Trigger
. - UserAccelerometerDatum
- Like AccelerometerDatum, this is a discrete reading from an accelerometer and measures the velocity of the device. However, unlike AccelerometerDatum, this event does not include the effects of gravity.
- UserAccelerometerProbe
- A probe collecting raw data from the accelerometer.
- UserTask
- A task that the user of the app needs to attend to.
- UserTaskFactory
-
A factory which can create a UserTask based on the
type
of an AppTask. - UserTaskSnapshot
- A snapshot of a UserTask at any given time. Used for saving user tasks persistently across app restart.
- UserTaskSnapshotList
- UserTaskTrigger
- A trigger that triggers based on the state of a UserTask.
- UserTaskTriggerExecutor
- Executes a UserTaskTrigger.
Enums
- DebugLevel
- Debugging levels.
- DeviceStatus
- Runtime status for a DeviceManager.
- ExecutorState
- The state of an Executor.
- RecurrentType
- Type of recurrence for a RecurrentScheduledTrigger.
- UserTaskState
- The states of a UserTask.
Mixins
-
CronIterator<
E>
Functions
-
debug(
String message) → void - A simple method for printing debug messages to the console.
-
getTaskExecutor(
TaskDescriptor task) → TaskExecutor< TaskDescriptor> -
Returns the relevant TaskExecutor based on the type of
task
. -
getTriggeredTaskExecutor(
TriggeredTask triggeredTask, Trigger trigger, TaskDescriptor task) → TriggeredTaskExecutor -
Returns the relevant TriggeredTaskExecutor based on the type of
trigger
andtask
. -
getTriggerExecutor(
Trigger trigger) → TriggerExecutor< Trigger> -
Returns the relevant TriggerExecutor based on the type of
trigger
. -
info(
String message) → void - A simple method for printing warning messages to the console.
-
noop(
Datum datum) → Datum - A no-operation transformer.
-
onDidReceiveNotificationResponse(
NotificationResponse response) → void -
warning(
String message) → void - A simple method for printing warning messages to the console.
Typedefs
- ConditionalEvaluator = bool Function()
-
Evaluates if a ConditionalPeriodicTrigger should resume or pause.
Returns
true
if resume or pause should happen,false
otherwise. - ConditionalEventEvaluator = bool Function(DataPoint dataPoint)
-
Takes a
DataPoint
from a sampling stream and evaluates if an event has occurred. Returnstrue
if the event has occurred,false
otherwise. - DatumTransformer = Datum Function(Datum)
- Signature of a data transformer.
- VoidFunction = void Function()
- Signature of Dart function that have no arguments and return no data.
Exceptions / Errors
- SensingException
- Generic sensing exception.