Skip to content

SmartphoneDeployment

Everything a smartphone needs to run its part of a study deployment.

A deployment is the protocol made concrete for one primary device: its devices, tasks, triggers, and task controls, plus the CAMS fields from SmartphoneProtocolExtension (study description, data endpoint, privacy schema). It is created by the deployment service, e.g. SmartphoneDeploymentService or CAWS, and stored in SmartphoneStudy.deployment.

Key points:

  • deployed and status track the deployment on this phone.
  • measures lists all measures of all tasks.
  • Serializable, and can read deployments from CAMS 1.x.

See also SmartphoneDeploymentExecutor, which runs it.

Inheritance
Mixed-in types
Annotations

Constructors

SmartphoneDeployment.fromJson

SmartphoneDeployment.fromJson(
  1. Map<String, dynamic> json
)

SmartphoneDeployment.fromPrimaryDeviceDeployment

SmartphoneDeployment.fromPrimaryDeviceDeployment({
  1. String? studyId,
  2. String? studyDeploymentId,
  3. required PrimaryDeviceDeployment deployment,
})

Creates a SmartphoneDeployment from a carp_core PrimaryDeviceDeployment.

Reads the CAMS fields from the application data of deployment if it was made from a CAMS protocol. Used when a deployment is downloaded from CAWS.

SmartphoneDeployment.fromPrimaryDeviceDeploymentAndSmartphoneStudyProtocol

SmartphoneDeployment.fromPrimaryDeviceDeploymentAndSmartphoneStudyProtocol({
  1. String? studyId,
  2. String? studyDeploymentId,
  3. required PrimaryDeviceDeployment deployment,
  4. required SmartphoneStudyProtocol protocol,
})

Creates a SmartphoneDeployment that combines a PrimaryDeviceDeployment and a SmartphoneStudyProtocol.

It takes the deployment information from the deployment (such as device configuration, device registration, and what devices are connected) and takes the data collection configuration from the protocol (such as task, triggers, task controls, and expected participant data).

SmartphoneDeployment.fromSmartphoneStudyProtocol

SmartphoneDeployment.fromSmartphoneStudyProtocol({
  1. String? studyId,
  2. String? studyDeploymentId,
  3. required String primaryDeviceRoleName,
  4. required SmartphoneStudyProtocol protocol,
})

Creates a SmartphoneDeployment based on a SmartphoneStudyProtocol.

Maps the protocol 1:1 to the deployment, using a Smartphone with primaryDeviceRoleName as the primary device and a DefaultDeviceRegistration.

SmartphoneDeployment

SmartphoneDeployment({
  1. String? studyId,
  2. String? studyDeploymentId,
  3. required PrimaryDeviceConfiguration<DeviceRegistration> deviceConfiguration,
  4. required DeviceRegistration registration,
  5. Set<DeviceConfiguration<DeviceRegistration>> connectedDevices = const {},
  6. Map<String, DeviceRegistration?> connectedDeviceRegistrations = const {},
  7. Set<TaskConfiguration> tasks = const {},
  8. Map<String, TriggerConfiguration> triggers = const {},
  9. Set<TaskControl> taskControls = const {},
  10. Set<ExpectedParticipantData> expectedParticipantData = const {},
  11. StudyDescription? studyDescription,
  12. DataEndPoint? dataEndPoint,
  13. String? privacySchemaName,
})

Creates a new SmartphoneDeployment.

studyDeploymentId is a unique id for this deployment. If not specified, a unique id is generated.

Properties

deployed

  1. @JsonKey(fromJson: _deployedFromJson)
DateTime deployed
getter/setter pair

The timestamp (in UTC) when this deployment was deployed on this smartphone.

deviceRoleName

String get deviceRoleName

The role name of this smartphone device.

devices

All devices this deployment is using.

This set combines the primary deviceConfiguration with all connectedDevices.

measures

List<Measure> get measures

All measures of all tasks in this deployment.

status

  1. @JsonKey(fromJson: _statusFromJson)
StudyDeploymentStatusTypes status
getter/setter pair

The status of this study deployment. Default is StudyDeploymentStatusTypes.Invited.

studyDeploymentId

String get studyDeploymentId

The unique id of this study deployment.

studyId

String? studyId
getter/setter pair

The unique id of the study that this deployment is part of.

null if this is a local deployment running only on this phone.

Methods

getDeviceFromRoleName

DeviceConfiguration<DeviceRegistration>? getDeviceFromRoleName(
  1. String roleName
)

The primary or connected device with roleName, or null if not found.

toJson

Map<String, dynamic> toJson()
override

toString

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.