Skip to content

DeploymentReference

A reference to one primary device in a study deployment in CAWS.

Obtained from CarpDeploymentService.deployment. It remembers the study deployment ID, the device role name, and the latest status and deployment it fetched. Following the CARP Core deployment sub-system, a client calls, in order:

  • getStatus - get the study deployment status of this deployment.
  • registerDevice - register this device in this deployment.
  • get - get the deployment for this primary device.
  • deployed - report the deployment as deployed.
  • unRegisterDevice - unregister this device if no longer used.
final reference = CarpDeploymentService().deployment(studyDeploymentId);
await reference.registerDevice();
final deployment = await reference.get();
await reference.deployed();
Inheritance

Properties

deployment

PrimaryDeviceDeployment? get deployment

The deployment for this primary device, once fetched by get. Returns null if the deployment is not yet known.

deviceRoleName

String get deviceRoleName

The role name of the primary device in this deployment.

registeredDeviceId

String get registeredDeviceId

A unique id for this device.

Uses the phone's unique hardware id, if available. Otherwise uses a v4 UUID. Note that registerDevice does not use this value; it uses the device ID from DeviceInfoService directly.

rpcEndpointUri

String get rpcEndpointUri
override

The URL for the deployment endpoint.

{{PROTOCOL}}://{{SERVER_HOST}}:{{SERVER_PORT}}/api/deployment-service

status

StudyDeploymentStatus? get status

The latest known deployment status for this primary device fetched from CAWS. Returns null if status is not yet known.

studyDeploymentId

String get studyDeploymentId

The CARP study deployment ID.

Methods

deployed

Marks this deployment as deployed in CAWS.

Call get first; the deployment timestamp is sent to CAWS. Returns the updated study deployment status if successful. Throws a CarpServiceException if not.

get

Downloads the deployment for this primary device and stores it in deployment.

Fetches status first if it is not yet known. The PrimaryDeviceDeployment from CAWS is returned as a SmartphoneDeployment.

getStatus

Fetches the deployment status from CAWS and stores it in status.

registerDevice

Future<StudyDeploymentStatus> registerDevice([
  1. DeviceRegistration? registration
])

Registers this device as deviceRoleName with registration for this deployment in CAWS.

If registration is null, a DefaultDeviceRegistration is created from DeviceInfoService.

Returns the updated study deployment status if the registration is successful. Throws a CarpServiceException if not.

unRegisterDevice

Future<StudyDeploymentStatus> unRegisterDevice()

Unregisters deviceRoleName for this deployment in CAWS.

Returns the updated study deployment status if successful. Throws a CarpServiceException if not.