SmartphoneDeploymentService class

A DeploymentService that runs locally on the phone and keeps deployments in memory.

Used when a study is deployed from a local SmartphoneStudyProtocol instead of from a server. It is the default deployment service in SmartPhoneClientManager.configure. Use a server-backed service, such as the one in carp_webservices, to get deployments from CARP.

Key points:

  • A singleton, accessed as SmartphoneDeploymentService().
  • Only accepts SmartphoneStudyProtocols.
  • Registers thisPhone as the primary device of every new deployment.
  • Deployments are not persisted, so they are lost when the app restarts. Running studies are restored by PersistenceService instead.

Constructors

SmartphoneDeploymentService()
Get the singleton SmartphoneDeploymentService.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
thisPhone ↔ Smartphone
The device configuration for this phone. Registered as the primary device of every deployment created by this service.
getter/setter pair

Methods

createStudyDeployment(StudyProtocol protocol, [List<ParticipantInvitation> invitations = const [], String? id, Map<String, DeviceRegistration>? connectedDevicePreregistrations]) → Future<StudyDeploymentStatus>
Instantiate a study deployment for a given StudyProtocol with participants defined in invitations.
override
deployed(String studyDeploymentId, {DateTime? deviceDeploymentLastUpdateDate}) → Future<StudyDeploymentStatus?>
Marks the study deployment with studyDeploymentId as deployed successfully to this primary device (phone), i.e., that the study deployment was loaded on the device and that the necessary runtime is available to run it.
deviceDeployed(String studyDeploymentId, String primaryDeviceRoleName, DateTime? deviceDeploymentLastUpdatedOn) → Future<StudyDeploymentStatus?>
Indicate to stakeholders in the study deployment with studyDeploymentId that the device with primaryDeviceRoleName was deployed successfully, using the deployment with the specified deviceDeploymentLastUpdatedOn, i.e., that the study deployment was loaded on the device and that the necessary runtime is available to run it.
override
getDeviceDeployment(String studyDeploymentId) → Future<SmartphoneDeployment?>
Returns the SmartphoneDeployment for studyDeploymentId for this phone (thisPhone), or null if the deployment is unknown.
getDeviceDeploymentFor(String studyDeploymentId, String primaryDeviceRoleName) → Future<SmartphoneDeployment?>
Get the deployment configuration for the primary device with primaryDeviceRoleName in the study deployment with studyDeploymentId. Returns null if studyDeploymentId is not found.
override
getStudyDeploymentStatus(String studyDeploymentId) → Future<StudyDeploymentStatus?>
Get the status for a study deployment with the given studyDeploymentId. Returns null if studyDeploymentId is not found.
override
getStudyDeploymentStatusList(List<String> studyDeploymentIds) → Future<List<StudyDeploymentStatus?>>
Get the statuses for a set of deployments with the specified studyDeploymentIds. Returns null for IDs in studyDeploymentIds for which no deployment exists.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerDevice(String studyDeploymentId, String deviceRoleName, DeviceRegistration registration) → Future<StudyDeploymentStatus?>
Register the device with the specified deviceRoleName for the study deployment with studyDeploymentId.
override
removeStudyDeployments(Set<String> studyDeploymentIds) → Future<Set<String>>
Remove study deployments with the given studyDeploymentIds. This also removes all data related to the study deployments.
override
stop(String studyDeploymentId) → Future<StudyDeploymentStatus?>
Stops the study deployment with studyDeploymentId.
override
toString() → String
A string representation of this object.
override
unregisterDevice(String studyDeploymentId, String deviceRoleName) → Future<StudyDeploymentStatus?>
Unregister the device with the specified deviceRoleName for the study deployment with studyDeploymentId. Returns null if studyDeploymentId is not found.
override

Operators

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