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 {
  _subscription = SmartPhoneClientManager()
      .lookupStudyRuntime(deployment!.studyDeploymentId,
          deployment!.deviceDescriptor.roleName)
      ?.dataByType(configuration!.measureType)
      .listen((dataPoint) {
    if ((configuration!.resumeCondition != null) &&
        (dataPoint.carpBody as Datum)
            .equivalentTo(configuration!.resumeCondition)) super.onResume();
    if (configuration!.pauseCondition != null &&
        (dataPoint.carpBody as Datum)
            .equivalentTo(configuration!.pauseCondition)) super.onPause();
  });
  return true;
}