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 {
  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;
}