Probe class abstract
Collects data for one Measure.
The data comes from a sensor, a connected device or a service. A probe is the leaf of the executor tree. Each measure in a task gets its own probe, created by the measure type's SamplingPackage through SamplingPackageRegistry.create. Write a probe when you add a new measure type to a sampling package; most extend one of the specialized probes below.
Key points:
- Lifecycle: see Executor. Subclasses implement onInitialize, onResume and onPause; the default ones do nothing.
- Emits
Measurements with addMeasurement; errors with addError. - Its samplingConfiguration is looked up in the measure, the deployment and the sampling packages, in that order.
- permissions come from the CamsDataTypeMetaData of the measure type. The SmartphoneStudyController asks for them up front; probes only check them with hasRequiredPermissions.
Specialized probes: MeasurementProbe (one measurement), IntervalProbe (polling), StreamProbe (continuous stream), PeriodicStreamProbe, BufferingPeriodicProbe, BufferingIntervalStreamProbe and BufferingPeriodicStreamProbe.
- Inheritance
-
- Object
- AbstractExecutor<
Measure> - Probe
- Implementers
Constructors
- Probe()
Properties
- configuration → Measure?
-
The configuration of this executor as set in initialize.
no setterinherited
- deployment → SmartphoneDeployment?
-
The deployment that this executor is part of executing.
no setterinherited
-
deviceManager
↔ DeviceManager<
DeviceConfiguration< DeviceRegistration> , DeviceRegistration> -
The device manager of the device this probe collects data from.
getter/setter pair
- enabled ↔ bool
-
Whether this probe is enabled.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- measure → Measure?
-
The
Measurethat configures this probe.no setter -
measurements
→ Stream<
Measurement> -
The stream of
Measurementcollected by this executor.no setterinherited -
permissions
→ List<
Permission> -
The permissions this probe needs. Empty if none.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- samplingConfiguration → SamplingConfiguration?
-
The sampling configuration for this probe.
no setter
- samplingState → SamplingState
-
The runtime sampling state of this executor.
no setterinherited
- state → ExecutorState
-
The runtime state of this executor.
no setterinherited
-
stateEvents
→ Stream<
ExecutorState> -
The runtime state changes of this executor.
no setterinherited
- type → String?
-
The data type this probe collects, e.g.
dk.cachet.carp.steps.no setter
Methods
-
addError(
Object error, [StackTrace? stacktrace]) → void -
Logs
erroras a warning and adds it to the measurements stream.inherited -
addMeasurement(
Measurement measurement) → void -
Adds
measurementto measurements.override -
arePermissionsGranted(
) → Future< bool> - Whether all permissions are granted. Returns false if checking fails.
-
dispose(
) → void -
Disposes this executor.
inherited
-
error(
) → void -
Moves this executor to ExecutorState.Undefined.
inherited
-
hasRequiredPermissions(
) → Future< bool> - Whether this probe is allowed to run.
-
initialize(
Measure 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.
inherited
-
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
-
pause(
) → void -
Pauses the executor until resume is called.
inherited
-
pauseButShouldBeResumed(
) → void -
Pauses the executor and marks it to be resumed later.
inherited
-
requestPermissions(
) → Future< bool> - Asks the user for any permissions not yet granted.
-
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