addStudy method
Add a study which needs to be executed on this client. This involves registering this device for the specified study deployment.
A Study
specifies:
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 bystudyDeploymentId
.
Returns the added study.
Implementation
@override
Future<SmartphoneStudy> addStudy(Study study) async {
assert(
study is SmartphoneStudy,
'Trying to add a study which is not a SmartphoneStudy to a SmartphoneStudyClientManager.',
);
await super.addStudy(study);
// Always create a new controller
final controller =
SmartphoneDeploymentController(deploymentService!, deviceController);
repository[study.studyDeploymentId] = controller;
_group.add(controller.measurements);
await controller.addStudy(
study,
registration!,
);
info('$runtimeType - Added study: $study');
return study as SmartphoneStudy;
}