SmartphoneStudyController constructor

SmartphoneStudyController(
  1. 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.
  executor.stateEvents.listen(
    (state) => study.samplingState = executor.samplingState,
  );
}