TriggerConfiguration
A condition on a device that starts or stops tasks when it applies.
The condition can be time-bound, based on data streams, initiated by a user of the platform, or a combination of these. A trigger is paired with a TaskConfiguration via StudyProtocol.addTaskControl, which creates a TaskControl.
Key points:
- sourceDeviceRoleName is the device that evaluates the trigger. If not set, the protocol fills it in when the trigger is added.
- Triggers are stored in StudyProtocol.triggers by id ('0', '1', ...), in the order they are added.
- CARP Core defines ElapsedTimeTrigger, ManualTrigger and ScheduledTrigger. CARP Mobile Sensing adds many more (e.g.
ImmediateTrigger,PeriodicTrigger), each run by a trigger executor.
- Inheritance
-
- Object
- Serializable
- TriggerConfiguration
- Implementers
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
TriggerConfiguration.fromJson
TriggerConfiguration
Create a trigger.
Properties
fromJsonFunction
The function which can convert a JSON string to an object of this type.
jsonType
Return the __type to be used for JSON serialization of this class. Default is runtimeType. Only specify this if you need another type.
requiresPrimaryDevice
- @JsonKey(includeFromJson: false, includeToJson: false)
Determines whether the trigger needs to be evaluated on a primary device (PrimaryDeviceConfiguration). For example, this is the case when the trigger is time bound and needs to be evaluated by a task scheduler running on a primary device. Not serialized.
sourceDeviceRoleName
The device role name from which the trigger originates.
Methods
toJson
Return a JSON encoding of this object.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.