stop method
Stop sampling the measures using this device.
This entails that all task control executors using this device are paused, and hence all data collection for the measures using this device is stopped. This method is e.g. used when the device is disconnected.
If shouldBeResumed is true, the executors are paused but marked to be
resumed later when the device is reconnected.
This is useful when the device is temporarily disconnected, e.g., due to
a temporary loss of Bluetooth connection, and we want to automatically resume
sampling when the device is reconnected.
Implementation
@nonVirtual
void stop({bool shouldBeResumed = false}) {
debug(
'$runtimeType - Stopping sampling - shouldResumeLater: $shouldBeResumed ...',
);
for (var executor in executors) {
executor.state == ExecutorState.Resumed && shouldBeResumed
? executor.pauseButShouldBeResumed()
: executor.pause();
}
}