getDeviceManagerFromRoleName method

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

Returns the DeviceManager of the device with roleName.

Works for both the primary device and 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().getDeviceManager(targetDevice.type) : null;
}