Skip to content

SmartphoneDeploymentExecutor

Runs a SmartphoneDeployment: the root of the executor tree of a study.

Each SmartphoneStudyController owns one. On initialize it creates a TaskControlExecutor for each task control in the deployment and tells the target device's DeviceManager about it. You rarely use it directly; go through SmartphoneStudyController instead.

Key points:

See also Executor for the lifecycle.

Inheritance

Constructors

SmartphoneDeploymentExecutor

SmartphoneDeploymentExecutor()

Properties

probes

List<Probe> get probes

All probes in this deployment executor. May be empty.

samplingState

The runtime sampling state of this executor.

Methods

addMeasurements

void addMeasurements(
  1. Stream<Measurement> measurements
)

Adds measurements to the measurements of this deployment executor.

Used for executors outside the tree, e.g. app tasks restored by the AppTaskController.

clearSamplingStatus

void clearSamplingStatus()

Clears the state set with setSamplingState.

The next resume then resumes all task controls.

getDeviceManagerFromRoleName

DeviceManager<DeviceConfiguration<DeviceRegistration>, DeviceRegistration>? getDeviceManagerFromRoleName(
  1. String? roleName
)

Returns the DeviceManager of the device with roleName.

Works for both the primary device and connected devices. Returns null if no device with roleName is found.

lookupProbe

List<Probe> lookupProbe(
  1. String type
)

Returns all probes of data type. Returns an empty list if none are found.

onDispose

Future<void> onDispose()
override

Callback when this executor is disposed.

Subclasses should override this, to implement any cleanup to be done before disposing.

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.

onResume

Future<bool> onResume()
override

Resumes sampling based on the samplingState of the deployment.

If the prior samplingState is unknown (null), it simply resumes all executors. If the prior samplingState is known, it resumes or pauses the executors based on the state of each TaskControlExecutor in the samplingState.

Finally, the method enqueues all app tasks buffered in the AppTaskController.

setSamplingState

void setSamplingState(
  1. SmartphoneDeploymentExecutorSamplingState? samplingState
)

Sets the sampling state to restore on the next resume.

E.g. the state saved before the app was restarted. Does not change the current samplingState, which is always computed from the running executors.