onResume method

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

Called by resume. Returns true if successfully resumed.

If false, the executor moves to ExecutorState.PausedButShouldBeResumed.

Implementation

@override
Future<bool> onResume() async {
  if (triggerExecutor == null) {
    warning('$runtimeType - No TriggerExecutor found - call initialize() before resume this task control executor.');
    return false;
  }

  if (!(targetDeviceManager?.isConnected ?? false)) {
    warning(
      '$runtimeType - Device for task control ${taskControl.taskName} is not connected. '
      'Cannot resume sampling for this task control.',
    );
    return false;
  }

  if (triggerExecutor?.state != ExecutorState.Resumed && !triggerExecutor!._isResuming) {
    triggerExecutor?.resume();
  }
  return true;
}