addStudy method

  1. @override
Future<Study> addStudy(
  1. String studyDeploymentId,
  2. String deviceRoleName
)
override

Add a study which needs to be executed on this client. This involves registering this device for the specified study deployment.

  • studyDeploymentId - The ID of a study which has been deployed already and for which to collect data.
  • deviceRoleName - The role which the client device this runtime is intended for plays as part of the deployment identified by studyDeploymentId.

Returns the added study.

Implementation

@override
Future<Study> addStudy(
  String studyDeploymentId,
  String deviceRoleName,
) async {
  Study study = await super.addStudy(
    studyDeploymentId,
    deviceRoleName,
  );

  // Always create a new controller
  final controller =
      SmartphoneDeploymentController(deploymentService!, deviceController);
  repository[study] = controller;
  _group.add(controller.measurements);

  await controller.addStudy(
    study,
    registration!,
  );
  info('$runtimeType - Added study: $study');

  return study;
}