stopStudy method
Permanently stop collecting data for the study with id studyDeploymentId
and mark it as stopped.
Once a study is stopped it cannot be deployed anymore since it will be marked as permanently stopped in the deployment service.
If you want to remove the study from this client and be able to redeploy it later, use the removeStudy method instead. Note that stopping a study does not remove it from this client manager.
Implementation
@override
@mustCallSuper
Future<StudyStatus> stopStudy(
String studyDeploymentId,
String deviceRoleName,
) async {
var study = getStudy(studyDeploymentId, deviceRoleName);
// fast out if not a valid study
if (study == null) {
throw Exception(
'$runtimeType - Cannot stop study - no study with deployment id '
'$studyDeploymentId and device role name $deviceRoleName found.',
);
}
info('$runtimeType - Stopping study: $study');
AppTaskController().removeStudy(study);
var controller = _controllers[study];
if (controller != null) _group.remove(controller.measurements);
controller?.dispose();
_controllers.remove(study);
var status = await super.stopStudy(studyDeploymentId, deviceRoleName);
notifyListeners();
return status;
}