/// <summary> /// Initializes a new instance of the <see cref="SoIPDeviceProvider"/> class. /// </summary> /// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception> public SoIPDeviceProvider() { if (_instance != null) { throw new InvalidOperationException($"There can be only one instance of type {nameof(SoIPDeviceProvider)}"); } _instance = this; UpdateTrigger = new DeviceUpdateTrigger(); }
/// <summary> /// Initializes a new instance of the <see cref="CorsairDeviceProvider"/> class. /// </summary> /// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception> public CorsairDeviceProvider() { if (_instance != null) { throw new InvalidOperationException($"There can be only one instance of type {nameof(CorsairDeviceProvider)}"); } _instance = this; UpdateTrigger = new DeviceUpdateTrigger(); _updateQueue = new CorsairUpdateQueue(UpdateTrigger); }
/// <summary> /// Initializes a new instance of the <see cref="LogitechDeviceProvider"/> class. /// </summary> /// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception> public LogitechDeviceProvider() { if (_instance != null) { throw new InvalidOperationException($"There can be only one instance of type {nameof(LogitechDeviceProvider)}"); } _instance = this; UpdateTrigger = new DeviceUpdateTrigger(); _perDeviceUpdateQueue = new LogitechPerDeviceUpdateQueue(UpdateTrigger); _perKeyUpdateQueue = new LogitechPerKeyUpdateQueue(UpdateTrigger); }
/// <inheritdoc /> public IEnumerable <IRGBDevice> CreateDevices() { DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger(); BitwizardWS2812USBUpdateQueue queue = new BitwizardWS2812USBUpdateQueue(updateTrigger, Port, BaudRate); string name = Name ?? $"Bitwizard WS2812 USB ({Port})"; BitwizardWS2812USBDevice device = new BitwizardWS2812USBDevice(new BitwizardWS2812USBDeviceInfo(name), queue); device.Initialize(StripLength); yield return(device); updateTrigger.Start(); }
/// <inheritdoc /> public IEnumerable <IRGBDevice> CreateDevices() { DeviceUpdateTrigger updateTrigger = new DeviceUpdateTrigger(); ArduinoWS2812USBUpdateQueue queue = new ArduinoWS2812USBUpdateQueue(updateTrigger, Port, BaudRate); IEnumerable <(int channel, int ledCount)> channels = queue.GetChannels(); int counter = 0; foreach ((int channel, int ledCount) in channels) { string name = string.Format(Name ?? $"Arduino WS2812 USB ({Port}) [{{0}}]", ++counter); ArduinoWS2812USBDevice device = new ArduinoWS2812USBDevice(new ArduinoWS2812USBDeviceInfo(name), queue, channel); device.Initialize(ledCount); yield return(device); } updateTrigger.Start(); }