StudyProtocol class
A description of how a study is to be executed, defining the type(s) of master device(s) (MasterDeviceDescriptor) responsible for aggregating data, the optional devices (DeviceDescriptor) connected to them, and the Triggers which lead to data collection on said devices.
- Annotations
-
- @JsonSerializable(fieldRename: FieldRename.none, includeIfNull: false)
Constructors
- StudyProtocol.new({required String ownerId, required String name, String description = ''})
-
Create a new protocol.
ownerId
andname
must be specified. -
StudyProtocol.fromJson(Map<
String, dynamic> json) -
factory
Properties
-
connectedDevices
↔ List<
DeviceDescriptor> -
The devices this device needs to connect to.
getter/setter pair
-
connections
↔ List<
DeviceConnection> -
getter/setter pair
- creationDate ↔ DateTime
-
The timestamp of the creation of this protocol in Zulu time.
getter/setter pair
- description ↔ String
-
The description for the study protocol.
getter/setter pair
-
expectedParticipantData
↔ List<
Map< ?String, dynamic> > -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- masterDevice → MasterDeviceDescriptor
-
The first of all the masterDevices. This is a convinient method used when
there is only one master device, which is most of the cases in Flutter where
the master device is typically the phone.
no setter
-
masterDevices
↔ List<
MasterDeviceDescriptor> -
The master devices involved in this protocol.
getter/setter pair
- name ↔ String
-
A unique descriptive name for the protocol.
getter/setter pair
- ownerId ↔ String
-
The owner id of this study protocol.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tasks
↔ Set<
TaskDescriptor> -
The set of tasks which can be triggered as part of this protocol.
getter/setter pair
-
triggeredTasks
↔ List<
TriggeredTask> -
The tasks (and the devices they are triggered to) for the specified
trigger
.getter/setter pair -
triggers
↔ Map<
String, Trigger> -
The set of Triggers which can trigger TaskDescriptors in this study protocol.
getter/setter pair
Methods
-
addConnectedDevice(
DeviceDescriptor device) → void -
Add a
device
which is connected to this masterDevice. Its role name should be unique in the protocol. -
addMasterDevice(
MasterDeviceDescriptor masterDevice) → void -
Add a
masterDevice
which is responsible for aggregating and synchronizing incoming data. Its role name should be unique in the protocol. -
addTask(
TaskDescriptor task) → void -
Add the
task
to this protocol. -
addTrigger(
Trigger trigger) → void -
Add the
trigger
to this protocol. -
addTriggeredTask(
Trigger trigger, TaskDescriptor task, DeviceDescriptor targetDevice) → void -
Add a
task
to be sent to atargetDevice
once atrigger
within this protocol is initiated. -
addTriggeredTasks(
Trigger trigger, List< TaskDescriptor> tasks, DeviceDescriptor targetDevice) → void -
Add a set of
tasks
to be sent to atargetDevice
once atrigger
within this protocol is initiated. In case thetrigger
ortasks
are not yet included in this study protocol, they will be added. ThetargetDevice
needs to be added prior to this call since it needs to be set up as either a master device or connected device. -
getTasksForDevice(
DeviceDescriptor device) → Set< TaskDescriptor?> -
Gets all the tasks triggered for the specified
device
. Thedevice
must be part of either masterDevices or connectedDevices. -
getTasksForDeviceRoleName(
String? deviceRoleName) → Set< TaskDescriptor> -
Gets all the tasks triggered for the specified
deviceRoleName
. -
getTriggeredTasks(
Trigger trigger) → Set< TriggeredTask> -
Gets all the tasks (and the devices they are triggered to) for the
specified
trigger
. -
hasMasterDevice(
String rolename) → bool -
Does this protocol have a master device with role name
rolename
? -
indexOfTrigger(
Trigger trigger) → int -
Returns the index of the
trigger
in the triggers. Returns-1
if not found. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeTask(
TaskDescriptor task) → void -
Remove the
task
currently present in this configuration including removing it from any Trigger's which initiate it. -
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- PROTOCOL_NAMESPACE → const String