getConnectedDevices method

List<DeviceConfiguration<DeviceRegistration>> getConnectedDevices(
  1. PrimaryDeviceConfiguration<DeviceRegistration> primaryDevice
)
inherited

Gets all devices configured to be connected to primaryDevice.

Implementation

List<DeviceConfiguration> getConnectedDevices(
  PrimaryDeviceConfiguration primaryDevice,
) {
  final List<DeviceConfiguration> devices = [];
  connections?.forEach((connection) {
    if (connection.roleName == primaryDevice.roleName) {
      var connectedDevice = connectedDevices?.firstWhere(
          (device) => device.roleName == connection.connectedToRoleName);
      if (connectedDevice != null) devices.add(connectedDevice);
    }
  });
  return devices;
}