start method

  1. @override
Future<void> start([
  1. bool start = true
])
override

Start this controller.

If start is true, immediately start data collection according to the parameters specified in configure.

configure must be called before starting sampling.

Implementation

@override
Future<void> start([bool start = true]) async {
  info(
      '$runtimeType - Starting data sampling for study deployment: ${deployment?.studyDeploymentId}');

  // ask for permissions for all measures in this deployment
  if (SmartPhoneClientManager().askForPermissions) {
    await askForAllPermissions();
  }

  // if this study has not yet been deployed, do this first.
  if (status.index < StudyStatus.Deployed.index) {
    await tryDeployment();
    await configure();
    super.start();
    if (start) _executor.start();
  }
  super.start();
  if (start) _executor.start();
}