TaskControlExecutor class

Runs a TaskControl: starts or stops a task each time its trigger fires.

Created by the SmartphoneDeploymentExecutor. It gets its TriggerExecutor and TaskExecutor from the ExecutorFactory. On each trigger event, it adds a TriggeredTask measurement and resumes or pauses the task executor, depending on TaskControl.control.

Key points:

  • Runs in real time using timers, so tasks only trigger while the app runs, in the foreground or in a background process.
  • Resuming fails while the targetDevice is not connected. The DeviceManager of the target device resumes it once connected.
  • Every measurement it emits has Measurement.taskControl set.

See AppTaskControlExecutor for app tasks with schedulable triggers.

Inheritance
Implementers

Constructors

TaskControlExecutor(TaskControl taskControl, TriggerConfiguration trigger, TaskConfiguration task, DeviceConfiguration<DeviceRegistration> targetDevice)
Creates an executor for taskControl.

Properties

configuration → TaskControl?
The configuration of this executor as set in initialize.
no setterinherited
deployment → SmartphoneDeployment?
The deployment that this executor is part of executing.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
measurements → Stream<Measurement>
The stream of Measurement collected by this executor.
no setteroverride
probes → List<Probe>
The probes of the taskExecutor. Empty if there is none.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
samplingState → SamplingState
The runtime sampling state of this executor.
no setteroverride
state → ExecutorState
The runtime state of this executor.
no setterinherited
stateEvents → Stream<ExecutorState>
The runtime state changes of this executor.
no setterinherited
studyDeploymentId → String
no setter
targetDevice → DeviceConfiguration<DeviceRegistration>
no setter
targetDeviceManager → DeviceManager<DeviceConfiguration<DeviceRegistration>, DeviceRegistration>?
The DeviceManager of targetDevice, or null if none is available.
no setter
task → TaskConfiguration
no setter
taskControl → TaskControl
no setter
taskExecutor → TaskExecutor<TaskConfiguration>?
no setter
trigger → TriggerConfiguration
no setter
triggerExecutor → TriggerExecutor<TriggerConfiguration>?
no setter

Methods

addError(Object error, [StackTrace? stacktrace]) → void
Logs error as a warning and adds it to the measurements stream.
inherited
addMeasurement(Measurement measurement) → void
Adds measurement to the measurements stream.
inherited
dispose() → void
Disposes this executor.
inherited
error() → void
Moves this executor to ExecutorState.Undefined.
inherited
initialize(TaskControl configuration, [SmartphoneDeployment? deployment]) → void
Configures and initializes the executor. Call before resume.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose() → Future<void>
Callback when this executor is disposed.
override
onInitialize() → bool
Called by initialize. Returns true if successfully initialized.
override
onPause() → Future<bool>
Called by pause. Returns true if successfully paused.
override
onResume() → Future<bool>
Called by resume. Returns true if successfully resumed.
override
onTrigger() → void
Called when the triggerExecutor fires.
pause() → void
Pauses the executor until resume is called.
inherited
pauseButShouldBeResumed() → void
Pauses the executor and marks it to be resumed later.
inherited
resume() → void
Starts or resumes the executor.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited