getDeviceDeploymentFor method

  1. @override
Future<SmartphoneDeployment> getDeviceDeploymentFor(
  1. String studyDeploymentId,
  2. String primaryDeviceRoleName
)
override

Get the deployment configuration for the primary device with primaryDeviceRoleName in the study deployment with studyDeploymentId. Returns null if studyDeploymentId is not found.

Implementation

@override
Future<SmartphoneDeployment> getDeviceDeploymentFor(
  String studyDeploymentId,
  String primaryDeviceRoleName,
) async {
  // downloading a PrimaryDeviceDeployment
  var deployment = PrimaryDeviceDeployment.fromJson(await _rpc(
      GetDeviceDeploymentFor(studyDeploymentId, primaryDeviceRoleName)));
  debug('$runtimeType - got deployment: $deployment');

  // converting it to a SmartphoneDeployment
  return SmartphoneDeployment.fromPrimaryDeviceDeployment(
    studyId: CarpService().app.studyId,
    studyDeploymentId: studyDeploymentId,
    deployment: deployment,
  );
}