restart method

  1. @nonVirtual
void restart()

Restarts sampling of the measures using this device.

Resumes, after 15 seconds, only the executors in ExecutorState.PausedButShouldBeResumed, i.e. those paused by a temporary disconnection (isDisconnecting) and not by stop. Called automatically when status becomes DeviceStatus.reconnected.

Implementation

@nonVirtual
void restart() {
  info('$runtimeType - Restarting sampling...');

  for (var executor in executors) {
    debug('$runtimeType - Restarting executor: $executor, state: ${executor.state}');
    if (executor.state == ExecutorState.PausedButShouldBeResumed) {
      // resume data sampling with a delay to give the device some time to fully reconnect
      Future.delayed(const Duration(seconds: 15), () => executor.resume());
    }
  }
}