Skip to content

StudyDeploymentProxy

Performs the deployment steps for a Study against a DeploymentService.

Used by ClientManager (as ClientManager.proxy) to fetch the deployment status, register the device, get the PrimaryDeviceDeployment, and stop studies. Results are written to the Study. Most errors are not thrown; they are reported on the study as StudyStatusEventTypes.DeploymentError events.

Constructors

StudyDeploymentProxy

StudyDeploymentProxy(
  1. DeploymentService deploymentService
)

Properties

deploymentService

DeploymentService deploymentService
final

The service used for all deployment calls.

Methods

getStudyDeploymentStatus

Future<StudyDeploymentStatus?> getStudyDeploymentStatus(
  1. Study<PrimaryDeviceDeployment> study
)

Get the deployment status for the study from the deployment service. This updates the Study.deploymentStatus and sets the study Study.status accordingly.

Returns null if the deployment status could not be retrieved from the deployment service.

stop

Permanently stop this study.

Marks the study as stopped in the deployment service. Once stopped, a study cannot be restarted. Does nothing if already stopped; errors are printed, not thrown.

tryDeployment

Future<void> tryDeployment(
  1. Study<PrimaryDeviceDeployment> study,
  2. DeviceRegistration registration
)

Tries to deploy the study by registering the client device using registration and fetching the device deployment once it is available.

Steps:

  • Gets the deployment status. If it is already StudyDeploymentStatusTypes.Running, only fetches the device deployment (e.g., after an app reinstall) and returns.
  • Registers the device. A failure (e.g., already registered) is reported on the study, and the deployment is still fetched.
  • Fetches the PrimaryDeviceDeployment if it can be obtained, and checks that its role name matches the study.
  • Marks the device as deployed once no other devices need to be registered first.

Can be called again to refresh the deployment. Most errors are reported on the study as StudyStatusEventTypes.DeploymentError events, not thrown. A missing device role in the returned deployment status throws a StateError. A failure to mark the device as deployed is only printed.