onResume method

  1. @override
Future<bool> onResume()
override

Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.

Implementation

@override
Future<bool> onResume() async {
  // listen for event of the specified type and resume/pause as needed
  _subscription = SmartPhoneClientManager()
      .lookupStudyRuntime(deployment!.studyDeploymentId,
          deployment!.deviceDescriptor.roleName)
      ?.dataByType(configuration!.measureType)
      .listen((dataPoint) {
    if (configuration!.resumeCondition != null &&
        configuration!.resumeCondition!(dataPoint)) super.onResume();
    if (configuration!.pauseCondition != null &&
        configuration!.pauseCondition!(dataPoint)) super.onPause();
  });
  return true;
}