getTasksForDeviceRoleName method

Set<TaskConfiguration> getTasksForDeviceRoleName(
  1. String deviceRoleName
)
inherited

Gets all the tasks triggered for the specified deviceRoleName.

Returns an empty set if the device is not part of primaryDevices or connectedDevices.

Implementation

Set<TaskConfiguration> getTasksForDeviceRoleName(String deviceRoleName) {
  final Set<TaskConfiguration> deviceTasks = {};

  for (var taskControl in taskControls) {
    if (taskControl.destinationDeviceRoleName == deviceRoleName) {
      if (_taskMap.containsKey(taskControl.taskName)) {
        deviceTasks.add(_taskMap[taskControl.taskName]!);
      }
    }
  }
  return deviceTasks;
}