TaskControl
Links a trigger to a task: when the trigger fires, start or stop the task.
Once the condition of the trigger with triggerId applies, the task with taskName on destinationDeviceRoleName is started or stopped (as specified by control). Task controls are created by StudyProtocol.addTaskControl; you rarely create one yourself.
The JSON holds the trigger id, task name, target device role name, control and hasBeenScheduledUntil; task and targetDevice are runtime references that are not part of the JSON.
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
TaskControl.fromJson
TaskControl
- required int triggerId,
- TaskConfiguration? task,
- DeviceConfiguration<
DeviceRegistration> ? targetDevice, - Control control = Control.Start,
Create a TaskControl.
taskName and destinationDeviceRoleName are taken from task and targetDevice when given. control defaults to Control.Start.
Properties
control
What to do with a task once the condition of a trigger is met.
destinationDeviceRoleName
The role name of the device to which to send the task with taskName when the trigger condition is met.
hasBeenScheduledUntil
The time the task have been scheduled until. Mainly used when scheduling a series of tasks for this trigger.
targetDevice
- @JsonKey(includeFromJson: false, includeToJson: false)
The device to send the task to. Not serialized; may be null after deserialization.
task
- @JsonKey(includeFromJson: false, includeToJson: false)
The task to control. Not serialized; may be null after deserialization.
taskName
The name of the task to send to destinationDeviceRoleName when the trigger condition is met.
triggerId
The id of the TriggerConfiguration; its key in StudyProtocol.triggers.
Methods
toJson
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.