infrastructure
The CAMS infrastructure layer: on-phone implementations of the CAMS services.
Holds the local deployment service (SmartphoneDeploymentService), the data managers that store measurements on the phone (ConsoleDataManager, FileDataManager, SQLiteDataManager), the FileStudyProtocolManager, the FlutterLocalNotificationManager, and the PersistenceService that saves runtime state across app restarts. These classes implement the interfaces defined in the domain layer and are used by the runtime layer. The built-in sampling packages are in the sampling_packages library.
Classes
BackgroundService— Keeps data collection running while the app is in the background on Android.ConsoleDataManager— A data manager that prints each Measurement as JSON to the console.ConsoleDataManagerFactory— Creates a ConsoleDataManager for data endpoints of type DataEndPointTypes.PRINT.FileDataManager— A data manager that writes Measurements as JSON to files on the phone.FileDataManagerEvent— A status event from a FileDataManager, carrying the path of the file it concerns.FileDataManagerEventTypes— The event types used in FileDataManagerEvent, in addition to those in DataManagerEventTypes.FileDataManagerFactory— Creates a FileDataManager for data endpoints of type DataEndPointTypes.FILE.FileStudyProtocolManager— A StudyProtocolManager that loads and saves SmartphoneStudyProtocols as JSON files on the phone.FlutterLocalNotificationManager— A NotificationManager that shows local notifications using the flutter_local_notifications plugin.PersistenceService— Stores running studies and the user task queue in a local SQLite database, so they survive an app restart.SQLiteDataManager— A data manager that stores Measurements as JSON in a local SQLite database.SQLiteDataManagerFactory— Creates a SQLiteDataManager for data endpoints of type DataEndPointTypes.SQLITE.Settings— Global settings for CAMS: logging level, app info, time zone, a user ID, and the file paths used to store data on the phone.SmartphoneDeploymentService— A DeploymentService that runs locally on the phone and keeps deployments in memory.
Enums
DebugLevel— The amount of logging done by CAMS, set in Settings.debugLevel.
Functions
debug
- String message
Logs a debug message to the console. Only logged if Settings.debugLevel is DebugLevel.debug and the Flutter app runs in debug mode (kDebugMode).
info
- String message
Logs an information message to the console. Only logged if Settings.debugLevel is DebugLevel.info or higher.
onDidReceiveNotificationResponse
- NotificationResponse response
Handles a tap on a notification shown by FlutterLocalNotificationManager.
If the payload is the id of a UserTask, calls AppTaskController.onNotification. Otherwise the payload is emitted on FlutterLocalNotificationManager.notificationTaps. Top-level and marked as an entry point, so it can also run when the app is in the background.
warning
- String message
Logs a warning message to the console. Only logged if Settings.debugLevel is DebugLevel.warning or higher.