SmartphoneStudyController constructor
SmartphoneStudyController(
- SmartphoneStudy study
Create a new SmartphoneStudyController to control the runtime behavior
of a study.
Implementation
SmartphoneStudyController(SmartphoneStudy study) : _study = study {
// Listen to study events and handle deployment updates
study.events.listen((event) {
switch (event.event) {
case StudyStatusEventTypes.DeploymentStatusReceived:
_deploymentStatusReceived();
break;
case StudyStatusEventTypes.DeviceDeploymentReceived:
_deviceDeploymentReceived();
break;
default:
break;
}
});
// Keep the sampling state updated - there is none until configured, e.g.
// a study restored as stopped is disposed without ever being configured.
executor.stateEvents.listen((state) {
if (executor.configuration != null) {
study.samplingState = executor.samplingState;
}
});
}