getDeviceManagerFromRoleName method

DeviceManager<DeviceConfiguration<DeviceRegistration>>? getDeviceManagerFromRoleName(
  1. String? roleName
)

Get the DeviceManager based on the roleName. This includes both the primary device and the connected devices. Returns null if no device with roleName is found.

Implementation

DeviceManager? getDeviceManagerFromRoleName(String? roleName) {
  if (roleName == null) return null;

  var targetDevice = configuration?.getDeviceFromRoleName(roleName);
  return (targetDevice != null)
      ? DeviceController().getDevice(targetDevice.type)
      : null;
}