Skip to content

BackgroundTaskExecutor

Runs a BackgroundTask by creating and running one Probe per measure.

Probes are created with SamplingPackageRegistry.create; measures with no probe on this phone are skipped with a warning. On resume, the devices of the probes are connected. If the task has a duration, the executor pauses itself after that duration. It also pauses when all its probes have paused.

Inheritance

Constructors

BackgroundTaskExecutor

BackgroundTaskExecutor()

Properties

haveAllProbesPaused

bool get haveAllProbesPaused

Are all probes in a paused state?

probes

List<Probe> get probes
override

The probes in this task executor. Empty for tasks without measures.

Methods

connectAllConnectableDevices

Future<void> connectAllConnectableDevices()

Starts connecting the devices of all probes.

Skips devices already connecting. Does not wait for the connections.

onInitialize

bool onInitialize()
override

Called by initialize. Returns true if successfully initialized.

If false, the executor stays in ExecutorState.Created. This is a synchronous method and must be light-weight.

onPause

Future<bool> onPause()
override

Called by pause. Returns true if successfully paused.

If false, the state is not changed.

onResume

Future<bool> onResume()
override

Called by resume. Returns true if successfully resumed.

If false, the executor moves to ExecutorState.PausedButShouldBeResumed.