TaskConfiguration
A named group of Measures that a device runs when a trigger fires.
A task is added to a protocol together with a TriggerConfiguration via StudyProtocol.addTaskControl, which creates a TaskControl. When the trigger fires, the client starts (or stops) all of the task's measures.
Key points:
- The name identifies the task and must be unique within a protocol. If not given, a name like 'Task #3' is generated.
- Duplicate measures (same type) are removed when the task is created.
- Subclasses define how the task runs, e.g. BackgroundTask. CARP Mobile Sensing adds
AppTaskfor tasks the user does in the app.
- Inheritance
-
- Object
- Serializable
- TaskConfiguration
- Implementers
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
TaskConfiguration.fromJson
TaskConfiguration
Create a task. The name uniquely identifies the task. If name is not specified, a name is generated.
Properties
description
A description of this task, emphasizing the reason why the data is collected.
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.
measures
The data which needs to be collected/measured passively as part of this task.
name
A name which uniquely identifies the task.
Methods
addMeasure
- Measure measure
Add measure to this task.
addMeasures
Add a list of measures to this task.
getAllExpectedDataTypes
Get data types of all data which may be collected, either passively as part of task measures, or as the result of user interactions, for this task.
Always includes CarpDataTypes.COMPLETED_TASK.
removeMeasure
- Measure measure
Remove measure from this task.
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.