From 180b0e45383007920e7a883a746916dc972b73eb Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Fri, 10 Feb 2023 19:23:34 +0100 Subject: [PATCH] Updated corsair SDK to iCUE SDK v4.0.48 --- RGB.NET.Core/Leds/LedMapping.cs | 6 + .../Cooler/CorsairCoolerRGBDevice.cs | 34 + .../Cooler/CorsairCoolerRGBDeviceInfo.cs | 28 + .../CorsairDeviceProvider.cs | 271 ++- .../Custom/CorsairCustomRGBDevice.cs | 74 - .../Custom/CorsairCustomRGBDeviceInfo.cs | 155 -- .../Enum/CorsairAccessLevel.cs | 30 + .../Enum/CorsairAccessMode.cs | 14 - .../Enum/CorsairChannelDeviceType.cs | 18 +- .../Enum/CorsairDataType.cs | 47 + .../Enum/CorsairDeviceCaps.cs | 28 - .../Enum/CorsairDevicePropertyId.cs | 77 + .../Enum/CorsairDeviceType.cs | 90 +- RGB.NET.Devices.Corsair/Enum/CorsairError.cs | 37 +- .../Enum/CorsairLedGroup.cs | 82 + RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs | 1742 ----------------- .../Enum/CorsairLedIdKeyboard.cs | 142 ++ .../Enum/CorsairLogicalKeyboardLayout.cs | 4 +- .../Enum/CorsairPhysicalKeyboardLayout.cs | 28 +- .../Enum/CorsairPhysicalMouseLayout.cs | 107 - .../Enum/CorsairPropertyFlag.cs | 30 + .../Enum/CorsairSessionState.cs | 45 + .../Fan/CorsairFanRGBDevice.cs | 34 + .../Fan/CorsairFanRGBDeviceInfo.cs | 28 + .../Generic/CorsairDeviceUpdateQueue.cs | 46 +- .../Generic/CorsairLedId.cs | 54 + .../Generic/CorsairProtocolDetails.cs | 65 - .../Generic/CorsairRGBDevice.cs | 41 +- .../Generic/CorsairRGBDeviceInfo.cs | 36 +- .../Generic/LedMappings.cs | 472 ++--- .../CorsairGraphicsCardRGBDevice.cs | 9 +- .../CorsairGraphicsCardRGBDeviceInfo.cs | 9 +- .../Headset/CorsairHeadsetRGBDevice.cs | 9 +- .../Headset/CorsairHeadsetRGBDeviceInfo.cs | 9 +- .../CorsairHeadsetStandRGBDevice.cs | 9 +- .../CorsairHeadsetStandRGBDeviceInfo.cs | 9 +- .../Helper/NativeExtensions.cs | 26 +- .../Keyboard/CorsairKeyboardRGBDevice.cs | 9 +- .../Keyboard/CorsairKeyboardRGBDeviceInfo.cs | 9 +- .../LedStrip/CorsairLedStripGBDevice.cs | 34 + .../LedStrip/CorsairLedStripRGBDeviceInfo.cs | 28 + .../Mainboard/CorsairMainboardRGBDevice.cs | 9 +- .../CorsairMainboardRGBDeviceInfo.cs | 9 +- .../Memory/CorsairMemoryRGBDevice.cs | 9 +- .../Memory/CorsairMemoryRGBDeviceInfo.cs | 14 +- .../Mouse/CorsairMouseRGBDevice.cs | 9 +- .../Mouse/CorsairMouseRGBDeviceInfo.cs | 22 +- .../Mousepad/CorsairMousepadRGBDevice.cs | 9 +- .../Mousepad/CorsairMousepadRGBDeviceInfo.cs | 9 +- RGB.NET.Devices.Corsair/Native/_CUESDK.cs | 381 ++-- .../Native/_CorsairChannelInfo.cs | 33 - .../Native/_CorsairDataValue.cs | 140 ++ ...hannelsInfo.cs => _CorsairDeviceFilter.cs} | 30 +- .../Native/_CorsairDeviceInfo.cs | 39 +- .../Native/_CorsairLedColor.cs | 48 +- .../Native/_CorsairLedPosition.cs | 30 +- .../Native/_CorsairLedPositions.cs | 26 - ...annelDeviceInfo.cs => _CorsairProperty.cs} | 23 +- .../Native/_CorsairProtocolDetails.cs | 43 - .../Native/_CorsairSessionDetails.cs | 32 + .../Native/_CorsairSessionStateChanged.cs | 27 + .../Native/_CorsairVersion.cs | 31 + RGB.NET.Devices.Corsair/README.md | 6 +- ...RGB.NET.Devices.Corsair.csproj.DotSettings | 5 + .../Touchbar/CorsairTouchbarRGBDevice.cs | 11 +- .../Touchbar/CorsairTouchbarRGBDeviceInfo.cs | 9 +- .../Unknown/CorsairUnknownRGBDevice.cs | 34 + .../Unknown/CorsairUnknownRGBDeviceInfo.cs | 23 + 68 files changed, 2001 insertions(+), 3085 deletions(-) create mode 100644 RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs create mode 100644 RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs delete mode 100644 RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs delete mode 100644 RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairAccessLevel.cs delete mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairAccessMode.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairDataType.cs delete mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairDeviceCaps.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairDevicePropertyId.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs delete mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairLedIdKeyboard.cs delete mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairPhysicalMouseLayout.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairPropertyFlag.cs create mode 100644 RGB.NET.Devices.Corsair/Enum/CorsairSessionState.cs create mode 100644 RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs create mode 100644 RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs create mode 100644 RGB.NET.Devices.Corsair/Generic/CorsairLedId.cs delete mode 100644 RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs create mode 100644 RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs create mode 100644 RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs delete mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairChannelInfo.cs create mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairDataValue.cs rename RGB.NET.Devices.Corsair/Native/{_CorsairChannelsInfo.cs => _CorsairDeviceFilter.cs} (50%) delete mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairLedPositions.cs rename RGB.NET.Devices.Corsair/Native/{_CorsairChannelDeviceInfo.cs => _CorsairProperty.cs} (60%) delete mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairProtocolDetails.cs create mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs create mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs create mode 100644 RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs create mode 100644 RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs create mode 100644 RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs diff --git a/RGB.NET.Core/Leds/LedMapping.cs b/RGB.NET.Core/Leds/LedMapping.cs index e2866d3..05a10ec 100644 --- a/RGB.NET.Core/Leds/LedMapping.cs +++ b/RGB.NET.Core/Leds/LedMapping.cs @@ -11,6 +11,12 @@ namespace RGB.NET.Core; public class LedMapping : IEnumerable<(LedId ledId, T mapping)> where T : notnull { + #region Constants + + public static LedMapping Empty { get; } = new(); + + #endregion + #region Properties & Fields private readonly Dictionary _mapping = new(); diff --git a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs new file mode 100644 index 0000000..fd5b89b --- /dev/null +++ b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDevice.cs @@ -0,0 +1,34 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using System.Collections.Generic; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a corsair cooler. +/// +public class CorsairCoolerRGBDevice : CorsairRGBDevice, ICooler +{ + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by CUE for the cooler. + /// The queue used to update this device. + internal CorsairCoolerRGBDevice(CorsairCoolerRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) + : base(info, updateQueue) + { } + + #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateCoolerMapping(ids); + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs new file mode 100644 index 0000000..958f129 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Cooler/CorsairCoolerRGBDeviceInfo.cs @@ -0,0 +1,28 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using RGB.NET.Devices.Corsair.Native; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a generic information for a . +/// +public class CorsairCoolerRGBDeviceInfo : CorsairRGBDeviceInfo +{ + #region Constructors + + /// + internal CorsairCoolerRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Cooler, nativeInfo, ledCount, ledOffset) + { } + + /// + internal CorsairCoolerRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset, string modelName) + : base(RGBDeviceType.Cooler, nativeInfo, ledCount, ledOffset, modelName) + { } + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs index 7acd75e..7a1abe0 100644 --- a/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs +++ b/RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs @@ -3,8 +3,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; +using System.Threading; using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; @@ -28,23 +27,23 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider /// Gets a modifiable list of paths used to find the native SDK-dlls for x86 applications. /// The first match will be used. /// - public static List PossibleX86NativePaths { get; } = new() { "x86/CUESDK.dll", "x86/CUESDK_2019.dll", "x86/CUESDK_2017.dll", "x86/CUESDK_2015.dll", "x86/CUESDK_2013.dll" }; + public static List PossibleX86NativePaths { get; } = new() { "x86/iCUESDK.dll", "x86/CUESDK_2019.dll" }; /// /// Gets a modifiable list of paths used to find the native SDK-dlls for x64 applications. /// The first match will be used. /// - public static List PossibleX64NativePaths { get; } = new() { "x64/CUESDK.dll", "x64/CUESDK.x64_2019.dll", "x64/CUESDK.x64_2017.dll", "x64/CUESDK_2019.dll", "x64/CUESDK_2017.dll", "x64/CUESDK_2015.dll", "x64/CUESDK_2013.dll" }; + public static List PossibleX64NativePaths { get; } = new() { "x64/iCUESDK.dll", "x64/iCUESDK.x64_2019.dll", "x64/CUESDK.dll", "x64/CUESDK.x64_2019.dll" }; /// - /// Gets the protocol details for the current SDK-connection. + /// Gets or sets the timeout used when connecting to the SDK. /// - public CorsairProtocolDetails? ProtocolDetails { get; private set; } + public static TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromMilliseconds(500); /// - /// Gets the last error documented by CUE. + /// Gets or sets a bool indicating if exclusive request should be requested through the iCUE-SDK. /// - public static CorsairError LastError => _CUESDK.CorsairGetLastError(); + public static bool ExclusiveAccess { get; set; } = false; #endregion @@ -64,25 +63,35 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider #region Methods - /// protected override void InitializeSDK() { _CUESDK.Reload(); - ProtocolDetails = new CorsairProtocolDetails(_CUESDK.CorsairPerformProtocolHandshake()); + using ManualResetEventSlim waitEvent = new(false); - CorsairError error = LastError; - if (error != CorsairError.Success) - Throw(new CUEException(error), true); + void OnSessionStateChanged(object? sender, CorsairSessionState state) + { + if (state == CorsairSessionState.Connected) + // ReSharper disable once AccessToDisposedClosure + waitEvent.Set(); + } - if (ProtocolDetails.BreakingChanges) - Throw(new RGBDeviceException("The SDK currently used isn't compatible with the installed version of CUE.\r\n" - + $"CUE-Version: {ProtocolDetails.ServerVersion} (Protocol {ProtocolDetails.ServerProtocolVersion})\r\n" - + $"SDK-Version: {ProtocolDetails.SdkVersion} (Protocol {ProtocolDetails.SdkProtocolVersion})"), true); + try + { + _CUESDK.SessionStateChanged += OnSessionStateChanged; - // DarthAffe 02.02.2021: 127 is iCUE - if (!_CUESDK.CorsairSetLayerPriority(128)) - Throw(new CUEException(LastError)); + CorsairError errorCode = _CUESDK.CorsairConnect(); + + if (errorCode != CorsairError.Success) + Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (ErrorCode: {errorCode})")); + + if (!waitEvent.Wait(ConnectionTimeout)) + Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (Timeout - Current connection state: {_CUESDK.SesionState})")); + } + finally + { + _CUESDK.SessionStateChanged -= OnSessionStateChanged; + } } /// @@ -97,116 +106,174 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider private IEnumerable LoadCorsairDevices() { - int deviceCount = _CUESDK.CorsairGetDeviceCount(); - for (int i = 0; i < deviceCount; i++) + CorsairError error = _CUESDK.CorsairGetDevices(new _CorsairDeviceFilter(CorsairDeviceType.All), out _CorsairDeviceInfo[] devices); + if (error != CorsairError.Success) + Throw(new RGBDeviceException($"Failed to load devices. (ErrorCode: {error})")); + + foreach (_CorsairDeviceInfo device in devices) { - _CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo))!; - if (!((CorsairDeviceCaps)nativeDeviceInfo.capsMask).HasFlag(CorsairDeviceCaps.Lighting)) - continue; // Everything that doesn't support lighting control is useless + if (string.IsNullOrWhiteSpace(device.id)) continue; - CorsairDeviceUpdateQueue updateQueue = new(GetUpdateTrigger(), i); - switch (nativeDeviceInfo.type) + error = _CUESDK.CorsairRequestControl(device.id, ExclusiveAccess ? CorsairAccessLevel.ExclusiveLightingControl : CorsairAccessLevel.Shared); + if (error != CorsairError.Success) + Throw(new RGBDeviceException($"Failed to take control of device '{device.id}'. (ErrorCode: {error})")); + + CorsairDeviceUpdateQueue updateQueue = new(GetUpdateTrigger(), device); + + Console.WriteLine("Loading " + device.model); + int channelLedCount = 0; + for (int i = 0; i < device.channelCount; i++) { - case CorsairDeviceType.Keyboard: - yield return new CorsairKeyboardRGBDevice(new CorsairKeyboardRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + Console.WriteLine($"Channel {i}/{device.channelCount}"); + channelLedCount += _CUESDK.ReadDevicePropertySimpleInt32(device.id!, CorsairDevicePropertyId.ChannelLedCount, (uint)i); + } - case CorsairDeviceType.Mouse: - yield return new CorsairMouseRGBDevice(new CorsairMouseRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + int deviceLedCount = device.ledCount - channelLedCount; + if (deviceLedCount > 0) + switch (device.type) + { + case CorsairDeviceType.Keyboard: + yield return new CorsairKeyboardRGBDevice(new CorsairKeyboardRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.Headset: - yield return new CorsairHeadsetRGBDevice(new CorsairHeadsetRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.Mouse: + yield return new CorsairMouseRGBDevice(new CorsairMouseRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.Mousepad: - yield return new CorsairMousepadRGBDevice(new CorsairMousepadRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.Headset: + yield return new CorsairHeadsetRGBDevice(new CorsairHeadsetRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.HeadsetStand: - yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.Mousemat: + yield return new CorsairMousepadRGBDevice(new CorsairMousepadRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.MemoryModule: - yield return new CorsairMemoryRGBDevice(new CorsairMemoryRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.HeadsetStand: + yield return new CorsairHeadsetStandRGBDevice(new CorsairHeadsetStandRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.Mainboard: - yield return new CorsairMainboardRGBDevice(new CorsairMainboardRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.MemoryModule: + yield return new CorsairMemoryRGBDevice(new CorsairMemoryRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.GraphicsCard: - yield return new CorsairGraphicsCardRGBDevice(new CorsairGraphicsCardRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.Motherboard: + yield return new CorsairMainboardRGBDevice(new CorsairMainboardRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.Touchbar: - yield return new CorsairTouchbarRGBDevice(new CorsairTouchbarRGBDeviceInfo(i, nativeDeviceInfo), updateQueue); - break; + case CorsairDeviceType.GraphicsCard: + yield return new CorsairGraphicsCardRGBDevice(new CorsairGraphicsCardRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - case CorsairDeviceType.Cooler: - case CorsairDeviceType.CommanderPro: - case CorsairDeviceType.LightningNodePro: - List<_CorsairChannelInfo> channels = GetChannels(nativeDeviceInfo).ToList(); - int channelsLedCount = channels.Sum(x => x.totalLedsCount); - int deviceLedCount = nativeDeviceInfo.ledsCount - channelsLedCount; + case CorsairDeviceType.Touchbar: + yield return new CorsairTouchbarRGBDevice(new CorsairTouchbarRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - if (deviceLedCount > 0) - yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(i, nativeDeviceInfo, deviceLedCount), updateQueue); + case CorsairDeviceType.Cooler: + yield return new CorsairCoolerRGBDevice(new CorsairCoolerRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; - int ledOffset = deviceLedCount; - foreach (_CorsairChannelInfo channelInfo in channels) + case CorsairDeviceType.FanLedController: + case CorsairDeviceType.LedController: + case CorsairDeviceType.Unknown: + yield return new CorsairUnknownRGBDevice(new CorsairUnknownRGBDeviceInfo(device, deviceLedCount, 0), updateQueue); + break; + + default: + Throw(new RGBDeviceException("Unknown Device-Type")); + break; + } + + int offset = deviceLedCount; + for (int i = 0; i < device.channelCount; i++) + { + int deviceCount = _CUESDK.ReadDevicePropertySimpleInt32(device.id!, CorsairDevicePropertyId.ChannelDeviceCount, (uint)i); + if (deviceCount <= 0) continue; // DarthAffe 10.02.2023: There seem to be an issue in the SDK where it reports empty channels and fails when getting ledCounts and device types from them + + int[] ledCounts = _CUESDK.ReadDevicePropertySimpleInt32Array(device.id!, CorsairDevicePropertyId.ChannelDeviceLedCountArray, (uint)i); + int[] deviceTypes = _CUESDK.ReadDevicePropertySimpleInt32Array(device.id!, CorsairDevicePropertyId.ChannelDeviceTypeArray, (uint)i); + + for (int j = 0; j < deviceCount; j++) + { + CorsairChannelDeviceType deviceType = (CorsairChannelDeviceType)deviceTypes[j]; + int ledCount = ledCounts[j]; + + switch (deviceType) { - int channelDeviceInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelDeviceInfo)); - IntPtr channelDeviceInfoPtr = channelInfo.devices; - for (int device = 0; (device < channelInfo.devicesCount) && (ledOffset < nativeDeviceInfo.ledsCount); device++) - { - _CorsairChannelDeviceInfo channelDeviceInfo = (_CorsairChannelDeviceInfo)Marshal.PtrToStructure(channelDeviceInfoPtr, typeof(_CorsairChannelDeviceInfo))!; + case CorsairChannelDeviceType.FanHD: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "HD Fan"), updateQueue); + break; - yield return new CorsairCustomRGBDevice(new CorsairCustomRGBDeviceInfo(i, nativeDeviceInfo, channelDeviceInfo, ledOffset), updateQueue); + case CorsairChannelDeviceType.FanSP: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "SP Fan"), updateQueue); + break; - ledOffset += channelDeviceInfo.deviceLedCount; - channelDeviceInfoPtr = new IntPtr(channelDeviceInfoPtr.ToInt64() + channelDeviceInfoStructSize); - } + case CorsairChannelDeviceType.FanLL: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "LL Fan"), updateQueue); + break; + + case CorsairChannelDeviceType.FanML: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "ML Fan"), updateQueue); + break; + + case CorsairChannelDeviceType.FanQL: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "QL Fan"), updateQueue); + break; + + case CorsairChannelDeviceType.EightLedSeriesFan: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "8-Led-Series Fan Fan"), updateQueue); + break; + + case CorsairChannelDeviceType.DAP: + yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "DAP Fan"), updateQueue); + break; + + case CorsairChannelDeviceType.Pump: + yield return new CorsairCoolerRGBDevice(new CorsairCoolerRGBDeviceInfo(device, ledCount, offset, "Pump"), updateQueue); + break; + + case CorsairChannelDeviceType.WaterBlock: + yield return new CorsairCoolerRGBDevice(new CorsairCoolerRGBDeviceInfo(device, ledCount, offset, "Water Block"), updateQueue); + break; + + case CorsairChannelDeviceType.Strip: + string modelName = "LED Strip"; + + // LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single + if ((device.model == "LS100 Starter Kit") && (ledCount == 138)) + modelName = "LS100 LED Strip (dual monitor)"; + else if ((device.model == "LS100 Starter Kit") && (ledCount == 84)) + modelName = "LS100 LED Strip (single monitor)"; + // Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long + else if ((device.model == "LS100 Starter Kit") && (ledCount == 15)) + modelName = "LS100 LED Strip (short)"; + else if ((device.model == "LS100 Starter Kit") && (ledCount == 27)) + modelName = "LS100 LED Strip (long)"; + + yield return new CorsairLedStripRGBDevice(new CorsairLedStripRGBDeviceInfo(device, ledCount, offset, modelName), updateQueue); + break; + + case CorsairChannelDeviceType.DRAM: + yield return new CorsairMemoryRGBDevice(new CorsairMemoryRGBDeviceInfo(device, ledCount, offset, "DRAM"), updateQueue); + break; + + default: + Throw(new RGBDeviceException("Unknown Device-Type")); + break; } - break; - default: - Throw(new RGBDeviceException("Unknown Device-Type")); - break; + offset += ledCount; + } } } } - private static IEnumerable<_CorsairChannelInfo> GetChannels(_CorsairDeviceInfo deviceInfo) - { - _CorsairChannelsInfo? channelsInfo = deviceInfo.channels; - if (channelsInfo == null) yield break; - - IntPtr channelInfoPtr = channelsInfo.channels; - for (int channel = 0; channel < channelsInfo.channelsCount; channel++) - { - yield return (_CorsairChannelInfo)Marshal.PtrToStructure(channelInfoPtr, typeof(_CorsairChannelInfo))!; - - int channelInfoStructSize = Marshal.SizeOf(typeof(_CorsairChannelInfo)); - channelInfoPtr = new IntPtr(channelInfoPtr.ToInt64() + channelInfoStructSize); - } - } - - /// - protected override void Reset() - { - ProtocolDetails = null; - - base.Reset(); - } - /// public override void Dispose() { base.Dispose(); - try { _CUESDK.UnloadCUESDK(); } - catch { /* at least we tried */ } + try { _CUESDK.CorsairDisconnect(); } catch { /* at least we tried */ } + try { _CUESDK.UnloadCUESDK(); } catch { /* at least we tried */ } GC.SuppressFinalize(this); } diff --git a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs deleted file mode 100644 index 1bc3b6e..0000000 --- a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDevice.cs +++ /dev/null @@ -1,74 +0,0 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; -using System.Runtime.InteropServices; -using RGB.NET.Core; -using RGB.NET.Devices.Corsair.Native; - -namespace RGB.NET.Devices.Corsair; - -/// -/// -/// Represents a corsair custom. -/// -public class CorsairCustomRGBDevice : CorsairRGBDevice, IUnknownDevice -{ - #region Constructors - - /// - /// - /// Initializes a new instance of the class. - /// - /// The specific information provided by CUE for the custom-device. - /// The queue used to update this device. - internal CorsairCustomRGBDevice(CorsairCustomRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, new LedMapping(), updateQueue) - { } - - #endregion - - #region Methods - - /// - protected override void InitializeLayout() - { - Mapping.Clear(); - - _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); - if (nativeLedPositions == null) return; - - int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); - IntPtr ptr = new(nativeLedPositions.pLedPosition.ToInt64() + (structSize * DeviceInfo.LedOffset)); - - LedId referenceLedId = GetReferenceLed(DeviceInfo.DeviceType); - for (int i = 0; i < DeviceInfo.LedCount; i++) - { - LedId ledId = referenceLedId + i; - _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); - if (ledPosition == null) - { - ptr = new IntPtr(ptr.ToInt64() + structSize); - continue; - } - - Mapping.Add(ledId, ledPosition.LedId); - - Rectangle rectangle = ledPosition.ToRectangle(); - AddLed(ledId, rectangle.Location, rectangle.Size); - - ptr = new IntPtr(ptr.ToInt64() + structSize); - } - } - - private static LedId GetReferenceLed(RGBDeviceType deviceType) - => deviceType switch - { - RGBDeviceType.LedStripe => LedId.LedStripe1, - RGBDeviceType.Fan => LedId.Fan1, - RGBDeviceType.Cooler => LedId.Cooler1, - _ => LedId.Custom1 - }; - - #endregion -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs deleted file mode 100644 index 5d0858a..0000000 --- a/RGB.NET.Devices.Corsair/Custom/CorsairCustomRGBDeviceInfo.cs +++ /dev/null @@ -1,155 +0,0 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Global - -using System; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using RGB.NET.Core; -using RGB.NET.Devices.Corsair.Native; - -namespace RGB.NET.Devices.Corsair; - -/// -/// -/// Represents a generic information for a . -/// -public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo -{ - #region Properties & Fields - - /// - /// Gets the amount of LEDs this device contains. - /// - public int LedCount { get; } - - /// - /// Gets the offset used to access the LEDs of this device. - /// - internal int LedOffset { get; } - - #endregion - - #region Constructors - - /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - /// The native representing this device. - /// The offset used to find the LEDs of this device. - internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, int ledOffset) - : base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo, - GetModelName(nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase), channelDeviceInfo)) - { - this.LedOffset = ledOffset; - - LedCount = channelDeviceInfo.deviceLedCount; - } - - internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, int ledCount) - : base(deviceIndex, GetDeviceType(nativeInfo.type), nativeInfo) - { - this.LedCount = ledCount; - - LedOffset = 0; - } - - #endregion - - #region Methods - - private static RGBDeviceType GetDeviceType(CorsairChannelDeviceType deviceType) - => deviceType switch - { - CorsairChannelDeviceType.Invalid => RGBDeviceType.Unknown, - CorsairChannelDeviceType.FanHD => RGBDeviceType.Fan, - CorsairChannelDeviceType.FanSP => RGBDeviceType.Fan, - CorsairChannelDeviceType.FanLL => RGBDeviceType.Fan, - CorsairChannelDeviceType.FanML => RGBDeviceType.Fan, - CorsairChannelDeviceType.DAP => RGBDeviceType.Fan, - CorsairChannelDeviceType.FanQL => RGBDeviceType.Fan, - CorsairChannelDeviceType.EightLedSeriesFan => RGBDeviceType.Fan, - CorsairChannelDeviceType.Strip => RGBDeviceType.LedStripe, - CorsairChannelDeviceType.Pump => RGBDeviceType.Cooler, - CorsairChannelDeviceType.WaterBlock => RGBDeviceType.Cooler, - _ => throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null) - }; - - private static RGBDeviceType GetDeviceType(CorsairDeviceType deviceType) - => deviceType switch - { - CorsairDeviceType.Unknown => RGBDeviceType.Unknown, - CorsairDeviceType.Mouse => RGBDeviceType.Mouse, - CorsairDeviceType.Keyboard => RGBDeviceType.Keyboard, - CorsairDeviceType.Headset => RGBDeviceType.Headset, - CorsairDeviceType.Mousepad => RGBDeviceType.Mousepad, - CorsairDeviceType.HeadsetStand => RGBDeviceType.HeadsetStand, - CorsairDeviceType.CommanderPro => RGBDeviceType.LedController, - CorsairDeviceType.LightningNodePro => RGBDeviceType.LedController, - CorsairDeviceType.MemoryModule => RGBDeviceType.DRAM, - CorsairDeviceType.Cooler => RGBDeviceType.Cooler, - CorsairDeviceType.Mainboard => RGBDeviceType.Mainboard, - CorsairDeviceType.GraphicsCard => RGBDeviceType.GraphicsCard, - _ => throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null) - }; - - private static string GetModelName(string model, _CorsairChannelDeviceInfo channelDeviceInfo) - { - switch (channelDeviceInfo.type) - { - case CorsairChannelDeviceType.Invalid: - return model; - - case CorsairChannelDeviceType.FanHD: - return "HD Fan"; - - case CorsairChannelDeviceType.FanSP: - return "SP Fan"; - - case CorsairChannelDeviceType.FanLL: - return "LL Fan"; - - case CorsairChannelDeviceType.FanML: - return "ML Fan"; - - case CorsairChannelDeviceType.FanQL: - return "QL Fan"; - - case CorsairChannelDeviceType.EightLedSeriesFan: - return "8-Led-Series Fan Fan"; - - case CorsairChannelDeviceType.Strip: - // LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single - if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138)) - return "LS100 LED Strip (dual monitor)"; - else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84)) - return "LS100 LED Strip (single monitor)"; - // Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long - else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15)) - return "LS100 LED Strip (short)"; - else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27)) - return "LS100 LED Strip (long)"; - // Device model is "Commander Pro" for regular LED strips - else - return "LED Strip"; - - case CorsairChannelDeviceType.DAP: - return "DAP Fan"; - - case CorsairChannelDeviceType.WaterBlock: - return "Water Block"; - - case CorsairChannelDeviceType.Pump: - return "Pump"; - - default: -#pragma warning disable CA2208 // Instantiate argument exceptions correctly - throw new ArgumentOutOfRangeException($"{nameof(channelDeviceInfo)}.{nameof(channelDeviceInfo.type)}", channelDeviceInfo.type, null); -#pragma warning restore CA2208 // Instantiate argument exceptions correctly - } - } - - #endregion -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairAccessLevel.cs b/RGB.NET.Devices.Corsair/Enum/CorsairAccessLevel.cs new file mode 100644 index 0000000..33a87e0 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairAccessLevel.cs @@ -0,0 +1,30 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global + +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: Represents an SDK access level. +/// +public enum CorsairAccessLevel +{ + /// + /// iCUE-SDK: shared mode (default) + /// + Shared = 0, + + /// + /// iCUE-SDK: exclusive lightings, but shared events + /// + ExclusiveLightingControl = 1, + + /// + /// iCUE-SDK: exclusive key events, but shared lightings + /// + ExclusiveKeyEventsListening = 2, + + /// + /// iCUE-SDK: exclusive mode + /// + ExclusiveLightingControlAndKeyEventsListening = 3 +}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairAccessMode.cs b/RGB.NET.Devices.Corsair/Enum/CorsairAccessMode.cs deleted file mode 100644 index 1ecdda4..0000000 --- a/RGB.NET.Devices.Corsair/Enum/CorsairAccessMode.cs +++ /dev/null @@ -1,14 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global - -#pragma warning disable 1591 // Missing XML comment for publicly visible type or member - -namespace RGB.NET.Devices.Corsair; - -/// -/// Represents an SDK access mode. -/// -public enum CorsairAccessMode -{ - ExclusiveLightingControl = 0 -}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs b/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs index 8c89470..65a38fa 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs @@ -1,13 +1,10 @@ // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Global - -#pragma warning disable 1591 // Missing XML comment for publicly visible type or member - namespace RGB.NET.Devices.Corsair; /// -/// Contains a list of available corsair channel device types. +/// iCUE-SDK: Contains a list of available corsair channel device types. /// public enum CorsairChannelDeviceType { @@ -16,10 +13,11 @@ public enum CorsairChannelDeviceType FanSP = 2, FanLL = 3, FanML = 4, - Strip = 5, - DAP = 6, - Pump = 7, - FanQL = 8, - WaterBlock = 9, - EightLedSeriesFan = 10 // Previously called FanSPPRO + FanQL = 5, + EightLedSeriesFan = 6, + Strip = 7, + DAP = 8, + Pump = 9, + DRAM = 10, + WaterBlock = 11, }; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairDataType.cs b/RGB.NET.Devices.Corsair/Enum/CorsairDataType.cs new file mode 100644 index 0000000..e9bf894 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairDataType.cs @@ -0,0 +1,47 @@ +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains list of available property types +/// +public enum CorsairDataType +{ + /// + /// iCUE-SDK: for property of type Boolean + /// + Boolean = 0, + + /// + /// iCUE-SDK: for property of type Int32 or Enumeration + /// + Int32 = 1, + + /// + /// iCUE-SDK: for property of type Float64 + /// + Float64 = 2, + + /// + /// iCUE-SDK: for property of type String + /// + String = 3, + + /// + /// iCUE-SDK: for array of Boolean + /// + BooleanArray = 16, + + /// + /// iCUE-SDK: for array of Int32 + /// + Int32Array = 17, + + /// + /// iCUE-SDK: for array of Float64 + /// + Float64Array = 18, + + /// + /// iCUE-SDK: for array of String + /// + StringArray = 19 +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceCaps.cs b/RGB.NET.Devices.Corsair/Enum/CorsairDeviceCaps.cs deleted file mode 100644 index c92807b..0000000 --- a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceCaps.cs +++ /dev/null @@ -1,28 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global - -using System; - -namespace RGB.NET.Devices.Corsair; - -/// -/// Contains a list of corsair device capabilities. -/// -[Flags] -public enum CorsairDeviceCaps -{ - /// - /// For devices that do not support any SDK functions. - /// - None = 0, - - /// - /// For devices that has controlled lighting. - /// - Lighting = 1, - - /// - /// For devices that provide current state through set of properties. - /// - PropertyLookup = 2 -}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairDevicePropertyId.cs b/RGB.NET.Devices.Corsair/Enum/CorsairDevicePropertyId.cs new file mode 100644 index 0000000..0646355 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairDevicePropertyId.cs @@ -0,0 +1,77 @@ +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains list of properties identifiers which can be read from device +/// +public enum CorsairDevicePropertyId +{ + /// + /// iCUE-SDK: dummy value + /// + Invalid = 0, + + /// + /// iCUE-SDK: array of CorsairDevicePropertyId members supported by device + /// + PropertyArray = 1, + + /// + /// iCUE-SDK: indicates Mic state (On or Off); used for headset, headset stand + /// + MicEnabled = 2, + + /// + /// iCUE-SDK: indicates Surround Sound state (On or Off); used for headset, headset stand + /// + SurroundSoundEnabled = 3, + + /// + /// iCUE-SDK: indicates Sidetone state (On or Off); used for headset (where applicable) + /// + SidetoneEnabled = 4, + + /// + /// iCUE-SDK: the number of active equalizer preset (integer, 1 - 5); used for headset, headset stand + /// + EqualizerPreset = 5, + + /// + /// iCUE-SDK: keyboard physical layout (see CorsairPhysicalLayout for valid values); used for keyboard + /// + PhysicalLayout = 6, + + /// + /// iCUE-SDK: keyboard logical layout (see CorsairLogicalLayout for valid values); used for keyboard + /// + LogicalLayout = 7, + + /// + /// iCUE-SDK: array of programmable G, M or S keys on device + /// + MacroKeyArray = 8, + + /// + /// iCUE-SDK: battery level (0 - 100); used for wireless devices + /// + BatteryLevel = 9, + + /// + /// iCUE-SDK: total number of LEDs connected to the channel + /// + ChannelLedCount = 10, + + /// + /// iCUE-SDK: number of LED-devices (fans, strips, etc.) connected to the channel which is controlled by the DIY device + /// + ChannelDeviceCount = 11, + + /// + /// iCUE-SDK: array of integers, each element describes the number of LEDs controlled by the channel device + /// + ChannelDeviceLedCountArray = 12, + + /// + /// iCUE-SDK: array of CorsairChannelDeviceType members, each element describes the type of the channel device + /// + ChannelDeviceTypeArray = 13 +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs b/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs index a409c5d..b41be14 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs @@ -1,27 +1,83 @@ // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Global - -#pragma warning disable 1591 // Missing XML comment for publicly visible type or member +using System; namespace RGB.NET.Devices.Corsair; /// -/// Contains a list of available corsair device types. +/// iCUE-SDK: Contains a list of available corsair device types. /// -public enum CorsairDeviceType +[Flags] +public enum CorsairDeviceType : uint { - Unknown = 0, - Mouse = 1, - Keyboard = 2, - Headset = 3, - Mousepad = 4, - HeadsetStand = 5, - CommanderPro = 6, - LightningNodePro = 7, - MemoryModule = 8, - Cooler = 9, - Mainboard = 10, - GraphicsCard = 11, - Touchbar = 12 + /// + /// iCUE-SDK: for unknown/invalid devices + /// + Unknown = 0x0000, + + /// + /// iCUE-SDK: for keyboards + /// + Keyboard = 0x0001, + + /// + /// iCUE-SDK: for mice + /// + Mouse = 0x0002, + + /// + /// iCUE-SDK: for mousemats + /// + Mousemat = 0x0004, + + /// + /// iCUE-SDK: for headsets + /// + Headset = 0x0008, + + /// + /// iCUE-SDK: for headset stands + /// + HeadsetStand = 0x0010, + + /// + /// iCUE-SDK: for DIY-devices like Commander PRO + /// + FanLedController = 0x0020, + + /// + /// iCUE-SDK: for DIY-devices like Lighting Node PRO + /// + LedController = 0x0040, + + /// + /// iCUE-SDK: for memory modules + /// + MemoryModule = 0x0080, + + /// + /// iCUE-SDK: for coolers + /// + Cooler = 0x0100, + + /// + /// iCUE-SDK: for motherboards + /// + Motherboard = 0x0200, + + /// + /// iCUE-SDK: for graphics cards + /// + GraphicsCard = 0x0400, + + /// + /// iCUE-SDK: for touchbars + /// + Touchbar = 0x0800, + + /// + /// iCUE-SDK: for all devices + /// + All = 0xFFFFFFFF }; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairError.cs b/RGB.NET.Devices.Corsair/Enum/CorsairError.cs index 977c2cf..d2fb672 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairError.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairError.cs @@ -4,38 +4,47 @@ namespace RGB.NET.Devices.Corsair; /// -/// Shared list of all errors which could happen during calling of Corsair* functions. +/// iCUE-SDK: Shared list of all errors which could happen during calling of Corsair* functions. /// public enum CorsairError { /// - /// If previously called function completed successfully. + /// iCUE-SDK: if previously called function completed successfully /// - Success, + Success = 0, /// - /// CUE is not running or was shut down or third-party control is disabled in CUE settings. (runtime error) + /// iCUE-SDK: if iCUE is not running or was shut down or third-party control is disabled in iCUE settings (runtime error), or if developer did not call CorsairConnect after calling CorsairDisconnect or on app start (developer error) /// - ServerNotFound, + NotConnected = 1, /// - /// If some other client has or took over exclusive control. (runtime error) + /// iCUE-SDK: if some other client has or took over exclusive control (runtime error) /// - NoControl, + NoControl = 2, /// - /// If developer did not perform protocol handshake. (developer error) + /// iCUE-SDK: if developer is calling the function that is not supported by the server (either because protocol has broken by server or client or because the function is new and server is too old. Check CorsairSessionDetails for details) (developer error) /// - ProtocolHandshakeMissing, + IncompatibleProtocol = 3, /// - /// If developer is calling the function that is not supported by the server (either because protocol has broken by server or client or because the function is new and server is too old. - /// Check CorsairProtocolDetails for details). (developer error) + /// iCUE-SDK: if developer supplied invalid arguments to the function (for specifics look at function descriptions) (developer error) /// - IncompatibleProtocol, + InvalidArguments = 4, /// - /// If developer supplied invalid arguments to the function (for specifics look at function descriptions). (developer error) + /// iCUE-SDK: if developer is calling the function that is not allowed due to current state (reading improper properties from device, or setting callback when it has already been set) (developer error) /// - InvalidArguments + InvalidOperation = 5, + + /// + /// iCUE-SDK: if invalid device id has been supplied as an argument to the function (when device id refers to disconnected device) (runtime error) + /// + DeviceNotFound = 6, + + /// + /// iCUE-SDK: if specific functionality (key interception) is disabled in iCUE settings (runtime error) + /// + NotAllowed = 7 }; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs new file mode 100644 index 0000000..7281323 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs @@ -0,0 +1,82 @@ +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains a list of led groups. Led group is used as a part of led identifier +/// +public enum CorsairLedGroup +{ + /// + /// iCUE-SDK: for keyboard leds + /// + Keyboard = 0, + + /// + /// iCUE-SDK: for keyboard leds on G keys + /// + KeyboardGKeys = 1, + + /// + /// iCUE-SDK: for keyboard lighting pipe leds + /// + KeyboardEdge = 2, + + /// + /// iCUE-SDK: for vendor specific keyboard leds (ProfileSwitch, DialRing, etc.) + /// + KeyboardOem = 3, + + /// + /// iCUE-SDK: for mouse leds + /// + Mouse = 4, + + /// + /// iCUE-SDK: for mousemat leds + /// + Mousemat = 5, + + /// + /// iCUE-SDK: for headset leds + /// + Headset = 6, + + /// + /// iCUE-SDK: for headset stand leds + /// + HeadsetStand = 7, + + /// + /// iCUE-SDK: for memory module leds + /// + MemoryModule = 8, + + /// + /// iCUE-SDK: for motherboard leds + /// + Motherboard = 9, + + /// + /// iCUE-SDK: for graphics card leds + /// + GraphicsCard = 10, + + /// + /// iCUE-SDK: for leds on the first channel of DIY devices and coolers + /// + DIY_Channel1 = 11, + + /// + /// iCUE-SDK: for leds on the second channel of DIY devices and coolers + /// + DIY_Channel2 = 12, + + /// + /// iCUE-SDK: for leds on the third channel of DIY devices and coolers + /// + DIY_Channel3 = 13, + + /// + /// iCUE-SDK: for touchbar leds + /// + Touchbar = 14 +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs deleted file mode 100644 index a0cfeab..0000000 --- a/RGB.NET.Devices.Corsair/Enum/CorsairLedId.cs +++ /dev/null @@ -1,1742 +0,0 @@ -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global -#pragma warning disable 1591 - -namespace RGB.NET.Devices.Corsair; - -/// -/// Contains a list of all LEDs available for all corsair devices. -/// -public enum CorsairLedId -{ - Invalid = 0, - Escape = 1, - F1 = 2, - F2 = 3, - F3 = 4, - F4 = 5, - F5 = 6, - F6 = 7, - F7 = 8, - F8 = 9, - F9 = 10, - F10 = 11, - F11 = 12, - GraveAccentAndTilde = 13, - D1 = 14, - D2 = 15, - D3 = 16, - D4 = 17, - D5 = 18, - D6 = 19, - D7 = 20, - D8 = 21, - D9 = 22, - D0 = 23, - MinusAndUnderscore = 24, - Tab = 25, - Q = 26, - W = 27, - E = 28, - R = 29, - T = 30, - Y = 31, - U = 32, - I = 33, - O = 34, - P = 35, - BracketLeft = 36, - CapsLock = 37, - A = 38, - S = 39, - D = 40, - F = 41, - G = 42, - H = 43, - J = 44, - K = 45, - L = 46, - SemicolonAndColon = 47, - ApostropheAndDoubleQuote = 48, - LeftShift = 49, - NonUsBackslash = 50, - Z = 51, - X = 52, - C = 53, - V = 54, - B = 55, - N = 56, - M = 57, - CommaAndLessThan = 58, - PeriodAndBiggerThan = 59, - SlashAndQuestionMark = 60, - LeftCtrl = 61, - LeftGui = 62, - LeftAlt = 63, - Lang2 = 64, - Space = 65, - Lang1 = 66, - International2 = 67, - RightAlt = 68, - RightGui = 69, - Application = 70, - LedProgramming = 71, - Brightness = 72, - F12 = 73, - PrintScreen = 74, - ScrollLock = 75, - PauseBreak = 76, - Insert = 77, - Home = 78, - PageUp = 79, - BracketRight = 80, - Backslash = 81, - NonUsTilde = 82, - Enter = 83, - International1 = 84, - EqualsAndPlus = 85, - International3 = 86, - Backspace = 87, - Delete = 88, - End = 89, - PageDown = 90, - RightShift = 91, - RightCtrl = 92, - UpArrow = 93, - LeftArrow = 94, - DownArrow = 95, - RightArrow = 96, - WinLock = 97, - Mute = 98, - Stop = 99, - ScanPreviousTrack = 100, - PlayPause = 101, - ScanNextTrack = 102, - NumLock = 103, - KeypadSlash = 104, - KeypadAsterisk = 105, - KeypadMinus = 106, - KeypadPlus = 107, - KeypadEnter = 108, - Keypad7 = 109, - Keypad8 = 110, - Keypad9 = 111, - KeypadComma = 112, - Keypad4 = 113, - Keypad5 = 114, - Keypad6 = 115, - Keypad1 = 116, - Keypad2 = 117, - Keypad3 = 118, - Keypad0 = 119, - KeypadPeriodAndDelete = 120, - G1 = 121, - G2 = 122, - G3 = 123, - G4 = 124, - G5 = 125, - G6 = 126, - G7 = 127, - G8 = 128, - G9 = 129, - G10 = 130, - VolumeUp = 131, - VolumeDown = 132, - MR = 133, - M1 = 134, - M2 = 135, - M3 = 136, - G11 = 137, - G12 = 138, - G13 = 139, - G14 = 140, - G15 = 141, - G16 = 142, - G17 = 143, - G18 = 144, - International5 = 145, - International4 = 146, - Fn = 147, - - B1 = 148, - B2 = 149, - B3 = 150, - B4 = 151, - - LeftLogo = 152, - RightLogo = 153, - - Logo = 154, - - Zone1 = 155, - Zone2 = 156, - Zone3 = 157, - Zone4 = 158, - Zone5 = 159, - Zone6 = 160, - Zone7 = 161, - Zone8 = 162, - Zone9 = 163, - Zone10 = 164, - Zone11 = 165, - Zone12 = 166, - Zone13 = 167, - Zone14 = 168, - Zone15 = 169, - - Lightbar1 = 170, - Lightbar2 = 171, - Lightbar3 = 172, - Lightbar4 = 173, - Lightbar5 = 174, - Lightbar6 = 175, - Lightbar7 = 176, - Lightbar8 = 177, - Lightbar9 = 178, - Lightbar10 = 179, - Lightbar11 = 180, - Lightbar12 = 181, - Lightbar13 = 182, - Lightbar14 = 183, - Lightbar15 = 184, - Lightbar16 = 185, - Lightbar17 = 186, - Lightbar18 = 187, - Lightbar19 = 188, - - B5 = 189, - B6 = 190, - - HeadsetStandZone1 = 191, - HeadsetStandZone2 = 192, - HeadsetStandZone3 = 193, - HeadsetStandZone4 = 194, - HeadsetStandZone5 = 195, - HeadsetStandZone6 = 196, - HeadsetStandZone7 = 197, - HeadsetStandZone8 = 198, - HeadsetStandZone9 = 199, - - CustomDeviceChannel1Led1 = 200, - CustomDeviceChannel1Led2 = 201, - CustomDeviceChannel1Led3 = 202, - CustomDeviceChannel1Led4 = 203, - CustomDeviceChannel1Led5 = 204, - CustomDeviceChannel1Led6 = 205, - CustomDeviceChannel1Led7 = 206, - CustomDeviceChannel1Led8 = 207, - CustomDeviceChannel1Led9 = 208, - CustomDeviceChannel1Led10 = 209, - CustomDeviceChannel1Led11 = 210, - CustomDeviceChannel1Led12 = 211, - CustomDeviceChannel1Led13 = 212, - CustomDeviceChannel1Led14 = 213, - CustomDeviceChannel1Led15 = 214, - CustomDeviceChannel1Led16 = 215, - CustomDeviceChannel1Led17 = 216, - CustomDeviceChannel1Led18 = 217, - CustomDeviceChannel1Led19 = 218, - CustomDeviceChannel1Led20 = 219, - CustomDeviceChannel1Led21 = 220, - CustomDeviceChannel1Led22 = 221, - CustomDeviceChannel1Led23 = 222, - CustomDeviceChannel1Led24 = 223, - CustomDeviceChannel1Led25 = 224, - CustomDeviceChannel1Led26 = 225, - CustomDeviceChannel1Led27 = 226, - CustomDeviceChannel1Led28 = 227, - CustomDeviceChannel1Led29 = 228, - CustomDeviceChannel1Led30 = 229, - CustomDeviceChannel1Led31 = 230, - CustomDeviceChannel1Led32 = 231, - CustomDeviceChannel1Led33 = 232, - CustomDeviceChannel1Led34 = 233, - CustomDeviceChannel1Led35 = 234, - CustomDeviceChannel1Led36 = 235, - CustomDeviceChannel1Led37 = 236, - CustomDeviceChannel1Led38 = 237, - CustomDeviceChannel1Led39 = 238, - CustomDeviceChannel1Led40 = 239, - CustomDeviceChannel1Led41 = 240, - CustomDeviceChannel1Led42 = 241, - CustomDeviceChannel1Led43 = 242, - CustomDeviceChannel1Led44 = 243, - CustomDeviceChannel1Led45 = 244, - CustomDeviceChannel1Led46 = 245, - CustomDeviceChannel1Led47 = 246, - CustomDeviceChannel1Led48 = 247, - CustomDeviceChannel1Led49 = 248, - CustomDeviceChannel1Led50 = 249, - CustomDeviceChannel1Led51 = 250, - CustomDeviceChannel1Led52 = 251, - CustomDeviceChannel1Led53 = 252, - CustomDeviceChannel1Led54 = 253, - CustomDeviceChannel1Led55 = 254, - CustomDeviceChannel1Led56 = 255, - CustomDeviceChannel1Led57 = 256, - CustomDeviceChannel1Led58 = 257, - CustomDeviceChannel1Led59 = 258, - CustomDeviceChannel1Led60 = 259, - CustomDeviceChannel1Led61 = 260, - CustomDeviceChannel1Led62 = 261, - CustomDeviceChannel1Led63 = 262, - CustomDeviceChannel1Led64 = 263, - CustomDeviceChannel1Led65 = 264, - CustomDeviceChannel1Led66 = 265, - CustomDeviceChannel1Led67 = 266, - CustomDeviceChannel1Led68 = 267, - CustomDeviceChannel1Led69 = 268, - CustomDeviceChannel1Led70 = 269, - CustomDeviceChannel1Led71 = 270, - CustomDeviceChannel1Led72 = 271, - CustomDeviceChannel1Led73 = 272, - CustomDeviceChannel1Led74 = 273, - CustomDeviceChannel1Led75 = 274, - CustomDeviceChannel1Led76 = 275, - CustomDeviceChannel1Led77 = 276, - CustomDeviceChannel1Led78 = 277, - CustomDeviceChannel1Led79 = 278, - CustomDeviceChannel1Led80 = 279, - CustomDeviceChannel1Led81 = 280, - CustomDeviceChannel1Led82 = 281, - CustomDeviceChannel1Led83 = 282, - CustomDeviceChannel1Led84 = 283, - CustomDeviceChannel1Led85 = 284, - CustomDeviceChannel1Led86 = 285, - CustomDeviceChannel1Led87 = 286, - CustomDeviceChannel1Led88 = 287, - CustomDeviceChannel1Led89 = 288, - CustomDeviceChannel1Led90 = 289, - CustomDeviceChannel1Led91 = 290, - CustomDeviceChannel1Led92 = 291, - CustomDeviceChannel1Led93 = 292, - CustomDeviceChannel1Led94 = 293, - CustomDeviceChannel1Led95 = 294, - CustomDeviceChannel1Led96 = 295, - CustomDeviceChannel1Led97 = 296, - CustomDeviceChannel1Led98 = 297, - CustomDeviceChannel1Led99 = 298, - CustomDeviceChannel1Led100 = 299, - CustomDeviceChannel1Led101 = 300, - CustomDeviceChannel1Led102 = 301, - CustomDeviceChannel1Led103 = 302, - CustomDeviceChannel1Led104 = 303, - CustomDeviceChannel1Led105 = 304, - CustomDeviceChannel1Led106 = 305, - CustomDeviceChannel1Led107 = 306, - CustomDeviceChannel1Led108 = 307, - CustomDeviceChannel1Led109 = 308, - CustomDeviceChannel1Led110 = 309, - CustomDeviceChannel1Led111 = 310, - CustomDeviceChannel1Led112 = 311, - CustomDeviceChannel1Led113 = 312, - CustomDeviceChannel1Led114 = 313, - CustomDeviceChannel1Led115 = 314, - CustomDeviceChannel1Led116 = 315, - CustomDeviceChannel1Led117 = 316, - CustomDeviceChannel1Led118 = 317, - CustomDeviceChannel1Led119 = 318, - CustomDeviceChannel1Led120 = 319, - CustomDeviceChannel1Led121 = 320, - CustomDeviceChannel1Led122 = 321, - CustomDeviceChannel1Led123 = 322, - CustomDeviceChannel1Led124 = 323, - CustomDeviceChannel1Led125 = 324, - CustomDeviceChannel1Led126 = 325, - CustomDeviceChannel1Led127 = 326, - CustomDeviceChannel1Led128 = 327, - CustomDeviceChannel1Led129 = 328, - CustomDeviceChannel1Led130 = 329, - CustomDeviceChannel1Led131 = 330, - CustomDeviceChannel1Led132 = 331, - CustomDeviceChannel1Led133 = 332, - CustomDeviceChannel1Led134 = 333, - CustomDeviceChannel1Led135 = 334, - CustomDeviceChannel1Led136 = 335, - CustomDeviceChannel1Led137 = 336, - CustomDeviceChannel1Led138 = 337, - CustomDeviceChannel1Led139 = 338, - CustomDeviceChannel1Led140 = 339, - CustomDeviceChannel1Led141 = 340, - CustomDeviceChannel1Led142 = 341, - CustomDeviceChannel1Led143 = 342, - CustomDeviceChannel1Led144 = 343, - CustomDeviceChannel1Led145 = 344, - CustomDeviceChannel1Led146 = 345, - CustomDeviceChannel1Led147 = 346, - CustomDeviceChannel1Led148 = 347, - CustomDeviceChannel1Led149 = 348, - CustomDeviceChannel1Led150 = 349, - - CustomDeviceChannel2Led1 = 350, - CustomDeviceChannel2Led2 = 351, - CustomDeviceChannel2Led3 = 352, - CustomDeviceChannel2Led4 = 353, - CustomDeviceChannel2Led5 = 354, - CustomDeviceChannel2Led6 = 355, - CustomDeviceChannel2Led7 = 356, - CustomDeviceChannel2Led8 = 357, - CustomDeviceChannel2Led9 = 358, - CustomDeviceChannel2Led10 = 359, - CustomDeviceChannel2Led11 = 360, - CustomDeviceChannel2Led12 = 361, - CustomDeviceChannel2Led13 = 362, - CustomDeviceChannel2Led14 = 363, - CustomDeviceChannel2Led15 = 364, - CustomDeviceChannel2Led16 = 365, - CustomDeviceChannel2Led17 = 366, - CustomDeviceChannel2Led18 = 367, - CustomDeviceChannel2Led19 = 368, - CustomDeviceChannel2Led20 = 369, - CustomDeviceChannel2Led21 = 370, - CustomDeviceChannel2Led22 = 371, - CustomDeviceChannel2Led23 = 372, - CustomDeviceChannel2Led24 = 373, - CustomDeviceChannel2Led25 = 374, - CustomDeviceChannel2Led26 = 375, - CustomDeviceChannel2Led27 = 376, - CustomDeviceChannel2Led28 = 377, - CustomDeviceChannel2Led29 = 378, - CustomDeviceChannel2Led30 = 379, - CustomDeviceChannel2Led31 = 380, - CustomDeviceChannel2Led32 = 381, - CustomDeviceChannel2Led33 = 382, - CustomDeviceChannel2Led34 = 383, - CustomDeviceChannel2Led35 = 384, - CustomDeviceChannel2Led36 = 385, - CustomDeviceChannel2Led37 = 386, - CustomDeviceChannel2Led38 = 387, - CustomDeviceChannel2Led39 = 388, - CustomDeviceChannel2Led40 = 389, - CustomDeviceChannel2Led41 = 390, - CustomDeviceChannel2Led42 = 391, - CustomDeviceChannel2Led43 = 392, - CustomDeviceChannel2Led44 = 393, - CustomDeviceChannel2Led45 = 394, - CustomDeviceChannel2Led46 = 395, - CustomDeviceChannel2Led47 = 396, - CustomDeviceChannel2Led48 = 397, - CustomDeviceChannel2Led49 = 398, - CustomDeviceChannel2Led50 = 399, - CustomDeviceChannel2Led51 = 400, - CustomDeviceChannel2Led52 = 401, - CustomDeviceChannel2Led53 = 402, - CustomDeviceChannel2Led54 = 403, - CustomDeviceChannel2Led55 = 404, - CustomDeviceChannel2Led56 = 405, - CustomDeviceChannel2Led57 = 406, - CustomDeviceChannel2Led58 = 407, - CustomDeviceChannel2Led59 = 408, - CustomDeviceChannel2Led60 = 409, - CustomDeviceChannel2Led61 = 410, - CustomDeviceChannel2Led62 = 411, - CustomDeviceChannel2Led63 = 412, - CustomDeviceChannel2Led64 = 413, - CustomDeviceChannel2Led65 = 414, - CustomDeviceChannel2Led66 = 415, - CustomDeviceChannel2Led67 = 416, - CustomDeviceChannel2Led68 = 417, - CustomDeviceChannel2Led69 = 418, - CustomDeviceChannel2Led70 = 419, - CustomDeviceChannel2Led71 = 420, - CustomDeviceChannel2Led72 = 421, - CustomDeviceChannel2Led73 = 422, - CustomDeviceChannel2Led74 = 423, - CustomDeviceChannel2Led75 = 424, - CustomDeviceChannel2Led76 = 425, - CustomDeviceChannel2Led77 = 426, - CustomDeviceChannel2Led78 = 427, - CustomDeviceChannel2Led79 = 428, - CustomDeviceChannel2Led80 = 429, - CustomDeviceChannel2Led81 = 430, - CustomDeviceChannel2Led82 = 431, - CustomDeviceChannel2Led83 = 432, - CustomDeviceChannel2Led84 = 433, - CustomDeviceChannel2Led85 = 434, - CustomDeviceChannel2Led86 = 435, - CustomDeviceChannel2Led87 = 436, - CustomDeviceChannel2Led88 = 437, - CustomDeviceChannel2Led89 = 438, - CustomDeviceChannel2Led90 = 439, - CustomDeviceChannel2Led91 = 440, - CustomDeviceChannel2Led92 = 441, - CustomDeviceChannel2Led93 = 442, - CustomDeviceChannel2Led94 = 443, - CustomDeviceChannel2Led95 = 444, - CustomDeviceChannel2Led96 = 445, - CustomDeviceChannel2Led97 = 446, - CustomDeviceChannel2Led98 = 447, - CustomDeviceChannel2Led99 = 448, - CustomDeviceChannel2Led100 = 449, - CustomDeviceChannel2Led101 = 450, - CustomDeviceChannel2Led102 = 451, - CustomDeviceChannel2Led103 = 452, - CustomDeviceChannel2Led104 = 453, - CustomDeviceChannel2Led105 = 454, - CustomDeviceChannel2Led106 = 455, - CustomDeviceChannel2Led107 = 456, - CustomDeviceChannel2Led108 = 457, - CustomDeviceChannel2Led109 = 458, - CustomDeviceChannel2Led110 = 459, - CustomDeviceChannel2Led111 = 460, - CustomDeviceChannel2Led112 = 461, - CustomDeviceChannel2Led113 = 462, - CustomDeviceChannel2Led114 = 463, - CustomDeviceChannel2Led115 = 464, - CustomDeviceChannel2Led116 = 465, - CustomDeviceChannel2Led117 = 466, - CustomDeviceChannel2Led118 = 467, - CustomDeviceChannel2Led119 = 468, - CustomDeviceChannel2Led120 = 469, - CustomDeviceChannel2Led121 = 470, - CustomDeviceChannel2Led122 = 471, - CustomDeviceChannel2Led123 = 472, - CustomDeviceChannel2Led124 = 473, - CustomDeviceChannel2Led125 = 474, - CustomDeviceChannel2Led126 = 475, - CustomDeviceChannel2Led127 = 476, - CustomDeviceChannel2Led128 = 477, - CustomDeviceChannel2Led129 = 478, - CustomDeviceChannel2Led130 = 479, - CustomDeviceChannel2Led131 = 480, - CustomDeviceChannel2Led132 = 481, - CustomDeviceChannel2Led133 = 482, - CustomDeviceChannel2Led134 = 483, - CustomDeviceChannel2Led135 = 484, - CustomDeviceChannel2Led136 = 485, - CustomDeviceChannel2Led137 = 486, - CustomDeviceChannel2Led138 = 487, - CustomDeviceChannel2Led139 = 488, - CustomDeviceChannel2Led140 = 489, - CustomDeviceChannel2Led141 = 490, - CustomDeviceChannel2Led142 = 491, - CustomDeviceChannel2Led143 = 492, - CustomDeviceChannel2Led144 = 493, - CustomDeviceChannel2Led145 = 494, - CustomDeviceChannel2Led146 = 495, - CustomDeviceChannel2Led147 = 496, - CustomDeviceChannel2Led148 = 497, - CustomDeviceChannel2Led149 = 498, - CustomDeviceChannel2Led150 = 499, - - OemLed1 = 500, - OemLed2 = 501, - OemLed3 = 502, - OemLed4 = 503, - OemLed5 = 504, - OemLed6 = 505, - OemLed7 = 506, - OemLed8 = 507, - OemLed9 = 508, - OemLed10 = 509, - OemLed11 = 510, - OemLed12 = 511, - OemLed13 = 512, - OemLed14 = 513, - OemLed15 = 514, - OemLed16 = 515, - OemLed17 = 516, - OemLed18 = 517, - OemLed19 = 518, - OemLed20 = 519, - OemLed21 = 520, - OemLed22 = 521, - OemLed23 = 522, - OemLed24 = 523, - OemLed25 = 524, - OemLed26 = 525, - OemLed27 = 526, - OemLed28 = 527, - OemLed29 = 528, - OemLed30 = 529, - OemLed31 = 530, - OemLed32 = 531, - OemLed33 = 532, - OemLed34 = 533, - OemLed35 = 534, - OemLed36 = 535, - OemLed37 = 536, - OemLed38 = 537, - OemLed39 = 538, - OemLed40 = 539, - OemLed41 = 540, - OemLed42 = 541, - OemLed43 = 542, - OemLed44 = 543, - OemLed45 = 544, - OemLed46 = 545, - OemLed47 = 546, - OemLed48 = 547, - OemLed49 = 548, - OemLed50 = 549, - OemLed51 = 550, - OemLed52 = 551, - OemLed53 = 552, - OemLed54 = 553, - OemLed55 = 554, - OemLed56 = 555, - OemLed57 = 556, - OemLed58 = 557, - OemLed59 = 558, - OemLed60 = 559, - OemLed61 = 560, - OemLed62 = 561, - OemLed63 = 562, - OemLed64 = 563, - OemLed65 = 564, - OemLed66 = 565, - OemLed67 = 566, - OemLed68 = 567, - OemLed69 = 568, - OemLed70 = 569, - OemLed71 = 570, - OemLed72 = 571, - OemLed73 = 572, - OemLed74 = 573, - OemLed75 = 574, - OemLed76 = 575, - OemLed77 = 576, - OemLed78 = 577, - OemLed79 = 578, - OemLed80 = 579, - OemLed81 = 580, - OemLed82 = 581, - OemLed83 = 582, - OemLed84 = 583, - OemLed85 = 584, - OemLed86 = 585, - OemLed87 = 586, - OemLed88 = 587, - OemLed89 = 588, - OemLed90 = 589, - OemLed91 = 590, - OemLed92 = 591, - OemLed93 = 592, - OemLed94 = 593, - OemLed95 = 594, - OemLed96 = 595, - OemLed97 = 596, - OemLed98 = 597, - OemLed99 = 598, - OemLed100 = 599, - - DRAM1 = 600, - DRAM2 = 601, - DRAM3 = 602, - DRAM4 = 603, - DRAM5 = 604, - DRAM6 = 605, - DRAM7 = 606, - DRAM8 = 607, - DRAM9 = 608, - DRAM10 = 609, - DRAM11 = 610, - DRAM12 = 611, - - CustomDeviceChannel3Led1 = 612, - CustomDeviceChannel3Led2 = 613, - CustomDeviceChannel3Led3 = 614, - CustomDeviceChannel3Led4 = 615, - CustomDeviceChannel3Led5 = 616, - CustomDeviceChannel3Led6 = 617, - CustomDeviceChannel3Led7 = 618, - CustomDeviceChannel3Led8 = 619, - CustomDeviceChannel3Led9 = 620, - CustomDeviceChannel3Led10 = 621, - CustomDeviceChannel3Led11 = 622, - CustomDeviceChannel3Led12 = 623, - CustomDeviceChannel3Led13 = 624, - CustomDeviceChannel3Led14 = 625, - CustomDeviceChannel3Led15 = 626, - CustomDeviceChannel3Led16 = 627, - CustomDeviceChannel3Led17 = 628, - CustomDeviceChannel3Led18 = 629, - CustomDeviceChannel3Led19 = 630, - CustomDeviceChannel3Led20 = 631, - CustomDeviceChannel3Led21 = 632, - CustomDeviceChannel3Led22 = 633, - CustomDeviceChannel3Led23 = 634, - CustomDeviceChannel3Led24 = 635, - CustomDeviceChannel3Led25 = 636, - CustomDeviceChannel3Led26 = 637, - CustomDeviceChannel3Led27 = 638, - CustomDeviceChannel3Led28 = 639, - CustomDeviceChannel3Led29 = 640, - CustomDeviceChannel3Led30 = 641, - CustomDeviceChannel3Led31 = 642, - CustomDeviceChannel3Led32 = 643, - CustomDeviceChannel3Led33 = 644, - CustomDeviceChannel3Led34 = 645, - CustomDeviceChannel3Led35 = 646, - CustomDeviceChannel3Led36 = 647, - CustomDeviceChannel3Led37 = 648, - CustomDeviceChannel3Led38 = 649, - CustomDeviceChannel3Led39 = 650, - CustomDeviceChannel3Led40 = 651, - CustomDeviceChannel3Led41 = 652, - CustomDeviceChannel3Led42 = 653, - CustomDeviceChannel3Led43 = 654, - CustomDeviceChannel3Led44 = 655, - CustomDeviceChannel3Led45 = 656, - CustomDeviceChannel3Led46 = 657, - CustomDeviceChannel3Led47 = 658, - CustomDeviceChannel3Led48 = 659, - CustomDeviceChannel3Led49 = 660, - CustomDeviceChannel3Led50 = 661, - CustomDeviceChannel3Led51 = 662, - CustomDeviceChannel3Led52 = 663, - CustomDeviceChannel3Led53 = 664, - CustomDeviceChannel3Led54 = 665, - CustomDeviceChannel3Led55 = 666, - CustomDeviceChannel3Led56 = 667, - CustomDeviceChannel3Led57 = 668, - CustomDeviceChannel3Led58 = 669, - CustomDeviceChannel3Led59 = 670, - CustomDeviceChannel3Led60 = 671, - CustomDeviceChannel3Led61 = 672, - CustomDeviceChannel3Led62 = 673, - CustomDeviceChannel3Led63 = 674, - CustomDeviceChannel3Led64 = 675, - CustomDeviceChannel3Led65 = 676, - CustomDeviceChannel3Led66 = 677, - CustomDeviceChannel3Led67 = 678, - CustomDeviceChannel3Led68 = 679, - CustomDeviceChannel3Led69 = 680, - CustomDeviceChannel3Led70 = 681, - CustomDeviceChannel3Led71 = 682, - CustomDeviceChannel3Led72 = 683, - CustomDeviceChannel3Led73 = 684, - CustomDeviceChannel3Led74 = 685, - CustomDeviceChannel3Led75 = 686, - CustomDeviceChannel3Led76 = 687, - CustomDeviceChannel3Led77 = 688, - CustomDeviceChannel3Led78 = 689, - CustomDeviceChannel3Led79 = 690, - CustomDeviceChannel3Led80 = 691, - CustomDeviceChannel3Led81 = 692, - CustomDeviceChannel3Led82 = 693, - CustomDeviceChannel3Led83 = 694, - CustomDeviceChannel3Led84 = 695, - CustomDeviceChannel3Led85 = 696, - CustomDeviceChannel3Led86 = 697, - CustomDeviceChannel3Led87 = 698, - CustomDeviceChannel3Led88 = 699, - CustomDeviceChannel3Led89 = 700, - CustomDeviceChannel3Led90 = 701, - CustomDeviceChannel3Led91 = 702, - CustomDeviceChannel3Led92 = 703, - CustomDeviceChannel3Led93 = 704, - CustomDeviceChannel3Led94 = 705, - CustomDeviceChannel3Led95 = 706, - CustomDeviceChannel3Led96 = 707, - CustomDeviceChannel3Led97 = 708, - CustomDeviceChannel3Led98 = 709, - CustomDeviceChannel3Led99 = 710, - CustomDeviceChannel3Led100 = 711, - CustomDeviceChannel3Led101 = 712, - CustomDeviceChannel3Led102 = 713, - CustomDeviceChannel3Led103 = 714, - CustomDeviceChannel3Led104 = 715, - CustomDeviceChannel3Led105 = 716, - CustomDeviceChannel3Led106 = 717, - CustomDeviceChannel3Led107 = 718, - CustomDeviceChannel3Led108 = 719, - CustomDeviceChannel3Led109 = 720, - CustomDeviceChannel3Led110 = 721, - CustomDeviceChannel3Led111 = 722, - CustomDeviceChannel3Led112 = 723, - CustomDeviceChannel3Led113 = 724, - CustomDeviceChannel3Led114 = 725, - CustomDeviceChannel3Led115 = 726, - CustomDeviceChannel3Led116 = 727, - CustomDeviceChannel3Led117 = 728, - CustomDeviceChannel3Led118 = 729, - CustomDeviceChannel3Led119 = 730, - CustomDeviceChannel3Led120 = 731, - CustomDeviceChannel3Led121 = 732, - CustomDeviceChannel3Led122 = 733, - CustomDeviceChannel3Led123 = 734, - CustomDeviceChannel3Led124 = 735, - CustomDeviceChannel3Led125 = 736, - CustomDeviceChannel3Led126 = 737, - CustomDeviceChannel3Led127 = 738, - CustomDeviceChannel3Led128 = 739, - CustomDeviceChannel3Led129 = 740, - CustomDeviceChannel3Led130 = 741, - CustomDeviceChannel3Led131 = 742, - CustomDeviceChannel3Led132 = 743, - CustomDeviceChannel3Led133 = 744, - CustomDeviceChannel3Led134 = 745, - CustomDeviceChannel3Led135 = 746, - CustomDeviceChannel3Led136 = 747, - CustomDeviceChannel3Led137 = 748, - CustomDeviceChannel3Led138 = 749, - CustomDeviceChannel3Led139 = 750, - CustomDeviceChannel3Led140 = 751, - CustomDeviceChannel3Led141 = 752, - CustomDeviceChannel3Led142 = 753, - CustomDeviceChannel3Led143 = 754, - CustomDeviceChannel3Led144 = 755, - CustomDeviceChannel3Led145 = 756, - CustomDeviceChannel3Led146 = 757, - CustomDeviceChannel3Led147 = 758, - CustomDeviceChannel3Led148 = 759, - CustomDeviceChannel3Led149 = 760, - CustomDeviceChannel3Led150 = 761, - - CustomLiquidCoolerChannel1Led1 = 762, - CustomLiquidCoolerChannel1Led2 = 763, - CustomLiquidCoolerChannel1Led3 = 764, - CustomLiquidCoolerChannel1Led4 = 765, - CustomLiquidCoolerChannel1Led5 = 766, - CustomLiquidCoolerChannel1Led6 = 767, - CustomLiquidCoolerChannel1Led7 = 768, - CustomLiquidCoolerChannel1Led8 = 769, - CustomLiquidCoolerChannel1Led9 = 770, - CustomLiquidCoolerChannel1Led10 = 771, - CustomLiquidCoolerChannel1Led11 = 772, - CustomLiquidCoolerChannel1Led12 = 773, - CustomLiquidCoolerChannel1Led13 = 774, - CustomLiquidCoolerChannel1Led14 = 775, - CustomLiquidCoolerChannel1Led15 = 776, - CustomLiquidCoolerChannel1Led16 = 777, - CustomLiquidCoolerChannel1Led17 = 778, - CustomLiquidCoolerChannel1Led18 = 779, - CustomLiquidCoolerChannel1Led19 = 780, - CustomLiquidCoolerChannel1Led20 = 781, - CustomLiquidCoolerChannel1Led21 = 782, - CustomLiquidCoolerChannel1Led22 = 783, - CustomLiquidCoolerChannel1Led23 = 784, - CustomLiquidCoolerChannel1Led24 = 785, - CustomLiquidCoolerChannel1Led25 = 786, - CustomLiquidCoolerChannel1Led26 = 787, - CustomLiquidCoolerChannel1Led27 = 788, - CustomLiquidCoolerChannel1Led28 = 789, - CustomLiquidCoolerChannel1Led29 = 790, - CustomLiquidCoolerChannel1Led30 = 791, - CustomLiquidCoolerChannel1Led31 = 792, - CustomLiquidCoolerChannel1Led32 = 793, - CustomLiquidCoolerChannel1Led33 = 794, - CustomLiquidCoolerChannel1Led34 = 795, - CustomLiquidCoolerChannel1Led35 = 796, - CustomLiquidCoolerChannel1Led36 = 797, - CustomLiquidCoolerChannel1Led37 = 798, - CustomLiquidCoolerChannel1Led38 = 799, - CustomLiquidCoolerChannel1Led39 = 800, - CustomLiquidCoolerChannel1Led40 = 801, - CustomLiquidCoolerChannel1Led41 = 802, - CustomLiquidCoolerChannel1Led42 = 803, - CustomLiquidCoolerChannel1Led43 = 804, - CustomLiquidCoolerChannel1Led44 = 805, - CustomLiquidCoolerChannel1Led45 = 806, - CustomLiquidCoolerChannel1Led46 = 807, - CustomLiquidCoolerChannel1Led47 = 808, - CustomLiquidCoolerChannel1Led48 = 809, - CustomLiquidCoolerChannel1Led49 = 810, - CustomLiquidCoolerChannel1Led50 = 811, - CustomLiquidCoolerChannel1Led51 = 812, - CustomLiquidCoolerChannel1Led52 = 813, - CustomLiquidCoolerChannel1Led53 = 814, - CustomLiquidCoolerChannel1Led54 = 815, - CustomLiquidCoolerChannel1Led55 = 816, - CustomLiquidCoolerChannel1Led56 = 817, - CustomLiquidCoolerChannel1Led57 = 818, - CustomLiquidCoolerChannel1Led58 = 819, - CustomLiquidCoolerChannel1Led59 = 820, - CustomLiquidCoolerChannel1Led60 = 821, - CustomLiquidCoolerChannel1Led61 = 822, - CustomLiquidCoolerChannel1Led62 = 823, - CustomLiquidCoolerChannel1Led63 = 824, - CustomLiquidCoolerChannel1Led64 = 825, - CustomLiquidCoolerChannel1Led65 = 826, - CustomLiquidCoolerChannel1Led66 = 827, - CustomLiquidCoolerChannel1Led67 = 828, - CustomLiquidCoolerChannel1Led68 = 829, - CustomLiquidCoolerChannel1Led69 = 830, - CustomLiquidCoolerChannel1Led70 = 831, - CustomLiquidCoolerChannel1Led71 = 832, - CustomLiquidCoolerChannel1Led72 = 833, - CustomLiquidCoolerChannel1Led73 = 834, - CustomLiquidCoolerChannel1Led74 = 835, - CustomLiquidCoolerChannel1Led75 = 836, - CustomLiquidCoolerChannel1Led76 = 837, - CustomLiquidCoolerChannel1Led77 = 838, - CustomLiquidCoolerChannel1Led78 = 839, - CustomLiquidCoolerChannel1Led79 = 840, - CustomLiquidCoolerChannel1Led80 = 841, - CustomLiquidCoolerChannel1Led81 = 842, - CustomLiquidCoolerChannel1Led82 = 843, - CustomLiquidCoolerChannel1Led83 = 844, - CustomLiquidCoolerChannel1Led84 = 845, - CustomLiquidCoolerChannel1Led85 = 846, - CustomLiquidCoolerChannel1Led86 = 847, - CustomLiquidCoolerChannel1Led87 = 848, - CustomLiquidCoolerChannel1Led88 = 849, - CustomLiquidCoolerChannel1Led89 = 850, - CustomLiquidCoolerChannel1Led90 = 851, - CustomLiquidCoolerChannel1Led91 = 852, - CustomLiquidCoolerChannel1Led92 = 853, - CustomLiquidCoolerChannel1Led93 = 854, - CustomLiquidCoolerChannel1Led94 = 855, - CustomLiquidCoolerChannel1Led95 = 856, - CustomLiquidCoolerChannel1Led96 = 857, - CustomLiquidCoolerChannel1Led97 = 858, - CustomLiquidCoolerChannel1Led98 = 859, - CustomLiquidCoolerChannel1Led99 = 860, - CustomLiquidCoolerChannel1Led100 = 861, - CustomLiquidCoolerChannel1Led101 = 862, - CustomLiquidCoolerChannel1Led102 = 863, - CustomLiquidCoolerChannel1Led103 = 864, - CustomLiquidCoolerChannel1Led104 = 865, - CustomLiquidCoolerChannel1Led105 = 866, - CustomLiquidCoolerChannel1Led106 = 867, - CustomLiquidCoolerChannel1Led107 = 868, - CustomLiquidCoolerChannel1Led108 = 869, - CustomLiquidCoolerChannel1Led109 = 870, - CustomLiquidCoolerChannel1Led110 = 871, - CustomLiquidCoolerChannel1Led111 = 872, - CustomLiquidCoolerChannel1Led112 = 873, - CustomLiquidCoolerChannel1Led113 = 874, - CustomLiquidCoolerChannel1Led114 = 875, - CustomLiquidCoolerChannel1Led115 = 876, - CustomLiquidCoolerChannel1Led116 = 877, - CustomLiquidCoolerChannel1Led117 = 878, - CustomLiquidCoolerChannel1Led118 = 879, - CustomLiquidCoolerChannel1Led119 = 880, - CustomLiquidCoolerChannel1Led120 = 881, - CustomLiquidCoolerChannel1Led121 = 882, - CustomLiquidCoolerChannel1Led122 = 883, - CustomLiquidCoolerChannel1Led123 = 884, - CustomLiquidCoolerChannel1Led124 = 885, - CustomLiquidCoolerChannel1Led125 = 886, - CustomLiquidCoolerChannel1Led126 = 887, - CustomLiquidCoolerChannel1Led127 = 888, - CustomLiquidCoolerChannel1Led128 = 889, - CustomLiquidCoolerChannel1Led129 = 890, - CustomLiquidCoolerChannel1Led130 = 891, - CustomLiquidCoolerChannel1Led131 = 892, - CustomLiquidCoolerChannel1Led132 = 893, - CustomLiquidCoolerChannel1Led133 = 894, - CustomLiquidCoolerChannel1Led134 = 895, - CustomLiquidCoolerChannel1Led135 = 896, - CustomLiquidCoolerChannel1Led136 = 897, - CustomLiquidCoolerChannel1Led137 = 898, - CustomLiquidCoolerChannel1Led138 = 899, - CustomLiquidCoolerChannel1Led139 = 900, - CustomLiquidCoolerChannel1Led140 = 901, - CustomLiquidCoolerChannel1Led141 = 902, - CustomLiquidCoolerChannel1Led142 = 903, - CustomLiquidCoolerChannel1Led143 = 904, - CustomLiquidCoolerChannel1Led144 = 905, - CustomLiquidCoolerChannel1Led145 = 906, - CustomLiquidCoolerChannel1Led146 = 907, - CustomLiquidCoolerChannel1Led147 = 908, - CustomLiquidCoolerChannel1Led148 = 909, - CustomLiquidCoolerChannel1Led149 = 910, - CustomLiquidCoolerChannel1Led150 = 911, - - CustomDeviceChannel1Led151 = 912, - CustomDeviceChannel1Led152 = 913, - CustomDeviceChannel1Led153 = 914, - CustomDeviceChannel1Led154 = 915, - CustomDeviceChannel1Led155 = 916, - CustomDeviceChannel1Led156 = 917, - CustomDeviceChannel1Led157 = 918, - CustomDeviceChannel1Led158 = 919, - CustomDeviceChannel1Led159 = 920, - CustomDeviceChannel1Led160 = 921, - CustomDeviceChannel1Led161 = 922, - CustomDeviceChannel1Led162 = 923, - CustomDeviceChannel1Led163 = 924, - CustomDeviceChannel1Led164 = 925, - CustomDeviceChannel1Led165 = 926, - CustomDeviceChannel1Led166 = 927, - CustomDeviceChannel1Led167 = 928, - CustomDeviceChannel1Led168 = 929, - CustomDeviceChannel1Led169 = 930, - CustomDeviceChannel1Led170 = 931, - CustomDeviceChannel1Led171 = 932, - CustomDeviceChannel1Led172 = 933, - CustomDeviceChannel1Led173 = 934, - CustomDeviceChannel1Led174 = 935, - CustomDeviceChannel1Led175 = 936, - CustomDeviceChannel1Led176 = 937, - CustomDeviceChannel1Led177 = 938, - CustomDeviceChannel1Led178 = 939, - CustomDeviceChannel1Led179 = 940, - CustomDeviceChannel1Led180 = 941, - CustomDeviceChannel1Led181 = 942, - CustomDeviceChannel1Led182 = 943, - CustomDeviceChannel1Led183 = 944, - CustomDeviceChannel1Led184 = 945, - CustomDeviceChannel1Led185 = 946, - CustomDeviceChannel1Led186 = 947, - CustomDeviceChannel1Led187 = 948, - CustomDeviceChannel1Led188 = 949, - CustomDeviceChannel1Led189 = 950, - CustomDeviceChannel1Led190 = 951, - CustomDeviceChannel1Led191 = 952, - CustomDeviceChannel1Led192 = 953, - CustomDeviceChannel1Led193 = 954, - CustomDeviceChannel1Led194 = 955, - CustomDeviceChannel1Led195 = 956, - CustomDeviceChannel1Led196 = 957, - CustomDeviceChannel1Led197 = 958, - CustomDeviceChannel1Led198 = 959, - CustomDeviceChannel1Led199 = 960, - CustomDeviceChannel1Led200 = 961, - CustomDeviceChannel1Led201 = 962, - CustomDeviceChannel1Led202 = 963, - CustomDeviceChannel1Led203 = 964, - CustomDeviceChannel1Led204 = 965, - CustomDeviceChannel1Led205 = 966, - CustomDeviceChannel1Led206 = 967, - CustomDeviceChannel1Led207 = 968, - CustomDeviceChannel1Led208 = 969, - CustomDeviceChannel1Led209 = 970, - CustomDeviceChannel1Led210 = 971, - CustomDeviceChannel1Led211 = 972, - CustomDeviceChannel1Led212 = 973, - CustomDeviceChannel1Led213 = 974, - CustomDeviceChannel1Led214 = 975, - CustomDeviceChannel1Led215 = 976, - CustomDeviceChannel1Led216 = 977, - CustomDeviceChannel1Led217 = 978, - CustomDeviceChannel1Led218 = 979, - CustomDeviceChannel1Led219 = 980, - CustomDeviceChannel1Led220 = 981, - CustomDeviceChannel1Led221 = 982, - CustomDeviceChannel1Led222 = 983, - CustomDeviceChannel1Led223 = 984, - CustomDeviceChannel1Led224 = 985, - CustomDeviceChannel1Led225 = 986, - CustomDeviceChannel1Led226 = 987, - CustomDeviceChannel1Led227 = 988, - CustomDeviceChannel1Led228 = 989, - CustomDeviceChannel1Led229 = 990, - CustomDeviceChannel1Led230 = 991, - CustomDeviceChannel1Led231 = 992, - CustomDeviceChannel1Led232 = 993, - CustomDeviceChannel1Led233 = 994, - CustomDeviceChannel1Led234 = 995, - CustomDeviceChannel1Led235 = 996, - CustomDeviceChannel1Led236 = 997, - CustomDeviceChannel1Led237 = 998, - CustomDeviceChannel1Led238 = 999, - CustomDeviceChannel1Led239 = 1000, - CustomDeviceChannel1Led240 = 1001, - CustomDeviceChannel1Led241 = 1002, - CustomDeviceChannel1Led242 = 1003, - CustomDeviceChannel1Led243 = 1004, - CustomDeviceChannel1Led244 = 1005, - CustomDeviceChannel1Led245 = 1006, - CustomDeviceChannel1Led246 = 1007, - CustomDeviceChannel1Led247 = 1008, - CustomDeviceChannel1Led248 = 1009, - CustomDeviceChannel1Led249 = 1010, - CustomDeviceChannel1Led250 = 1011, - CustomDeviceChannel1Led251 = 1012, - CustomDeviceChannel1Led252 = 1013, - CustomDeviceChannel1Led253 = 1014, - CustomDeviceChannel1Led254 = 1015, - CustomDeviceChannel1Led255 = 1016, - CustomDeviceChannel1Led256 = 1017, - CustomDeviceChannel1Led257 = 1018, - CustomDeviceChannel1Led258 = 1019, - CustomDeviceChannel1Led259 = 1020, - CustomDeviceChannel1Led260 = 1021, - CustomDeviceChannel1Led261 = 1022, - CustomDeviceChannel1Led262 = 1023, - CustomDeviceChannel1Led263 = 1024, - CustomDeviceChannel1Led264 = 1025, - CustomDeviceChannel1Led265 = 1026, - CustomDeviceChannel1Led266 = 1027, - CustomDeviceChannel1Led267 = 1028, - CustomDeviceChannel1Led268 = 1029, - CustomDeviceChannel1Led269 = 1030, - CustomDeviceChannel1Led270 = 1031, - CustomDeviceChannel1Led271 = 1032, - CustomDeviceChannel1Led272 = 1033, - CustomDeviceChannel1Led273 = 1034, - CustomDeviceChannel1Led274 = 1035, - CustomDeviceChannel1Led275 = 1036, - CustomDeviceChannel1Led276 = 1037, - CustomDeviceChannel1Led277 = 1038, - CustomDeviceChannel1Led278 = 1039, - CustomDeviceChannel1Led279 = 1040, - CustomDeviceChannel1Led280 = 1041, - CustomDeviceChannel1Led281 = 1042, - CustomDeviceChannel1Led282 = 1043, - CustomDeviceChannel1Led283 = 1044, - CustomDeviceChannel1Led284 = 1045, - CustomDeviceChannel1Led285 = 1046, - CustomDeviceChannel1Led286 = 1047, - CustomDeviceChannel1Led287 = 1048, - CustomDeviceChannel1Led288 = 1049, - CustomDeviceChannel1Led289 = 1050, - CustomDeviceChannel1Led290 = 1051, - CustomDeviceChannel1Led291 = 1052, - CustomDeviceChannel1Led292 = 1053, - CustomDeviceChannel1Led293 = 1054, - CustomDeviceChannel1Led294 = 1055, - CustomDeviceChannel1Led295 = 1056, - CustomDeviceChannel1Led296 = 1057, - CustomDeviceChannel1Led297 = 1058, - CustomDeviceChannel1Led298 = 1059, - CustomDeviceChannel1Led299 = 1060, - CustomDeviceChannel1Led300 = 1061, - - CustomDeviceChannel2Led151 = 1062, - CustomDeviceChannel2Led152 = 1063, - CustomDeviceChannel2Led153 = 1064, - CustomDeviceChannel2Led154 = 1065, - CustomDeviceChannel2Led155 = 1066, - CustomDeviceChannel2Led156 = 1067, - CustomDeviceChannel2Led157 = 1068, - CustomDeviceChannel2Led158 = 1069, - CustomDeviceChannel2Led159 = 1070, - CustomDeviceChannel2Led160 = 1071, - CustomDeviceChannel2Led161 = 1072, - CustomDeviceChannel2Led162 = 1073, - CustomDeviceChannel2Led163 = 1074, - CustomDeviceChannel2Led164 = 1075, - CustomDeviceChannel2Led165 = 1076, - CustomDeviceChannel2Led166 = 1077, - CustomDeviceChannel2Led167 = 1078, - CustomDeviceChannel2Led168 = 1079, - CustomDeviceChannel2Led169 = 1080, - CustomDeviceChannel2Led170 = 1081, - CustomDeviceChannel2Led171 = 1082, - CustomDeviceChannel2Led172 = 1083, - CustomDeviceChannel2Led173 = 1084, - CustomDeviceChannel2Led174 = 1085, - CustomDeviceChannel2Led175 = 1086, - CustomDeviceChannel2Led176 = 1087, - CustomDeviceChannel2Led177 = 1088, - CustomDeviceChannel2Led178 = 1089, - CustomDeviceChannel2Led179 = 1090, - CustomDeviceChannel2Led180 = 1091, - CustomDeviceChannel2Led181 = 1092, - CustomDeviceChannel2Led182 = 1093, - CustomDeviceChannel2Led183 = 1094, - CustomDeviceChannel2Led184 = 1095, - CustomDeviceChannel2Led185 = 1096, - CustomDeviceChannel2Led186 = 1097, - CustomDeviceChannel2Led187 = 1098, - CustomDeviceChannel2Led188 = 1099, - CustomDeviceChannel2Led189 = 1100, - CustomDeviceChannel2Led190 = 1101, - CustomDeviceChannel2Led191 = 1102, - CustomDeviceChannel2Led192 = 1103, - CustomDeviceChannel2Led193 = 1104, - CustomDeviceChannel2Led194 = 1105, - CustomDeviceChannel2Led195 = 1106, - CustomDeviceChannel2Led196 = 1107, - CustomDeviceChannel2Led197 = 1108, - CustomDeviceChannel2Led198 = 1109, - CustomDeviceChannel2Led199 = 1110, - CustomDeviceChannel2Led200 = 1111, - CustomDeviceChannel2Led201 = 1112, - CustomDeviceChannel2Led202 = 1113, - CustomDeviceChannel2Led203 = 1114, - CustomDeviceChannel2Led204 = 1115, - CustomDeviceChannel2Led205 = 1116, - CustomDeviceChannel2Led206 = 1117, - CustomDeviceChannel2Led207 = 1118, - CustomDeviceChannel2Led208 = 1119, - CustomDeviceChannel2Led209 = 1120, - CustomDeviceChannel2Led210 = 1121, - CustomDeviceChannel2Led211 = 1122, - CustomDeviceChannel2Led212 = 1123, - CustomDeviceChannel2Led213 = 1124, - CustomDeviceChannel2Led214 = 1125, - CustomDeviceChannel2Led215 = 1126, - CustomDeviceChannel2Led216 = 1127, - CustomDeviceChannel2Led217 = 1128, - CustomDeviceChannel2Led218 = 1129, - CustomDeviceChannel2Led219 = 1130, - CustomDeviceChannel2Led220 = 1131, - CustomDeviceChannel2Led221 = 1132, - CustomDeviceChannel2Led222 = 1133, - CustomDeviceChannel2Led223 = 1134, - CustomDeviceChannel2Led224 = 1135, - CustomDeviceChannel2Led225 = 1136, - CustomDeviceChannel2Led226 = 1137, - CustomDeviceChannel2Led227 = 1138, - CustomDeviceChannel2Led228 = 1139, - CustomDeviceChannel2Led229 = 1140, - CustomDeviceChannel2Led230 = 1141, - CustomDeviceChannel2Led231 = 1142, - CustomDeviceChannel2Led232 = 1143, - CustomDeviceChannel2Led233 = 1144, - CustomDeviceChannel2Led234 = 1145, - CustomDeviceChannel2Led235 = 1146, - CustomDeviceChannel2Led236 = 1147, - CustomDeviceChannel2Led237 = 1148, - CustomDeviceChannel2Led238 = 1149, - CustomDeviceChannel2Led239 = 1150, - CustomDeviceChannel2Led240 = 1151, - CustomDeviceChannel2Led241 = 1152, - CustomDeviceChannel2Led242 = 1153, - CustomDeviceChannel2Led243 = 1154, - CustomDeviceChannel2Led244 = 1155, - CustomDeviceChannel2Led245 = 1156, - CustomDeviceChannel2Led246 = 1157, - CustomDeviceChannel2Led247 = 1158, - CustomDeviceChannel2Led248 = 1159, - CustomDeviceChannel2Led249 = 1160, - CustomDeviceChannel2Led250 = 1161, - CustomDeviceChannel2Led251 = 1162, - CustomDeviceChannel2Led252 = 1163, - CustomDeviceChannel2Led253 = 1164, - CustomDeviceChannel2Led254 = 1165, - CustomDeviceChannel2Led255 = 1166, - CustomDeviceChannel2Led256 = 1167, - CustomDeviceChannel2Led257 = 1168, - CustomDeviceChannel2Led258 = 1169, - CustomDeviceChannel2Led259 = 1170, - CustomDeviceChannel2Led260 = 1171, - CustomDeviceChannel2Led261 = 1172, - CustomDeviceChannel2Led262 = 1173, - CustomDeviceChannel2Led263 = 1174, - CustomDeviceChannel2Led264 = 1175, - CustomDeviceChannel2Led265 = 1176, - CustomDeviceChannel2Led266 = 1177, - CustomDeviceChannel2Led267 = 1178, - CustomDeviceChannel2Led268 = 1179, - CustomDeviceChannel2Led269 = 1180, - CustomDeviceChannel2Led270 = 1181, - CustomDeviceChannel2Led271 = 1182, - CustomDeviceChannel2Led272 = 1183, - CustomDeviceChannel2Led273 = 1184, - CustomDeviceChannel2Led274 = 1185, - CustomDeviceChannel2Led275 = 1186, - CustomDeviceChannel2Led276 = 1187, - CustomDeviceChannel2Led277 = 1188, - CustomDeviceChannel2Led278 = 1189, - CustomDeviceChannel2Led279 = 1190, - CustomDeviceChannel2Led280 = 1191, - CustomDeviceChannel2Led281 = 1192, - CustomDeviceChannel2Led282 = 1193, - CustomDeviceChannel2Led283 = 1194, - CustomDeviceChannel2Led284 = 1195, - CustomDeviceChannel2Led285 = 1196, - CustomDeviceChannel2Led286 = 1197, - CustomDeviceChannel2Led287 = 1198, - CustomDeviceChannel2Led288 = 1199, - CustomDeviceChannel2Led289 = 1200, - CustomDeviceChannel2Led290 = 1201, - CustomDeviceChannel2Led291 = 1202, - CustomDeviceChannel2Led292 = 1203, - CustomDeviceChannel2Led293 = 1204, - CustomDeviceChannel2Led294 = 1205, - CustomDeviceChannel2Led295 = 1206, - CustomDeviceChannel2Led296 = 1207, - CustomDeviceChannel2Led297 = 1208, - CustomDeviceChannel2Led298 = 1209, - CustomDeviceChannel2Led299 = 1210, - CustomDeviceChannel2Led300 = 1211, - - CustomDeviceChannel3Led151 = 1212, - CustomDeviceChannel3Led152 = 1213, - CustomDeviceChannel3Led153 = 1214, - CustomDeviceChannel3Led154 = 1215, - CustomDeviceChannel3Led155 = 1216, - CustomDeviceChannel3Led156 = 1217, - CustomDeviceChannel3Led157 = 1218, - CustomDeviceChannel3Led158 = 1219, - CustomDeviceChannel3Led159 = 1220, - CustomDeviceChannel3Led160 = 1221, - CustomDeviceChannel3Led161 = 1222, - CustomDeviceChannel3Led162 = 1223, - CustomDeviceChannel3Led163 = 1224, - CustomDeviceChannel3Led164 = 1225, - CustomDeviceChannel3Led165 = 1226, - CustomDeviceChannel3Led166 = 1227, - CustomDeviceChannel3Led167 = 1228, - CustomDeviceChannel3Led168 = 1229, - CustomDeviceChannel3Led169 = 1230, - CustomDeviceChannel3Led170 = 1231, - CustomDeviceChannel3Led171 = 1232, - CustomDeviceChannel3Led172 = 1233, - CustomDeviceChannel3Led173 = 1234, - CustomDeviceChannel3Led174 = 1235, - CustomDeviceChannel3Led175 = 1236, - CustomDeviceChannel3Led176 = 1237, - CustomDeviceChannel3Led177 = 1238, - CustomDeviceChannel3Led178 = 1239, - CustomDeviceChannel3Led179 = 1240, - CustomDeviceChannel3Led180 = 1241, - CustomDeviceChannel3Led181 = 1242, - CustomDeviceChannel3Led182 = 1243, - CustomDeviceChannel3Led183 = 1244, - CustomDeviceChannel3Led184 = 1245, - CustomDeviceChannel3Led185 = 1246, - CustomDeviceChannel3Led186 = 1247, - CustomDeviceChannel3Led187 = 1248, - CustomDeviceChannel3Led188 = 1249, - CustomDeviceChannel3Led189 = 1250, - CustomDeviceChannel3Led190 = 1251, - CustomDeviceChannel3Led191 = 1252, - CustomDeviceChannel3Led192 = 1253, - CustomDeviceChannel3Led193 = 1254, - CustomDeviceChannel3Led194 = 1255, - CustomDeviceChannel3Led195 = 1256, - CustomDeviceChannel3Led196 = 1257, - CustomDeviceChannel3Led197 = 1258, - CustomDeviceChannel3Led198 = 1259, - CustomDeviceChannel3Led199 = 1260, - CustomDeviceChannel3Led200 = 1261, - CustomDeviceChannel3Led201 = 1262, - CustomDeviceChannel3Led202 = 1263, - CustomDeviceChannel3Led203 = 1264, - CustomDeviceChannel3Led204 = 1265, - CustomDeviceChannel3Led205 = 1266, - CustomDeviceChannel3Led206 = 1267, - CustomDeviceChannel3Led207 = 1268, - CustomDeviceChannel3Led208 = 1269, - CustomDeviceChannel3Led209 = 1270, - CustomDeviceChannel3Led210 = 1271, - CustomDeviceChannel3Led211 = 1272, - CustomDeviceChannel3Led212 = 1273, - CustomDeviceChannel3Led213 = 1274, - CustomDeviceChannel3Led214 = 1275, - CustomDeviceChannel3Led215 = 1276, - CustomDeviceChannel3Led216 = 1277, - CustomDeviceChannel3Led217 = 1278, - CustomDeviceChannel3Led218 = 1279, - CustomDeviceChannel3Led219 = 1280, - CustomDeviceChannel3Led220 = 1281, - CustomDeviceChannel3Led221 = 1282, - CustomDeviceChannel3Led222 = 1283, - CustomDeviceChannel3Led223 = 1284, - CustomDeviceChannel3Led224 = 1285, - CustomDeviceChannel3Led225 = 1286, - CustomDeviceChannel3Led226 = 1287, - CustomDeviceChannel3Led227 = 1288, - CustomDeviceChannel3Led228 = 1289, - CustomDeviceChannel3Led229 = 1290, - CustomDeviceChannel3Led230 = 1291, - CustomDeviceChannel3Led231 = 1292, - CustomDeviceChannel3Led232 = 1293, - CustomDeviceChannel3Led233 = 1294, - CustomDeviceChannel3Led234 = 1295, - CustomDeviceChannel3Led235 = 1296, - CustomDeviceChannel3Led236 = 1297, - CustomDeviceChannel3Led237 = 1298, - CustomDeviceChannel3Led238 = 1299, - CustomDeviceChannel3Led239 = 1300, - CustomDeviceChannel3Led240 = 1301, - CustomDeviceChannel3Led241 = 1302, - CustomDeviceChannel3Led242 = 1303, - CustomDeviceChannel3Led243 = 1304, - CustomDeviceChannel3Led244 = 1305, - CustomDeviceChannel3Led245 = 1306, - CustomDeviceChannel3Led246 = 1307, - CustomDeviceChannel3Led247 = 1308, - CustomDeviceChannel3Led248 = 1309, - CustomDeviceChannel3Led249 = 1310, - CustomDeviceChannel3Led250 = 1311, - CustomDeviceChannel3Led251 = 1312, - CustomDeviceChannel3Led252 = 1313, - CustomDeviceChannel3Led253 = 1314, - CustomDeviceChannel3Led254 = 1315, - CustomDeviceChannel3Led255 = 1316, - CustomDeviceChannel3Led256 = 1317, - CustomDeviceChannel3Led257 = 1318, - CustomDeviceChannel3Led258 = 1319, - CustomDeviceChannel3Led259 = 1320, - CustomDeviceChannel3Led260 = 1321, - CustomDeviceChannel3Led261 = 1322, - CustomDeviceChannel3Led262 = 1323, - CustomDeviceChannel3Led263 = 1324, - CustomDeviceChannel3Led264 = 1325, - CustomDeviceChannel3Led265 = 1326, - CustomDeviceChannel3Led266 = 1327, - CustomDeviceChannel3Led267 = 1328, - CustomDeviceChannel3Led268 = 1329, - CustomDeviceChannel3Led269 = 1330, - CustomDeviceChannel3Led270 = 1331, - CustomDeviceChannel3Led271 = 1332, - CustomDeviceChannel3Led272 = 1333, - CustomDeviceChannel3Led273 = 1334, - CustomDeviceChannel3Led274 = 1335, - CustomDeviceChannel3Led275 = 1336, - CustomDeviceChannel3Led276 = 1337, - CustomDeviceChannel3Led277 = 1338, - CustomDeviceChannel3Led278 = 1339, - CustomDeviceChannel3Led279 = 1340, - CustomDeviceChannel3Led280 = 1341, - CustomDeviceChannel3Led281 = 1342, - CustomDeviceChannel3Led282 = 1343, - CustomDeviceChannel3Led283 = 1344, - CustomDeviceChannel3Led284 = 1345, - CustomDeviceChannel3Led285 = 1346, - CustomDeviceChannel3Led286 = 1347, - CustomDeviceChannel3Led287 = 1348, - CustomDeviceChannel3Led288 = 1349, - CustomDeviceChannel3Led289 = 1350, - CustomDeviceChannel3Led290 = 1351, - CustomDeviceChannel3Led291 = 1352, - CustomDeviceChannel3Led292 = 1353, - CustomDeviceChannel3Led293 = 1354, - CustomDeviceChannel3Led294 = 1355, - CustomDeviceChannel3Led295 = 1356, - CustomDeviceChannel3Led296 = 1357, - CustomDeviceChannel3Led297 = 1358, - CustomDeviceChannel3Led298 = 1359, - CustomDeviceChannel3Led299 = 1360, - CustomDeviceChannel3Led300 = 1361, - - Mainboard1 = 1362, - Mainboard2 = 1363, - Mainboard3 = 1364, - Mainboard4 = 1365, - Mainboard5 = 1366, - Mainboard6 = 1367, - Mainboard7 = 1368, - Mainboard8 = 1369, - Mainboard9 = 1370, - Mainboard10 = 1371, - Mainboard11 = 1372, - Mainboard12 = 1373, - Mainboard13 = 1374, - Mainboard14 = 1375, - Mainboard15 = 1376, - Mainboard16 = 1377, - Mainboard17 = 1378, - Mainboard18 = 1379, - Mainboard19 = 1380, - Mainboard20 = 1381, - Mainboard21 = 1382, - Mainboard22 = 1383, - Mainboard23 = 1384, - Mainboard24 = 1385, - Mainboard25 = 1386, - Mainboard26 = 1387, - Mainboard27 = 1388, - Mainboard28 = 1389, - Mainboard29 = 1390, - Mainboard30 = 1391, - Mainboard31 = 1392, - Mainboard32 = 1393, - Mainboard33 = 1394, - Mainboard34 = 1395, - Mainboard35 = 1396, - Mainboard36 = 1397, - Mainboard37 = 1398, - Mainboard38 = 1399, - Mainboard39 = 1400, - Mainboard40 = 1401, - Mainboard41 = 1402, - Mainboard42 = 1403, - Mainboard43 = 1404, - Mainboard44 = 1405, - Mainboard45 = 1406, - Mainboard46 = 1407, - Mainboard47 = 1408, - Mainboard48 = 1409, - Mainboard49 = 1410, - Mainboard50 = 1411, - Mainboard51 = 1412, - Mainboard52 = 1413, - Mainboard53 = 1414, - Mainboard54 = 1415, - Mainboard55 = 1416, - Mainboard56 = 1417, - Mainboard57 = 1418, - Mainboard58 = 1419, - Mainboard59 = 1420, - Mainboard60 = 1421, - Mainboard61 = 1422, - Mainboard62 = 1423, - Mainboard63 = 1424, - Mainboard64 = 1425, - Mainboard65 = 1426, - Mainboard66 = 1427, - Mainboard67 = 1428, - Mainboard68 = 1429, - Mainboard69 = 1430, - Mainboard70 = 1431, - Mainboard71 = 1432, - Mainboard72 = 1433, - Mainboard73 = 1434, - Mainboard74 = 1435, - Mainboard75 = 1436, - Mainboard76 = 1437, - Mainboard77 = 1438, - Mainboard78 = 1439, - Mainboard79 = 1440, - Mainboard80 = 1441, - Mainboard81 = 1442, - Mainboard82 = 1443, - Mainboard83 = 1444, - Mainboard84 = 1445, - Mainboard85 = 1446, - Mainboard86 = 1447, - Mainboard87 = 1448, - Mainboard88 = 1449, - Mainboard89 = 1450, - Mainboard90 = 1451, - Mainboard91 = 1452, - Mainboard92 = 1453, - Mainboard93 = 1454, - Mainboard94 = 1455, - Mainboard95 = 1456, - Mainboard96 = 1457, - Mainboard97 = 1458, - Mainboard98 = 1459, - Mainboard99 = 1460, - Mainboard100 = 1461, - - GPU1 = 1462, - GPU2 = 1463, - GPU3 = 1464, - GPU4 = 1465, - GPU5 = 1466, - GPU6 = 1467, - GPU7 = 1468, - GPU8 = 1469, - GPU9 = 1470, - GPU10 = 1471, - GPU11 = 1472, - GPU12 = 1473, - GPU13 = 1474, - GPU14 = 1475, - GPU15 = 1476, - GPU16 = 1477, - GPU17 = 1478, - GPU18 = 1479, - GPU19 = 1480, - GPU20 = 1481, - GPU21 = 1482, - GPU22 = 1483, - GPU23 = 1484, - GPU24 = 1485, - GPU25 = 1486, - GPU26 = 1487, - GPU27 = 1488, - GPU28 = 1489, - GPU29 = 1490, - GPU30 = 1491, - GPU31 = 1492, - GPU32 = 1493, - GPU33 = 1494, - GPU34 = 1495, - GPU35 = 1496, - GPU36 = 1497, - GPU37 = 1498, - GPU38 = 1499, - GPU39 = 1500, - GPU40 = 1501, - GPU41 = 1502, - GPU42 = 1503, - GPU43 = 1504, - GPU44 = 1505, - GPU45 = 1506, - GPU46 = 1507, - GPU47 = 1508, - GPU48 = 1509, - GPU49 = 1510, - GPU50 = 1511, - - Lightbar20 = 1512, - Lightbar21 = 1513, - Lightbar22 = 1514, - Lightbar23 = 1515, - Lightbar24 = 1516, - Lightbar25 = 1517, - Lightbar26 = 1518, - Lightbar27 = 1519, - Lightbar28 = 1520, - Lightbar29 = 1521, - Lightbar30 = 1522, - Lightbar31 = 1523, - Lightbar32 = 1524, - Lightbar33 = 1525, - Lightbar34 = 1526, - Lightbar35 = 1527, - Lightbar36 = 1528, - Lightbar37 = 1529, - Lightbar38 = 1530, - Lightbar39 = 1531, - Lightbar40 = 1532, - Lightbar41 = 1533, - Lightbar42 = 1534, - Lightbar43 = 1535, - Lightbar44 = 1536, - Lightbar45 = 1537, - Lightbar46 = 1538, - Lightbar47 = 1539, - Lightbar48 = 1540, - Lightbar49 = 1541, - Lightbar50 = 1542, - - Profile = 1543, - - OemLed101 = 1544, - OemLed102 = 1545, - OemLed103 = 1546, - OemLed104 = 1547, - OemLed105 = 1548, - OemLed106 = 1549, - OemLed107 = 1550, - OemLed108 = 1551, - OemLed109 = 1552, - OemLed110 = 1553, - OemLed111 = 1554, - OemLed112 = 1555, - OemLed113 = 1556, - OemLed114 = 1557, - OemLed115 = 1558, - OemLed116 = 1559, - OemLed117 = 1560, - OemLed118 = 1561, - OemLed119 = 1562, - OemLed120 = 1563, - OemLed121 = 1564, - OemLed122 = 1565, - OemLed123 = 1566, - OemLed124 = 1567, - OemLed125 = 1568, - OemLed126 = 1569, - OemLed127 = 1570, - OemLed128 = 1571, - OemLed129 = 1572, - OemLed130 = 1573, - OemLed131 = 1574, - OemLed132 = 1575, - OemLed133 = 1576, - OemLed134 = 1577, - OemLed135 = 1578, - OemLed136 = 1579, - OemLed137 = 1580, - OemLed138 = 1581, - OemLed139 = 1582, - OemLed140 = 1583, - OemLed141 = 1584, - OemLed142 = 1585, - OemLed143 = 1586, - OemLed144 = 1587, - OemLed145 = 1588, - OemLed146 = 1589, - OemLed147 = 1590, - OemLed148 = 1591, - OemLed149 = 1592, - OemLed150 = 1593, - OemLed151 = 1594, - OemLed152 = 1595, - OemLed153 = 1596, - OemLed154 = 1597, - OemLed155 = 1598, - OemLed156 = 1599, - OemLed157 = 1600, - OemLed158 = 1601, - OemLed159 = 1602, - OemLed160 = 1603, - OemLed161 = 1604, - OemLed162 = 1605, - OemLed163 = 1606, - OemLed164 = 1607, - OemLed165 = 1608, - OemLed166 = 1609, - OemLed167 = 1610, - OemLed168 = 1611, - OemLed169 = 1612, - OemLed170 = 1613, - OemLed171 = 1614, - OemLed172 = 1615, - OemLed173 = 1616, - OemLed174 = 1617, - OemLed175 = 1618, - OemLed176 = 1619, - OemLed177 = 1620, - OemLed178 = 1621, - OemLed179 = 1622, - OemLed180 = 1623, - OemLed181 = 1624, - OemLed182 = 1625, - OemLed183 = 1626, - OemLed184 = 1627, - OemLed185 = 1628, - OemLed186 = 1629, - OemLed187 = 1630, - OemLed188 = 1631, - OemLed189 = 1632, - OemLed190 = 1633, - OemLed191 = 1634, - OemLed192 = 1635, - OemLed193 = 1636, - OemLed194 = 1637, - OemLed195 = 1638, - OemLed196 = 1639, - OemLed197 = 1640, - OemLed198 = 1641, - OemLed199 = 1642, - OemLed200 = 1643, - OemLed201 = 1644, - OemLed202 = 1645, - OemLed203 = 1646, - OemLed204 = 1647, - OemLed205 = 1648, - OemLed206 = 1649, - OemLed207 = 1650, - OemLed208 = 1651, - OemLed209 = 1652, - OemLed210 = 1653, - OemLed211 = 1654, - OemLed212 = 1655, - OemLed213 = 1656, - OemLed214 = 1657, - OemLed215 = 1658, - OemLed216 = 1659, - OemLed217 = 1660, - OemLed218 = 1661, - OemLed219 = 1662, - OemLed220 = 1663, - OemLed221 = 1664, - OemLed222 = 1665, - OemLed223 = 1666, - OemLed224 = 1667, - OemLed225 = 1668, - OemLed226 = 1669, - OemLed227 = 1670, - OemLed228 = 1671, - OemLed229 = 1672, - OemLed230 = 1673, - OemLed231 = 1674, - OemLed232 = 1675, - OemLed233 = 1676, - OemLed234 = 1677, - OemLed235 = 1678, - OemLed236 = 1679, - OemLed237 = 1680, - OemLed238 = 1681, - OemLed239 = 1682, - OemLed240 = 1683, - OemLed241 = 1684, - OemLed242 = 1685, - OemLed243 = 1686, - OemLed244 = 1687, - OemLed245 = 1688, - OemLed246 = 1689, - OemLed247 = 1690, - OemLed248 = 1691, - OemLed249 = 1692, - OemLed250 = 1693, - - B7 = 1694, - B8 = 1695, - B9 = 1696, - B10 = 1697, - B11 = 1698, - B12 = 1699, - B13 = 1700, - B14 = 1701, - B15 = 1702, - B16 = 1703, - B17 = 1704, - B18 = 1705, - B19 = 1706, - B20 = 1707, -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLedIdKeyboard.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLedIdKeyboard.cs new file mode 100644 index 0000000..3b5ad52 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairLedIdKeyboard.cs @@ -0,0 +1,142 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global +#pragma warning disable 1591 + +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains a list of keyboard leds that belong to CLG_Keyboard group +/// +public enum CorsairLedIdKeyboard +{ + Invalid = 0, + Escape = 1, + F1 = 2, + F2 = 3, + F3 = 4, + F4 = 5, + F5 = 6, + F6 = 7, + F7 = 8, + F8 = 9, + F9 = 10, + F10 = 11, + F11 = 12, + F12 = 13, + GraveAccentAndTilde = 14, + One = 15, + Two = 16, + Three = 17, + Four = 18, + Five = 19, + Six = 20, + Seven = 21, + Eight = 22, + Nine = 23, + Zero = 24, + MinusAndUnderscore = 25, + EqualsAndPlus = 26, + Backspace = 27, + Tab = 28, + Q = 29, + W = 30, + E = 31, + R = 32, + T = 33, + Y = 34, + U = 35, + I = 36, + O = 37, + P = 38, + BracketLeft = 39, + BracketRight = 40, + CapsLock = 41, + A = 42, + S = 43, + D = 44, + F = 45, + G = 46, + H = 47, + J = 48, + K = 49, + L = 50, + SemicolonAndColon = 51, + ApostropheAndDoubleQuote = 52, + Backslash = 53, + Enter = 54, + LeftShift = 55, + NonUsBackslash = 56, + Z = 57, + X = 58, + C = 59, + V = 60, + B = 61, + N = 62, + M = 63, + CommaAndLessThan = 64, + PeriodAndBiggerThan = 65, + SlashAndQuestionMark = 66, + RightShift = 67, + LeftCtrl = 68, + LeftGui = 69, + LeftAlt = 70, + Space = 71, + RightAlt = 72, + RightGui = 73, + Application = 74, + RightCtrl = 75, + LedProgramming = 76, + Lang1 = 77, + Lang2 = 78, + International1 = 79, + International2 = 80, + International3 = 81, + International4 = 82, + International5 = 83, + PrintScreen = 84, + ScrollLock = 85, + PauseBreak = 86, + Insert = 87, + Home = 88, + PageUp = 89, + Delete = 90, + End = 91, + PageDown = 92, + UpArrow = 93, + LeftArrow = 94, + DownArrow = 95, + RightArrow = 96, + NonUsTilde = 97, + Brightness = 98, + WinLock = 99, + Mute = 100, + Stop = 101, + ScanPreviousTrack = 102, + PlayPause = 103, + ScanNextTrack = 104, + NumLock = 105, + KeypadSlash = 106, + KeypadAsterisk = 107, + KeypadMinus = 108, + Keypad7 = 109, + Keypad8 = 110, + Keypad9 = 111, + KeypadPlus = 112, + Keypad4 = 113, + Keypad5 = 114, + Keypad6 = 115, + Keypad1 = 116, + Keypad2 = 117, + Keypad3 = 118, + KeypadComma = 119, + KeypadEnter = 120, + Keypad0 = 121, + KeypadPeriodAndDelete = 122, + VolumeUp = 123, + VolumeDown = 124, + MR = 125, + M1 = 126, + M2 = 127, + M3 = 128, + Fn = 129 +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairLogicalKeyboardLayout.cs b/RGB.NET.Devices.Corsair/Enum/CorsairLogicalKeyboardLayout.cs index ebc4e1b..d5325bb 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairLogicalKeyboardLayout.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairLogicalKeyboardLayout.cs @@ -1,14 +1,14 @@ // ReSharper disable InconsistentNaming // ReSharper disable UnusedMember.Global -#pragma warning disable 1591 namespace RGB.NET.Devices.Corsair; /// -/// Contains a list of available logical layouts for corsair keyboards. +/// iCUE-SDK: Contains a list of available logical layouts for corsair keyboards. /// public enum CorsairLogicalKeyboardLayout { + Invalid = 0, US_Int = 1, NA = 2, EU = 3, diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalKeyboardLayout.cs b/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalKeyboardLayout.cs index 9f5c1c3..f02cd6c 100644 --- a/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalKeyboardLayout.cs +++ b/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalKeyboardLayout.cs @@ -4,32 +4,14 @@ namespace RGB.NET.Devices.Corsair; /// -/// Contains a list of available physical layouts for corsair keyboards. +/// iCUE-SDK: Contains a list of available physical layouts for corsair keyboards. /// public enum CorsairPhysicalKeyboardLayout { - /// - /// US-Keyboard - /// + Invalid = 0, US = 1, - - /// - /// UK-Keyboard - /// UK = 2, - - /// - /// BR-Keyboard - /// - BR = 3, - - /// - /// JP-Keyboard - /// - JP = 4, - - /// - /// KR-Keyboard - /// - KR = 5 + JP = 3, + KR = 4, + BR = 5 } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalMouseLayout.cs b/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalMouseLayout.cs deleted file mode 100644 index 33c317c..0000000 --- a/RGB.NET.Devices.Corsair/Enum/CorsairPhysicalMouseLayout.cs +++ /dev/null @@ -1,107 +0,0 @@ -namespace RGB.NET.Devices.Corsair; - -/// -/// Contains a list of available physical layouts for mice. -/// -public enum CorsairPhysicalMouseLayout -{ - /// - /// Zone1-Mouse - /// - Zones1 = 6, - - /// - /// Zone2-Mouse - /// - Zones2 = 7, - - /// - /// Zone3-Mouse - /// - Zones3 = 8, - - /// - /// Zone4-Mouse - /// - Zones4 = 9, - - /// - /// Zone5-Mouse - /// - Zones5 = 101, - - /// - /// Zone6-Mouse - /// - Zones6 = 11, - - /// - /// Zone7-Mouse - /// - Zones7 = 12, - - /// - /// Zone8-Mouse - /// - Zones8 = 13, - - /// - /// Zone9-Mouse - /// - Zones9 = 14, - - /// - /// Zone10-Mouse - /// - Zones10 = 15, - - /// - /// Zone11-Mouse - /// - Zones11 = 16, - - /// - /// Zone12-Mouse - /// - Zones12 = 17, - - /// - /// Zone13-Mouse - /// - Zones13 = 18, - - /// - /// Zone14-Mouse - /// - Zones14 = 19, - - /// - /// Zone15-Mouse - /// - Zones15 = 20, - - /// - /// Zone16-Mouse - /// - Zones16 = 21, - - /// - /// Zone17-Mouse - /// - Zones17 = 22, - - /// - /// Zone18-Mouse - /// - Zones18 = 23, - - /// - /// Zone19-Mouse - /// - Zones19 = 24, - - /// - /// Zone20-Mouse - /// - Zones20 = 25 -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairPropertyFlag.cs b/RGB.NET.Devices.Corsair/Enum/CorsairPropertyFlag.cs new file mode 100644 index 0000000..f0e4506 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairPropertyFlag.cs @@ -0,0 +1,30 @@ +using System; + +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains list of operations that can be applied to the property +/// +[Flags] +public enum CorsairPropertyFlag +{ + /// + /// - + /// + None = 0x00, + + /// + /// iCUE-SDK: describes readable property + /// + CanRead = 0x01, + + /// + /// iCUE-SDK: describes writable property + /// + CanWrite = 0x02, + + /// + /// iCUE-SDK: if flag is set, then index should be used to read/write multiple properties that share the same property identifier + /// + Indexed = 0x04 +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Enum/CorsairSessionState.cs b/RGB.NET.Devices.Corsair/Enum/CorsairSessionState.cs new file mode 100644 index 0000000..c78dce1 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Enum/CorsairSessionState.cs @@ -0,0 +1,45 @@ +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global + +namespace RGB.NET.Devices.Corsair; + +/// +/// iCUE-SDK: contains a list of all possible session states +/// +public enum CorsairSessionState +{ + /// + /// iCUE-SDK: dummy value + /// + Invalid = 0, + + /// + /// iCUE-SDK: client not initialized or client closed connection (initial state) + /// + Closed = 1, + + /// + /// iCUE-SDK: client initiated connection but not connected yet + /// + Connecting = 2, + + /// + /// iCUE-SDK: server did not respond, sdk will try again + /// + Timeout = 3, + + /// + /// iCUE-SDK: server did not allow connection + /// + ConnectionRefused = 4, + + /// + /// iCUE-SDK: server closed connection + /// + ConnectionLost = 5, + + /// + /// iCUE-SDK: successfully connected + /// + Connected = 6 +}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs new file mode 100644 index 0000000..6520081 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDevice.cs @@ -0,0 +1,34 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using System.Collections.Generic; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a corsair fan. +/// +public class CorsairFanRGBDevice : CorsairRGBDevice, IFan +{ + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by CUE for the fan. + /// The queue used to update this device. + internal CorsairFanRGBDevice(CorsairFanRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) + : base(info, updateQueue) + { } + + #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateFanMapping(ids); + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs new file mode 100644 index 0000000..f4973c5 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Fan/CorsairFanRGBDeviceInfo.cs @@ -0,0 +1,28 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using RGB.NET.Devices.Corsair.Native; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a generic information for a . +/// +public class CorsairFanRGBDeviceInfo : CorsairRGBDeviceInfo +{ + #region Constructors + + /// + internal CorsairFanRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Fan, nativeInfo, ledCount, ledOffset) + { } + + /// + internal CorsairFanRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset, string modelName) + : base(RGBDeviceType.Fan, nativeInfo, ledCount, ledOffset, modelName) + { } + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs index 408e907..1d42dc2 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairDeviceUpdateQueue.cs @@ -13,7 +13,8 @@ public class CorsairDeviceUpdateQueue : UpdateQueue { #region Properties & Fields - private int _deviceIndex; + private readonly _CorsairDeviceInfo _device; + private readonly nint _colorPtr; #endregion @@ -24,10 +25,12 @@ public class CorsairDeviceUpdateQueue : UpdateQueue /// /// The update trigger used by this queue. /// The index used to identify the device. - public CorsairDeviceUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceIndex) + internal CorsairDeviceUpdateQueue(IDeviceUpdateTrigger updateTrigger, _CorsairDeviceInfo device) : base(updateTrigger) { - this._deviceIndex = deviceIndex; + this._device = device; + + _colorPtr = Marshal.AllocHGlobal(Marshal.SizeOf<_CorsairLedColor>() * device.ledCount); } #endregion @@ -35,28 +38,29 @@ public class CorsairDeviceUpdateQueue : UpdateQueue #region Methods /// - protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet) + protected override unsafe void Update(in ReadOnlySpan<(object key, Color color)> dataSet) { - int structSize = Marshal.SizeOf(typeof(_CorsairLedColor)); - IntPtr ptr = Marshal.AllocHGlobal(structSize * dataSet.Length); - IntPtr addPtr = new(ptr.ToInt64()); - foreach ((object key, Color color) in dataSet) + Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length); + for (int i = 0; i < colors.Length; i++) { - _CorsairLedColor corsairColor = new() - { - ledId = (int)key, - r = color.GetR(), - g = color.GetG(), - b = color.GetB() - }; - - Marshal.StructureToPtr(corsairColor, addPtr, false); - addPtr = new IntPtr(addPtr.ToInt64() + structSize); + (object id, Color color) = dataSet[i]; + (byte a, byte r, byte g, byte b) = color.GetRGBBytes(); + colors[i] = new _CorsairLedColor((CorsairLedId)id, r, g, b, a); } - _CUESDK.CorsairSetLedsColorsBufferByDeviceIndex(_deviceIndex, dataSet.Length, ptr); - _CUESDK.CorsairSetLedsColorsFlushBuffer(); - Marshal.FreeHGlobal(ptr); + CorsairError error = _CUESDK.CorsairSetLedColors(_device.id!, dataSet.Length, _colorPtr); + if (error != CorsairError.Success) + throw new RGBDeviceException($"Failed to update device '{_device.id}'. (ErrorCode: {error})"); + } + + /// + public override void Dispose() + { + base.Dispose(); + + Marshal.FreeHGlobal(_colorPtr); + + GC.SuppressFinalize(this); } #endregion diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairLedId.cs b/RGB.NET.Devices.Corsair/Generic/CorsairLedId.cs new file mode 100644 index 0000000..e8c5c5b --- /dev/null +++ b/RGB.NET.Devices.Corsair/Generic/CorsairLedId.cs @@ -0,0 +1,54 @@ +using System; +using System.Runtime.InteropServices; + +namespace RGB.NET.Devices.Corsair; + +[StructLayout(LayoutKind.Sequential)] +public readonly struct CorsairLedId : IComparable, IEquatable +{ + #region Properties & Fields + + public readonly uint Id; + + public CorsairLedGroup Group => (CorsairLedGroup)(Id >> 16); + public uint Index => Id & 0x0000FFFF; + + #endregion + + #region Constructors + + public CorsairLedId(uint id) + { + this.Id = id; + } + + public CorsairLedId(CorsairLedGroup group, CorsairLedIdKeyboard id) + : this(group, (int)id) + { } + + public CorsairLedId(CorsairLedGroup group, int index) + { + Id = (((uint)group) << 16) | (uint)index; + } + + #endregion + + #region Methods + + public int CompareTo(CorsairLedId other) => Id.CompareTo(other.Id); + + public bool Equals(CorsairLedId other) => Id == other.Id; + + public override bool Equals(object? obj) => obj is CorsairLedId other && Equals(other); + + public override int GetHashCode() => Id.GetHashCode(); + + public static bool operator ==(CorsairLedId left, CorsairLedId right) => left.Id == right.Id; + public static bool operator !=(CorsairLedId left, CorsairLedId right) => !(left == right); + public static bool operator <(CorsairLedId left, CorsairLedId right) => left.Id < right.Id; + public static bool operator <=(CorsairLedId left, CorsairLedId right) => left.Id <= right.Id; + public static bool operator >(CorsairLedId left, CorsairLedId right) => left.Id > right.Id; + public static bool operator >=(CorsairLedId left, CorsairLedId right) => left.Id >= right.Id; + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs b/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs deleted file mode 100644 index e764e08..0000000 --- a/RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs +++ /dev/null @@ -1,65 +0,0 @@ -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedAutoPropertyAccessor.Global - -using System; -using System.Runtime.InteropServices; -using RGB.NET.Devices.Corsair.Native; - -namespace RGB.NET.Devices.Corsair; - -/// -/// Managed wrapper for CorsairProtocolDetails. -/// -public class CorsairProtocolDetails -{ - #region Properties & Fields - - /// - /// String containing version of SDK(like "1.0.0.1"). - /// Always contains valid value even if there was no CUE found. - /// - public string? SdkVersion { get; } - - /// - /// String containing version of CUE(like "1.0.0.1") or NULL if CUE was not found. - /// - public string? ServerVersion { get; } - - /// - /// Integer that specifies version of protocol that is implemented by current SDK. - /// Numbering starts from 1. - /// Always contains valid value even if there was no CUE found. - /// - public int SdkProtocolVersion { get; } - - /// - /// Integer that specifies version of protocol that is implemented by CUE. - /// Numbering starts from 1. - /// If CUE was not found then this value will be 0. - /// - public int ServerProtocolVersion { get; } - - /// - /// Boolean that specifies if there were breaking changes between version of protocol implemented by server and client. - /// - public bool BreakingChanges { get; } - - #endregion - - #region Constructors - - /// - /// Internal constructor of managed CorsairProtocolDetails. - /// - /// The native CorsairProtocolDetails-struct - internal CorsairProtocolDetails(_CorsairProtocolDetails nativeDetails) - { - this.SdkVersion = nativeDetails.sdkVersion == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeDetails.sdkVersion); - this.ServerVersion = nativeDetails.serverVersion == IntPtr.Zero ? null : Marshal.PtrToStringAnsi(nativeDetails.serverVersion); - this.SdkProtocolVersion = nativeDetails.sdkProtocolVersion; - this.ServerProtocolVersion = nativeDetails.serverProtocolVersion; - this.BreakingChanges = nativeDetails.breakingChanges != 0; - } - - #endregion -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs index 57912a5..94fd49c 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDevice.cs @@ -1,5 +1,5 @@ -using System; -using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Linq; using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; @@ -17,7 +17,7 @@ public abstract class CorsairRGBDevice : AbstractRGBDevice /// Gets the mapping of to used to update the LEDs of this device. /// - protected LedMapping Mapping { get; } + protected LedMapping Mapping { get; private set; } = LedMapping.Empty; #endregion @@ -29,48 +29,41 @@ public abstract class CorsairRGBDevice : AbstractRGBDeviceThe generic information provided by CUE for the device. /// The mapping to used to update the LEDs of this device. /// The queue used to update this device. - protected CorsairRGBDevice(TDeviceInfo info, LedMapping mapping, CorsairDeviceUpdateQueue updateQueue) + protected CorsairRGBDevice(TDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) : base(info, updateQueue) - { - this.Mapping = mapping; - } + { } #endregion #region Methods void ICorsairRGBDevice.Initialize() => InitializeLayout(); - + /// /// Initializes the LEDs of the device based on the data provided by the SDK. /// protected virtual void InitializeLayout() { - _CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions)); - if (nativeLedPositions == null) return; + CorsairError error = _CUESDK.CorsairGetLedPositions(DeviceInfo.DeviceId, out _CorsairLedPosition[] ledPositions); + if (error != CorsairError.Success) + throw new RGBDeviceException($"Failed to load device '{DeviceInfo.DeviceId}'. (ErrorCode: {error})"); - int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition)); - IntPtr ptr = nativeLedPositions.pLedPosition; + List<_CorsairLedPosition> deviceLeds = ledPositions.Skip(DeviceInfo.LedOffset).Take(DeviceInfo.LedCount).ToList(); - for (int i = 0; i < nativeLedPositions.numberOfLed; i++) + Mapping = CreateMapping(deviceLeds.Select(x => new CorsairLedId(x.id))); + + foreach (_CorsairLedPosition ledPosition in deviceLeds) { - _CorsairLedPosition? ledPosition = (_CorsairLedPosition?)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition)); - if (ledPosition == null) - { - ptr = new IntPtr(ptr.ToInt64() + structSize); - continue; - } - - LedId ledId = Mapping.TryGetValue(ledPosition.LedId, out LedId id) ? id : LedId.Invalid; + LedId ledId = Mapping.TryGetValue(new CorsairLedId(ledPosition.id), out LedId id) ? id : LedId.Invalid; Rectangle rectangle = ledPosition.ToRectangle(); AddLed(ledId, rectangle.Location, rectangle.Size); - - ptr = new IntPtr(ptr.ToInt64() + structSize); } } + protected abstract LedMapping CreateMapping(IEnumerable ids); + /// - protected override object GetLedCustomData(LedId ledId) => Mapping.TryGetValue(ledId, out CorsairLedId corsairLedId) ? corsairLedId : CorsairLedId.Invalid; + protected override object GetLedCustomData(LedId ledId) => Mapping.TryGetValue(ledId, out CorsairLedId corsairLedId) ? corsairLedId : new CorsairLedId(0); #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs index 27c882d..6137b95 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs @@ -1,6 +1,4 @@ -using System; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; +using System.Text.RegularExpressions; using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; @@ -19,11 +17,6 @@ public class CorsairRGBDeviceInfo : IRGBDeviceInfo /// public CorsairDeviceType CorsairDeviceType { get; } - /// - /// Gets the index of the . - /// - public int CorsairDeviceIndex { get; } - /// public RGBDeviceType DeviceType { get; } @@ -44,11 +37,16 @@ public class CorsairRGBDeviceInfo : IRGBDeviceInfo /// public object? LayoutMetadata { get; set; } + + /// + /// Gets the amount of LEDs this device contains. + /// + public int LedCount { get; } /// - /// Gets a flag that describes device capabilities. () + /// Gets the offset used to access the LEDs of this device. /// - public CorsairDeviceCaps CapsMask { get; } + internal int LedOffset { get; } #endregion @@ -60,14 +58,14 @@ public class CorsairRGBDeviceInfo : IRGBDeviceInfo /// The index of the . /// The type of the . /// The native -struct - internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo) + internal CorsairRGBDeviceInfo(RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) { - this.CorsairDeviceIndex = deviceIndex; this.DeviceType = deviceType; this.CorsairDeviceType = nativeInfo.type; - this.Model = nativeInfo.model == IntPtr.Zero ? string.Empty : Regex.Replace(Marshal.PtrToStringAnsi(nativeInfo.model) ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase); - this.DeviceId = nativeInfo.deviceId ?? string.Empty; - this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; + this.Model = nativeInfo.model == null ? string.Empty : Regex.Replace(nativeInfo.model ?? string.Empty, " ?DEMO", string.Empty, RegexOptions.IgnoreCase); + this.DeviceId = nativeInfo.id ?? string.Empty; + this.LedCount = ledCount; + this.LedOffset = ledOffset; DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model); } @@ -79,14 +77,14 @@ public class CorsairRGBDeviceInfo : IRGBDeviceInfo /// The type of the . /// The native -struct /// The name of the device-model (overwrites the one provided with the device info). - internal CorsairRGBDeviceInfo(int deviceIndex, RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, string modelName) + internal CorsairRGBDeviceInfo(RGBDeviceType deviceType, _CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset, string modelName) { - this.CorsairDeviceIndex = deviceIndex; this.DeviceType = deviceType; this.CorsairDeviceType = nativeInfo.type; this.Model = modelName; - this.DeviceId = nativeInfo.deviceId ?? string.Empty; - this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask; + this.DeviceId = nativeInfo.id ?? string.Empty; + this.LedCount = ledCount; + this.LedOffset = ledOffset; DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model); } diff --git a/RGB.NET.Devices.Corsair/Generic/LedMappings.cs b/RGB.NET.Devices.Corsair/Generic/LedMappings.cs index 911e58f..8166070 100644 --- a/RGB.NET.Devices.Corsair/Generic/LedMappings.cs +++ b/RGB.NET.Devices.Corsair/Generic/LedMappings.cs @@ -1,302 +1,210 @@ -using RGB.NET.Core; +using System.Collections.Generic; +using System.Linq; +using RGB.NET.Core; namespace RGB.NET.Devices.Corsair; /// /// Contains mappings for to . /// -public static class LedMappings +internal static class LedMappings { - static LedMappings() + #region Constants + + private static LedMapping KEYBOARD_MAPPING => new() { - for (int i = 0; i <= (CorsairLedId.GPU50 - CorsairLedId.GPU1); i++) - GraphicsCard.Add(LedId.GraphicsCard1 + i, CorsairLedId.GPU1 + i); + { LedId.Invalid, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Invalid) }, + { LedId.Keyboard_Escape, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Escape) }, + { LedId.Keyboard_F1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F1) }, + { LedId.Keyboard_F2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F2) }, + { LedId.Keyboard_F3, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F3) }, + { LedId.Keyboard_F4, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F4) }, + { LedId.Keyboard_F5, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F5) }, + { LedId.Keyboard_F6, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F6) }, + { LedId.Keyboard_F7, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F7) }, + { LedId.Keyboard_F8, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F8) }, + { LedId.Keyboard_F9, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F9) }, + { LedId.Keyboard_F10, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F10) }, + { LedId.Keyboard_F11, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F11) }, + { LedId.Keyboard_GraveAccentAndTilde, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.GraveAccentAndTilde) }, + { LedId.Keyboard_1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.One) }, + { LedId.Keyboard_2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Two) }, + { LedId.Keyboard_3, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Three) }, + { LedId.Keyboard_4, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Four) }, + { LedId.Keyboard_5, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Five) }, + { LedId.Keyboard_6, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Six) }, + { LedId.Keyboard_7, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Seven) }, + { LedId.Keyboard_8, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Eight) }, + { LedId.Keyboard_9, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Nine) }, + { LedId.Keyboard_0, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Zero) }, + { LedId.Keyboard_MinusAndUnderscore, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.MinusAndUnderscore) }, + { LedId.Keyboard_Tab, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Tab) }, + { LedId.Keyboard_Q, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Q) }, + { LedId.Keyboard_W, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.W) }, + { LedId.Keyboard_E, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.E) }, + { LedId.Keyboard_R, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.R) }, + { LedId.Keyboard_T, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.T) }, + { LedId.Keyboard_Y, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Y) }, + { LedId.Keyboard_U, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.U) }, + { LedId.Keyboard_I, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.I) }, + { LedId.Keyboard_O, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.O) }, + { LedId.Keyboard_P, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.P) }, + { LedId.Keyboard_BracketLeft, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.BracketLeft) }, + { LedId.Keyboard_CapsLock, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.CapsLock) }, + { LedId.Keyboard_A, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.A) }, + { LedId.Keyboard_S, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.S) }, + { LedId.Keyboard_D, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.D) }, + { LedId.Keyboard_F, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F) }, + { LedId.Keyboard_G, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.G) }, + { LedId.Keyboard_H, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.H) }, + { LedId.Keyboard_J, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.J) }, + { LedId.Keyboard_K, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.K) }, + { LedId.Keyboard_L, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.L) }, + { LedId.Keyboard_SemicolonAndColon, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.SemicolonAndColon) }, + { LedId.Keyboard_ApostropheAndDoubleQuote, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.ApostropheAndDoubleQuote) }, + { LedId.Keyboard_LeftShift, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LeftShift) }, + { LedId.Keyboard_NonUsBackslash, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.NonUsBackslash) }, + { LedId.Keyboard_Z, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Z) }, + { LedId.Keyboard_X, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.X) }, + { LedId.Keyboard_C, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.C) }, + { LedId.Keyboard_V, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.V) }, + { LedId.Keyboard_B, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.B) }, + { LedId.Keyboard_N, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.N) }, + { LedId.Keyboard_M, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.M) }, + { LedId.Keyboard_CommaAndLessThan, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.CommaAndLessThan) }, + { LedId.Keyboard_PeriodAndBiggerThan, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PeriodAndBiggerThan) }, + { LedId.Keyboard_SlashAndQuestionMark, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.SlashAndQuestionMark) }, + { LedId.Keyboard_LeftCtrl, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LeftCtrl) }, + { LedId.Keyboard_LeftGui, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LeftGui) }, + { LedId.Keyboard_LeftAlt, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LeftAlt) }, + { LedId.Keyboard_Lang2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Lang2) }, + { LedId.Keyboard_Space, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Space) }, + { LedId.Keyboard_Lang1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Lang1) }, + { LedId.Keyboard_International2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.International2) }, + { LedId.Keyboard_RightAlt, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.RightAlt) }, + { LedId.Keyboard_RightGui, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.RightGui) }, + { LedId.Keyboard_Application, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Application) }, + { LedId.Keyboard_Brightness, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Brightness) }, + { LedId.Keyboard_F12, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.F12) }, + { LedId.Keyboard_PrintScreen, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PrintScreen) }, + { LedId.Keyboard_ScrollLock, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.ScrollLock) }, + { LedId.Keyboard_PauseBreak, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PauseBreak) }, + { LedId.Keyboard_Insert, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Insert) }, + { LedId.Keyboard_Home, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Home) }, + { LedId.Keyboard_PageUp, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PageUp) }, + { LedId.Keyboard_BracketRight, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.BracketRight) }, + { LedId.Keyboard_Backslash, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Backslash) }, + { LedId.Keyboard_NonUsTilde, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.NonUsTilde) }, + { LedId.Keyboard_Enter, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Enter) }, + { LedId.Keyboard_International1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.International1) }, + { LedId.Keyboard_EqualsAndPlus, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.EqualsAndPlus) }, + { LedId.Keyboard_International3, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.International3) }, + { LedId.Keyboard_Backspace, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Backspace) }, + { LedId.Keyboard_Delete, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Delete) }, + { LedId.Keyboard_End, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.End) }, + { LedId.Keyboard_PageDown, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PageDown) }, + { LedId.Keyboard_RightShift, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.RightShift) }, + { LedId.Keyboard_RightCtrl, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.RightCtrl) }, + { LedId.Keyboard_ArrowUp, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.UpArrow) }, + { LedId.Keyboard_ArrowLeft, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LeftArrow) }, + { LedId.Keyboard_ArrowDown, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.DownArrow) }, + { LedId.Keyboard_ArrowRight, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.RightArrow) }, + { LedId.Keyboard_WinLock, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.WinLock) }, + { LedId.Keyboard_MediaMute, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Mute) }, + { LedId.Keyboard_MediaStop, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Stop) }, + { LedId.Keyboard_MediaPreviousTrack, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.ScanPreviousTrack) }, + { LedId.Keyboard_MediaPlay, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.PlayPause) }, + { LedId.Keyboard_MediaNextTrack, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.ScanNextTrack) }, + { LedId.Keyboard_NumLock, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.NumLock) }, + { LedId.Keyboard_NumSlash, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadSlash) }, + { LedId.Keyboard_NumAsterisk, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadAsterisk) }, + { LedId.Keyboard_NumMinus, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadMinus) }, + { LedId.Keyboard_NumPlus, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadPlus) }, + { LedId.Keyboard_NumEnter, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadEnter) }, + { LedId.Keyboard_Num7, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad7) }, + { LedId.Keyboard_Num8, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad8) }, + { LedId.Keyboard_Num9, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad9) }, + { LedId.Keyboard_NumComma, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadComma) }, + { LedId.Keyboard_Num4, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad4) }, + { LedId.Keyboard_Num5, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad5) }, + { LedId.Keyboard_Num6, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad6) }, + { LedId.Keyboard_Num1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad1) }, + { LedId.Keyboard_Num2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad2) }, + { LedId.Keyboard_Num3, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad3) }, + { LedId.Keyboard_Num0, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Keypad0) }, + { LedId.Keyboard_NumPeriodAndDelete, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.KeypadPeriodAndDelete) }, + { LedId.Keyboard_MediaVolumeUp, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.VolumeUp) }, + { LedId.Keyboard_MediaVolumeDown, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.VolumeDown) }, + { LedId.Keyboard_MacroRecording, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.MR) }, + { LedId.Keyboard_Macro1, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.M1) }, + { LedId.Keyboard_Macro2, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.M2) }, + { LedId.Keyboard_Macro3, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.M3) }, + { LedId.Keyboard_International5, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.International5) }, + { LedId.Keyboard_International4, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.International4) }, + { LedId.Keyboard_LedProgramming, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.LedProgramming) }, + { LedId.Keyboard_Function, new CorsairLedId(CorsairLedGroup.Keyboard, CorsairLedIdKeyboard.Fn) } + }; - for (int i = 0; i <= (CorsairLedId.HeadsetStandZone9 - CorsairLedId.HeadsetStandZone1); i++) - HeadsetStand.Add(LedId.HeadsetStand1 + i, CorsairLedId.HeadsetStandZone1 + i); + #endregion - for (int i = 0; i <= (CorsairLedId.Mainboard100 - CorsairLedId.Mainboard1); i++) - Mainboard.Add(LedId.Mainboard1 + i, CorsairLedId.Mainboard1 + i); + #region Methods - for (int i = 0; i <= (CorsairLedId.DRAM12 - CorsairLedId.DRAM1); i++) - Memory.Add(LedId.DRAM1 + i, CorsairLedId.DRAM1 + i); + internal static LedMapping CreateFanMapping(IEnumerable ids) => CreateMapping(ids, LedId.Fan1); + internal static LedMapping CreateCoolerMapping(IEnumerable ids) => CreateMapping(ids, LedId.Cooler1); + internal static LedMapping CreateLedStripMapping(IEnumerable ids) => CreateMapping(ids, LedId.LedStripe1); + internal static LedMapping CreateGraphicsCardMapping(IEnumerable ids) => CreateMapping(ids, LedId.GraphicsCard1); + internal static LedMapping CreateHeadsetStandMapping(IEnumerable ids) => CreateMapping(ids, LedId.HeadsetStand1); + internal static LedMapping CreateMainboardMapping(IEnumerable ids) => CreateMapping(ids, LedId.Mainboard1); + internal static LedMapping CreateMemoryMapping(IEnumerable ids) => CreateMapping(ids, LedId.DRAM1); + internal static LedMapping CreateMousepadMapping(IEnumerable ids) => CreateMapping(ids, LedId.Mousepad1); + internal static LedMapping CreateHeadsetMapping(IEnumerable ids) => CreateMapping(ids, LedId.Headset1); + internal static LedMapping CreateMouseMapping(IEnumerable ids) => CreateMapping(ids, LedId.Mouse1); + internal static LedMapping CreateUnknownMapping(IEnumerable ids) => CreateMapping(ids, LedId.Unknown1); - for (int i = 0; i <= (CorsairLedId.Zone15 - CorsairLedId.Zone1); i++) - Mousepad.Add(LedId.Mousepad1 + i, CorsairLedId.Zone1 + i); + internal static LedMapping CreateMapping(IEnumerable ids, LedId referenceId) + { + LedMapping mapping = new(); + int counter = 0; + foreach (CorsairLedId corsairLedId in ids.OrderBy(x => x)) + mapping.Add(referenceId + counter++, corsairLedId); - for (int i = 0; i <= (CorsairLedId.OemLed100 - CorsairLedId.OemLed1); i++) - Keyboard.Add(LedId.Custom1 + i, CorsairLedId.OemLed1 + i); - - for (int i = 0; i <= (CorsairLedId.OemLed250 - CorsairLedId.OemLed101); i++) - Keyboard.Add(LedId.Custom101 + i, CorsairLedId.OemLed101 + i); + return mapping; } - /// - /// Gets the mapping for graphics cards. - /// - public static LedMapping GraphicsCard { get; } = new(); - - /// - /// Gets the mapping for headsets. - /// - public static LedMapping HeadsetStand { get; } = new(); - - /// - /// Gets the mapping for mainboards. - /// - public static LedMapping Mainboard { get; } = new(); - - /// - /// Gets the mapping for memory. - /// - public static LedMapping Memory { get; } = new(); - - /// - /// Gets the mapping for mousepads. - /// - public static LedMapping Mousepad { get; } = new(); - - /// - /// Gets the mapping for headsets. - /// - public static LedMapping Headset { get; } = new() + internal static LedMapping CreateKeyboardMapping(IEnumerable ids) { - { LedId.Headset1, CorsairLedId.LeftLogo }, - { LedId.Headset2, CorsairLedId.RightLogo }, - }; + Dictionary groupCounter = new() + { + [CorsairLedGroup.KeyboardOem] = 0, + [CorsairLedGroup.KeyboardGKeys] = 0, + [CorsairLedGroup.KeyboardEdge] = 0, + [CorsairLedGroup.Keyboard] = 0 // Workaround for unknown keys + }; - /// - /// Gets the mapping for mice. - /// - public static LedMapping Mouse { get; } = new() - { - { LedId.Mouse1, CorsairLedId.B1 }, - { LedId.Mouse2, CorsairLedId.B2 }, - { LedId.Mouse3, CorsairLedId.B3 }, - { LedId.Mouse4, CorsairLedId.B4 }, - { LedId.Mouse5, CorsairLedId.B5 }, - { LedId.Mouse6, CorsairLedId.B6 }, - { LedId.Mouse7, CorsairLedId.B7 }, - { LedId.Mouse8, CorsairLedId.B8 }, - { LedId.Mouse9, CorsairLedId.B9 }, - { LedId.Mouse10, CorsairLedId.B10 }, - { LedId.Mouse11, CorsairLedId.B11 }, - { LedId.Mouse12, CorsairLedId.B12 }, - { LedId.Mouse13, CorsairLedId.B13 }, - { LedId.Mouse14, CorsairLedId.B14 }, - { LedId.Mouse15, CorsairLedId.B15 }, - { LedId.Mouse16, CorsairLedId.B16 }, - { LedId.Mouse17, CorsairLedId.B17 }, - { LedId.Mouse18, CorsairLedId.B18 }, - { LedId.Mouse19, CorsairLedId.B19 }, - { LedId.Mouse20, CorsairLedId.B20 }, - }; + LedMapping mapping = KEYBOARD_MAPPING; - /// - /// Gets the mapping for keyboards. - /// - public static LedMapping Keyboard { get; } = new() - { - { LedId.Invalid, CorsairLedId.Invalid }, - { LedId.Logo, CorsairLedId.Logo }, - { LedId.Keyboard_Escape, CorsairLedId.Escape }, - { LedId.Keyboard_F1, CorsairLedId.F1 }, - { LedId.Keyboard_F2, CorsairLedId.F2 }, - { LedId.Keyboard_F3, CorsairLedId.F3 }, - { LedId.Keyboard_F4, CorsairLedId.F4 }, - { LedId.Keyboard_F5, CorsairLedId.F5 }, - { LedId.Keyboard_F6, CorsairLedId.F6 }, - { LedId.Keyboard_F7, CorsairLedId.F7 }, - { LedId.Keyboard_F8, CorsairLedId.F8 }, - { LedId.Keyboard_F9, CorsairLedId.F9 }, - { LedId.Keyboard_F10, CorsairLedId.F10 }, - { LedId.Keyboard_F11, CorsairLedId.F11 }, - { LedId.Keyboard_GraveAccentAndTilde, CorsairLedId.GraveAccentAndTilde }, - { LedId.Keyboard_1, CorsairLedId.D1 }, - { LedId.Keyboard_2, CorsairLedId.D2 }, - { LedId.Keyboard_3, CorsairLedId.D3 }, - { LedId.Keyboard_4, CorsairLedId.D4 }, - { LedId.Keyboard_5, CorsairLedId.D5 }, - { LedId.Keyboard_6, CorsairLedId.D6 }, - { LedId.Keyboard_7, CorsairLedId.D7 }, - { LedId.Keyboard_8, CorsairLedId.D8 }, - { LedId.Keyboard_9, CorsairLedId.D9 }, - { LedId.Keyboard_0, CorsairLedId.D0 }, - { LedId.Keyboard_MinusAndUnderscore, CorsairLedId.MinusAndUnderscore }, - { LedId.Keyboard_Tab, CorsairLedId.Tab }, - { LedId.Keyboard_Q, CorsairLedId.Q }, - { LedId.Keyboard_W, CorsairLedId.W }, - { LedId.Keyboard_E, CorsairLedId.E }, - { LedId.Keyboard_R, CorsairLedId.R }, - { LedId.Keyboard_T, CorsairLedId.T }, - { LedId.Keyboard_Y, CorsairLedId.Y }, - { LedId.Keyboard_U, CorsairLedId.U }, - { LedId.Keyboard_I, CorsairLedId.I }, - { LedId.Keyboard_O, CorsairLedId.O }, - { LedId.Keyboard_P, CorsairLedId.P }, - { LedId.Keyboard_BracketLeft, CorsairLedId.BracketLeft }, - { LedId.Keyboard_CapsLock, CorsairLedId.CapsLock }, - { LedId.Keyboard_A, CorsairLedId.A }, - { LedId.Keyboard_S, CorsairLedId.S }, - { LedId.Keyboard_D, CorsairLedId.D }, - { LedId.Keyboard_F, CorsairLedId.F }, - { LedId.Keyboard_G, CorsairLedId.G }, - { LedId.Keyboard_H, CorsairLedId.H }, - { LedId.Keyboard_J, CorsairLedId.J }, - { LedId.Keyboard_K, CorsairLedId.K }, - { LedId.Keyboard_L, CorsairLedId.L }, - { LedId.Keyboard_SemicolonAndColon, CorsairLedId.SemicolonAndColon }, - { LedId.Keyboard_ApostropheAndDoubleQuote, CorsairLedId.ApostropheAndDoubleQuote }, - { LedId.Keyboard_LeftShift, CorsairLedId.LeftShift }, - { LedId.Keyboard_NonUsBackslash, CorsairLedId.NonUsBackslash }, - { LedId.Keyboard_Z, CorsairLedId.Z }, - { LedId.Keyboard_X, CorsairLedId.X }, - { LedId.Keyboard_C, CorsairLedId.C }, - { LedId.Keyboard_V, CorsairLedId.V }, - { LedId.Keyboard_B, CorsairLedId.B }, - { LedId.Keyboard_N, CorsairLedId.N }, - { LedId.Keyboard_M, CorsairLedId.M }, - { LedId.Keyboard_CommaAndLessThan, CorsairLedId.CommaAndLessThan }, - { LedId.Keyboard_PeriodAndBiggerThan, CorsairLedId.PeriodAndBiggerThan }, - { LedId.Keyboard_SlashAndQuestionMark, CorsairLedId.SlashAndQuestionMark }, - { LedId.Keyboard_LeftCtrl, CorsairLedId.LeftCtrl }, - { LedId.Keyboard_LeftGui, CorsairLedId.LeftGui }, - { LedId.Keyboard_LeftAlt, CorsairLedId.LeftAlt }, - { LedId.Keyboard_Lang2, CorsairLedId.Lang2 }, - { LedId.Keyboard_Space, CorsairLedId.Space }, - { LedId.Keyboard_Lang1, CorsairLedId.Lang1 }, - { LedId.Keyboard_International2, CorsairLedId.International2 }, - { LedId.Keyboard_RightAlt, CorsairLedId.RightAlt }, - { LedId.Keyboard_RightGui, CorsairLedId.RightGui }, - { LedId.Keyboard_Application, CorsairLedId.Application }, - { LedId.Keyboard_Brightness, CorsairLedId.Brightness }, - { LedId.Keyboard_F12, CorsairLedId.F12 }, - { LedId.Keyboard_PrintScreen, CorsairLedId.PrintScreen }, - { LedId.Keyboard_ScrollLock, CorsairLedId.ScrollLock }, - { LedId.Keyboard_PauseBreak, CorsairLedId.PauseBreak }, - { LedId.Keyboard_Insert, CorsairLedId.Insert }, - { LedId.Keyboard_Home, CorsairLedId.Home }, - { LedId.Keyboard_PageUp, CorsairLedId.PageUp }, - { LedId.Keyboard_BracketRight, CorsairLedId.BracketRight }, - { LedId.Keyboard_Backslash, CorsairLedId.Backslash }, - { LedId.Keyboard_NonUsTilde, CorsairLedId.NonUsTilde }, - { LedId.Keyboard_Enter, CorsairLedId.Enter }, - { LedId.Keyboard_International1, CorsairLedId.International1 }, - { LedId.Keyboard_EqualsAndPlus, CorsairLedId.EqualsAndPlus }, - { LedId.Keyboard_International3, CorsairLedId.International3 }, - { LedId.Keyboard_Backspace, CorsairLedId.Backspace }, - { LedId.Keyboard_Delete, CorsairLedId.Delete }, - { LedId.Keyboard_End, CorsairLedId.End }, - { LedId.Keyboard_PageDown, CorsairLedId.PageDown }, - { LedId.Keyboard_RightShift, CorsairLedId.RightShift }, - { LedId.Keyboard_RightCtrl, CorsairLedId.RightCtrl }, - { LedId.Keyboard_ArrowUp, CorsairLedId.UpArrow }, - { LedId.Keyboard_ArrowLeft, CorsairLedId.LeftArrow }, - { LedId.Keyboard_ArrowDown, CorsairLedId.DownArrow }, - { LedId.Keyboard_ArrowRight, CorsairLedId.RightArrow }, - { LedId.Keyboard_WinLock, CorsairLedId.WinLock }, - { LedId.Keyboard_MediaMute, CorsairLedId.Mute }, - { LedId.Keyboard_MediaStop, CorsairLedId.Stop }, - { LedId.Keyboard_MediaPreviousTrack, CorsairLedId.ScanPreviousTrack }, - { LedId.Keyboard_MediaPlay, CorsairLedId.PlayPause }, - { LedId.Keyboard_MediaNextTrack, CorsairLedId.ScanNextTrack }, - { LedId.Keyboard_NumLock, CorsairLedId.NumLock }, - { LedId.Keyboard_NumSlash, CorsairLedId.KeypadSlash }, - { LedId.Keyboard_NumAsterisk, CorsairLedId.KeypadAsterisk }, - { LedId.Keyboard_NumMinus, CorsairLedId.KeypadMinus }, - { LedId.Keyboard_NumPlus, CorsairLedId.KeypadPlus }, - { LedId.Keyboard_NumEnter, CorsairLedId.KeypadEnter }, - { LedId.Keyboard_Num7, CorsairLedId.Keypad7 }, - { LedId.Keyboard_Num8, CorsairLedId.Keypad8 }, - { LedId.Keyboard_Num9, CorsairLedId.Keypad9 }, - { LedId.Keyboard_NumComma, CorsairLedId.KeypadComma }, - { LedId.Keyboard_Num4, CorsairLedId.Keypad4 }, - { LedId.Keyboard_Num5, CorsairLedId.Keypad5 }, - { LedId.Keyboard_Num6, CorsairLedId.Keypad6 }, - { LedId.Keyboard_Num1, CorsairLedId.Keypad1 }, - { LedId.Keyboard_Num2, CorsairLedId.Keypad2 }, - { LedId.Keyboard_Num3, CorsairLedId.Keypad3 }, - { LedId.Keyboard_Num0, CorsairLedId.Keypad0 }, - { LedId.Keyboard_NumPeriodAndDelete, CorsairLedId.KeypadPeriodAndDelete }, - { LedId.Keyboard_Programmable1, CorsairLedId.G1 }, - { LedId.Keyboard_Programmable2, CorsairLedId.G2 }, - { LedId.Keyboard_Programmable3, CorsairLedId.G3 }, - { LedId.Keyboard_Programmable4, CorsairLedId.G4 }, - { LedId.Keyboard_Programmable5, CorsairLedId.G5 }, - { LedId.Keyboard_Programmable6, CorsairLedId.G6 }, - { LedId.Keyboard_Programmable7, CorsairLedId.G7 }, - { LedId.Keyboard_Programmable8, CorsairLedId.G8 }, - { LedId.Keyboard_Programmable9, CorsairLedId.G9 }, - { LedId.Keyboard_Programmable10, CorsairLedId.G10 }, - { LedId.Keyboard_MediaVolumeUp, CorsairLedId.VolumeUp }, - { LedId.Keyboard_MediaVolumeDown, CorsairLedId.VolumeDown }, - { LedId.Keyboard_MacroRecording, CorsairLedId.MR }, - { LedId.Keyboard_Macro1, CorsairLedId.M1 }, - { LedId.Keyboard_Macro2, CorsairLedId.M2 }, - { LedId.Keyboard_Macro3, CorsairLedId.M3 }, - { LedId.Keyboard_Programmable11, CorsairLedId.G11 }, - { LedId.Keyboard_Programmable12, CorsairLedId.G12 }, - { LedId.Keyboard_Programmable13, CorsairLedId.G13 }, - { LedId.Keyboard_Programmable14, CorsairLedId.G14 }, - { LedId.Keyboard_Programmable15, CorsairLedId.G15 }, - { LedId.Keyboard_Programmable16, CorsairLedId.G16 }, - { LedId.Keyboard_Programmable17, CorsairLedId.G17 }, - { LedId.Keyboard_Programmable18, CorsairLedId.G18 }, - { LedId.Keyboard_International5, CorsairLedId.International5 }, - { LedId.Keyboard_International4, CorsairLedId.International4 }, - { LedId.Keyboard_Profile, CorsairLedId.Profile }, - { LedId.Keyboard_LedProgramming, CorsairLedId.LedProgramming }, - { LedId.Keyboard_Function, CorsairLedId.Fn }, + foreach (CorsairLedId corsairLedId in ids.OrderBy(x => x).Where(x => x.Group != CorsairLedGroup.Keyboard)) + switch (corsairLedId.Group) + { + case CorsairLedGroup.KeyboardOem: + mapping.Add(LedId.Keyboard_Custom1 + groupCounter[CorsairLedGroup.KeyboardOem]++, corsairLedId); + break; - { LedId.LedStripe1, CorsairLedId.Lightbar1 }, - { LedId.LedStripe2, CorsairLedId.Lightbar2 }, - { LedId.LedStripe3, CorsairLedId.Lightbar3 }, - { LedId.LedStripe4, CorsairLedId.Lightbar4 }, - { LedId.LedStripe5, CorsairLedId.Lightbar5 }, - { LedId.LedStripe6, CorsairLedId.Lightbar6 }, - { LedId.LedStripe7, CorsairLedId.Lightbar7 }, - { LedId.LedStripe8, CorsairLedId.Lightbar8 }, - { LedId.LedStripe9, CorsairLedId.Lightbar9 }, - { LedId.LedStripe10, CorsairLedId.Lightbar10 }, - { LedId.LedStripe11, CorsairLedId.Lightbar11 }, - { LedId.LedStripe12, CorsairLedId.Lightbar12 }, - { LedId.LedStripe13, CorsairLedId.Lightbar13 }, - { LedId.LedStripe14, CorsairLedId.Lightbar14 }, - { LedId.LedStripe15, CorsairLedId.Lightbar15 }, - { LedId.LedStripe16, CorsairLedId.Lightbar16 }, - { LedId.LedStripe17, CorsairLedId.Lightbar17 }, - { LedId.LedStripe18, CorsairLedId.Lightbar18 }, - { LedId.LedStripe19, CorsairLedId.Lightbar19 }, - { LedId.LedStripe20, CorsairLedId.Lightbar20 }, - { LedId.LedStripe21, CorsairLedId.Lightbar21 }, - { LedId.LedStripe22, CorsairLedId.Lightbar22 }, - { LedId.LedStripe23, CorsairLedId.Lightbar23 }, - { LedId.LedStripe24, CorsairLedId.Lightbar24 }, - { LedId.LedStripe25, CorsairLedId.Lightbar25 }, - { LedId.LedStripe26, CorsairLedId.Lightbar26 }, - { LedId.LedStripe27, CorsairLedId.Lightbar27 }, - { LedId.LedStripe28, CorsairLedId.Lightbar28 }, - { LedId.LedStripe29, CorsairLedId.Lightbar29 }, - { LedId.LedStripe30, CorsairLedId.Lightbar30 }, - { LedId.LedStripe31, CorsairLedId.Lightbar31 }, - { LedId.LedStripe32, CorsairLedId.Lightbar32 }, - { LedId.LedStripe33, CorsairLedId.Lightbar33 }, - { LedId.LedStripe34, CorsairLedId.Lightbar34 }, - { LedId.LedStripe35, CorsairLedId.Lightbar35 }, - { LedId.LedStripe36, CorsairLedId.Lightbar36 }, - { LedId.LedStripe37, CorsairLedId.Lightbar37 }, - { LedId.LedStripe38, CorsairLedId.Lightbar38 }, - { LedId.LedStripe39, CorsairLedId.Lightbar39 }, - { LedId.LedStripe40, CorsairLedId.Lightbar40 }, - { LedId.LedStripe41, CorsairLedId.Lightbar41 }, - { LedId.LedStripe42, CorsairLedId.Lightbar42 }, - { LedId.LedStripe43, CorsairLedId.Lightbar43 }, - { LedId.LedStripe44, CorsairLedId.Lightbar44 }, - { LedId.LedStripe45, CorsairLedId.Lightbar45 }, - { LedId.LedStripe46, CorsairLedId.Lightbar46 }, - { LedId.LedStripe47, CorsairLedId.Lightbar47 }, - { LedId.LedStripe48, CorsairLedId.Lightbar48 }, - { LedId.LedStripe49, CorsairLedId.Lightbar49 }, - { LedId.LedStripe50, CorsairLedId.Lightbar50 }, - }; + case CorsairLedGroup.KeyboardGKeys: + mapping.Add(LedId.Keyboard_Programmable1 + groupCounter[CorsairLedGroup.KeyboardGKeys]++, corsairLedId); + break; + + case CorsairLedGroup.KeyboardEdge: + mapping.Add(LedId.LedStripe1 + groupCounter[CorsairLedGroup.KeyboardEdge]++, corsairLedId); + break; + + default: + mapping.Add(LedId.Unknown1 + groupCounter[CorsairLedGroup.Keyboard]++, corsairLedId); + break; + } + + return mapping; + } + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs index b1238c1..ce7fb8c 100644 --- a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDevice.cs @@ -1,6 +1,7 @@ // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global +using System.Collections.Generic; using RGB.NET.Core; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairGraphicsCardRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the graphics card. /// The queue used to update this device. internal CorsairGraphicsCardRGBDevice(CorsairGraphicsCardRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.GraphicsCard, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateGraphicsCardMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs index d58120c..ec5b436 100644 --- a/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/GraphicsCard/CorsairGraphicsCardRGBDeviceInfo.cs @@ -15,13 +15,8 @@ public class CorsairGraphicsCardRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairGraphicsCardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.GraphicsCard, nativeInfo) + internal CorsairGraphicsCardRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.GraphicsCard, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs index f52d548..c2336d6 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairHeadsetRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the headset /// The queue used to update this device. internal CorsairHeadsetRGBDevice(CorsairHeadsetRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Headset, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateHeadsetMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs index fb3e696..5bac705 100644 --- a/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Headset/CorsairHeadsetRGBDeviceInfo.cs @@ -12,13 +12,8 @@ public class CorsairHeadsetRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairHeadsetRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Headset, nativeInfo) + internal CorsairHeadsetRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Headset, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs index def410d..7103b76 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairHeadsetStandRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the headset stand /// The queue used to update this device. internal CorsairHeadsetStandRGBDevice(CorsairHeadsetStandRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.HeadsetStand, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateHeadsetStandMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs index b880a6c..cc6b274 100644 --- a/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/HeadsetStand/CorsairHeadsetStandRGBDeviceInfo.cs @@ -12,13 +12,8 @@ public class CorsairHeadsetStandRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairHeadsetStandRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.HeadsetStand, nativeInfo) + internal CorsairHeadsetStandRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.HeadsetStand, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Helper/NativeExtensions.cs b/RGB.NET.Devices.Corsair/Helper/NativeExtensions.cs index b78851b..e60424e 100644 --- a/RGB.NET.Devices.Corsair/Helper/NativeExtensions.cs +++ b/RGB.NET.Devices.Corsair/Helper/NativeExtensions.cs @@ -1,5 +1,6 @@ using RGB.NET.Core; using RGB.NET.Devices.Corsair.Native; +using System.Runtime.InteropServices; namespace RGB.NET.Devices.Corsair; @@ -7,12 +8,25 @@ internal static class NativeExtensions { internal static Rectangle ToRectangle(this _CorsairLedPosition position) { - //HACK DarthAffe 08.07.2018: It seems like corsair introduced a bug here - it's always 0. - float width = position.width < 0.5f ? 10 : (float)position.width; - float height = position.height < 0.5f ? 10 : (float)position.height; - float posX = (float)position.left; - float posY = (float)position.top; + const float WIDTH = 10; + const float HEIGHT = 10; + float posX = (float)position.cx; + float posY = (float)position.cy; - return new Rectangle(posX, posY, width, height); + return new Rectangle(posX, posY, WIDTH, HEIGHT); + } + + internal static T[] ToArray(this nint ptr, int size) + { + int tSize = Marshal.SizeOf(); + T[] array = new T[size]; + nint loopPtr = ptr; + for (int i = 0; i < size; i++) + { + array[i] = Marshal.PtrToStructure(loopPtr)!; + loopPtr += tSize; + } + + return array; } } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs index bdc9425..d1fa931 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -26,8 +27,14 @@ public class CorsairKeyboardRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the keyboard. /// The queue used to update this device. internal CorsairKeyboardRGBDevice(CorsairKeyboardRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Keyboard, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateKeyboardMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs index efa40a8..dcab088 100644 --- a/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Keyboard/CorsairKeyboardRGBDeviceInfo.cs @@ -36,11 +36,12 @@ public class CorsairKeyboardRGBDeviceInfo : CorsairRGBDeviceInfo, IKeyboardDevic /// /// The index of the . /// The native -struct - internal CorsairKeyboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Keyboard, nativeInfo) + internal CorsairKeyboardRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Keyboard, nativeInfo, ledCount, ledOffset) { - this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout; - this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout; + PhysicalLayout = (CorsairPhysicalKeyboardLayout)_CUESDK.ReadDevicePropertySimpleInt32(nativeInfo.id!, CorsairDevicePropertyId.PhysicalLayout); + LogicalLayout = (CorsairLogicalKeyboardLayout)_CUESDK.ReadDevicePropertySimpleInt32(nativeInfo.id!, CorsairDevicePropertyId.LogicalLayout); + this.Layout = PhysicalLayout switch { CorsairPhysicalKeyboardLayout.US => KeyboardLayoutType.ANSI, diff --git a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs new file mode 100644 index 0000000..53eb5b0 --- /dev/null +++ b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripGBDevice.cs @@ -0,0 +1,34 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using System.Collections.Generic; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a corsair ledStrip. +/// +public class CorsairLedStripRGBDevice : CorsairRGBDevice, ILedStripe +{ + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by CUE for the ledStrip. + /// The queue used to update this device. + internal CorsairLedStripRGBDevice(CorsairLedStripRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) + : base(info, updateQueue) + { } + + #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateLedStripMapping(ids); + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs new file mode 100644 index 0000000..35006b8 --- /dev/null +++ b/RGB.NET.Devices.Corsair/LedStrip/CorsairLedStripRGBDeviceInfo.cs @@ -0,0 +1,28 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using RGB.NET.Devices.Corsair.Native; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a generic information for a . +/// +public class CorsairLedStripRGBDeviceInfo : CorsairRGBDeviceInfo +{ + #region Constructors + + /// + internal CorsairLedStripRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.LedStripe, nativeInfo, ledCount, ledOffset) + { } + + /// + internal CorsairLedStripRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset, string modelName) + : base(RGBDeviceType.LedStripe, nativeInfo, ledCount, ledOffset, modelName) + { } + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs index fc23e18..55ab92c 100644 --- a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairMainboardRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the memory. /// The queue used to update this device. internal CorsairMainboardRGBDevice(CorsairMainboardRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Mainboard, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateMainboardMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs index 94d836c..4058d10 100644 --- a/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mainboard/CorsairMainboardRGBDeviceInfo.cs @@ -15,13 +15,8 @@ public class CorsairMainboardRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairMainboardRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Mainboard, nativeInfo) + internal CorsairMainboardRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Mainboard, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs index f44d7ee..48b2eb3 100644 --- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairMemoryRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the memory. /// The queue used to update this device. internal CorsairMemoryRGBDevice(CorsairMemoryRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Memory, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateMemoryMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs index afd8843..8d779f7 100644 --- a/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Memory/CorsairMemoryRGBDeviceInfo.cs @@ -15,13 +15,13 @@ public class CorsairMemoryRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairMemoryRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.DRAM, nativeInfo) + internal CorsairMemoryRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.DRAM, nativeInfo, ledCount, ledOffset) + { } + + /// + internal CorsairMemoryRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset, string modelName) + : base(RGBDeviceType.DRAM, nativeInfo, ledCount, ledOffset, modelName) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs index 5c81249..89f25c4 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairMouseRGBDevice : CorsairRGBDevice /// The specific information provided by CUE for the mouse /// The queue used to update this device. internal CorsairMouseRGBDevice(CorsairMouseRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Mouse, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateMouseMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs index a501466..422b18a 100644 --- a/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mouse/CorsairMouseRGBDeviceInfo.cs @@ -9,28 +9,12 @@ namespace RGB.NET.Devices.Corsair; /// public class CorsairMouseRGBDeviceInfo : CorsairRGBDeviceInfo { - #region Properties & Fields - - /// - /// Gets the physical layout of the mouse. - /// - public CorsairPhysicalMouseLayout PhysicalLayout { get; } - - #endregion - #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairMouseRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Mouse, nativeInfo) - { - this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout; - } + internal CorsairMouseRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Mouse, nativeInfo, ledCount, ledOffset) + { } #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs index 65c0f00..ac7a9b3 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -20,8 +21,14 @@ public class CorsairMousepadRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the mousepad /// The queue used to update this device. internal CorsairMousepadRGBDevice(CorsairMousepadRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Mousepad, updateQueue) + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateMousepadMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs index 8c5d62c..6b469c0 100644 --- a/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Mousepad/CorsairMousepadRGBDeviceInfo.cs @@ -12,13 +12,8 @@ public class CorsairMousepadRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index if the . - /// The native -struct - internal CorsairMousepadRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Mousepad, nativeInfo) + internal CorsairMousepadRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Mousepad, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs index 9455cb3..d3593ee 100644 --- a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs +++ b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs @@ -11,12 +11,66 @@ using RGB.NET.Core; namespace RGB.NET.Devices.Corsair.Native; +internal delegate void CorsairSessionStateChangedHandler(nint context, _CorsairSessionStateChanged eventData); + // ReSharper disable once InconsistentNaming -internal static class _CUESDK +internal static unsafe class _CUESDK { + #region Constants + + /// + /// iCUE-SDK: small string length + /// + internal const int CORSAIR_STRING_SIZE_S = 64; + + /// + /// iCUE-SDK: medium string length + /// + internal const int CORSAIR_STRING_SIZE_M = 128; + + /// + /// iCUE-SDK: maximum level of layer’s priority that can be used in CorsairSetLayerPriority + /// + internal const int CORSAIR_LAYER_PRIORITY_MAX = 255; + + /// + /// iCUE-SDK: maximum number of devices to be discovered + /// + internal const int CORSAIR_DEVICE_COUNT_MAX = 64; + + /// + /// iCUE-SDK: maximum number of LEDs controlled by device + /// + internal const int CORSAIR_DEVICE_LEDCOUNT_MAX = 512; + + #endregion + + #region Properties & Fields + + internal static bool IsConnected => SesionState == CorsairSessionState.Connected; + internal static CorsairSessionState SesionState { get; private set; } + + #endregion + + #region Events + + internal static event EventHandler? SessionStateChanged; + + #endregion + + #region Methods + + private static void CorsairSessionStateChangedCallback(nint context, _CorsairSessionStateChanged eventdata) + { + SesionState = eventdata.state; + SessionStateChanged?.Invoke(null, eventdata.state); + } + + #endregion + #region Libary Management - private static IntPtr _handle = IntPtr.Zero; + private static nint _handle = 0; /// /// Reloads the SDK. @@ -29,7 +83,7 @@ internal static class _CUESDK private static void LoadCUESDK() { - if (_handle != IntPtr.Zero) return; + if (_handle != 0) return; List possiblePathList = GetPossibleLibraryPaths().ToList(); @@ -37,24 +91,31 @@ internal static class _CUESDK if (dllPath == null) throw new RGBDeviceException($"Can't find the CUE-SDK at one of the expected locations:\r\n '{string.Join("\r\n", possiblePathList.Select(Path.GetFullPath))}'"); if (!NativeLibrary.TryLoad(dllPath, out _handle)) -#if NET6_0 +#if NET6_0_OR_GREATER throw new RGBDeviceException($"Corsair LoadLibrary failed with error code {Marshal.GetLastPInvokeError()}"); #else throw new RGBDeviceException($"Corsair LoadLibrary failed with error code {Marshal.GetLastWin32Error()}"); #endif - if (!NativeLibrary.TryGetExport(_handle, "CorsairSetLedsColorsBufferByDeviceIndex", out _corsairSetLedsColorsBufferByDeviceIndexPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairSetLedsColorsBufferByDeviceIndex'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairSetLedsColorsFlushBuffer", out _corsairSetLedsColorsFlushBufferPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairSetLedsColorsFlushBuffer'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetLedsColorsByDeviceIndex", out _corsairGetLedsColorsByDeviceIndexPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetLedsColorsByDeviceIndex'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairSetLayerPriority", out _corsairSetLayerPriorityPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairSetLayerPriority'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetDeviceCount", out _corsairGetDeviceCountPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetDeviceCount'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetDeviceInfo", out _corsairGetDeviceInfoPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetDeviceInfo'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetLedIdForKeyName", out _corsairGetLedIdForKeyNamePointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetLedIdForKeyName'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetLedPositionsByDeviceIndex", out _corsairGetLedPositionsByDeviceIndexPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetLedPositionsByDeviceIndex'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairRequestControl", out _corsairRequestControlPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairRequestControl'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairReleaseControl", out _corsairReleaseControlPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairReleaseControl'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairPerformProtocolHandshake", out _corsairPerformProtocolHandshakePointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairPerformProtocolHandshake'"); - if (!NativeLibrary.TryGetExport(_handle, "CorsairGetLastError", out _corsairGetLastErrorPointer)) throw new RGBDeviceException("Failed to load Corsair function 'CorsairGetLastError'"); + _corsairConnectPtr = (delegate* unmanaged[Cdecl])LoadFunction("CorsairConnect"); + _corsairGetSessionDetails = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetSessionDetails"); + _corsairDisconnect = (delegate* unmanaged[Cdecl])LoadFunction("CorsairDisconnect"); + _corsairGetDevices = (delegate* unmanaged[Cdecl]<_CorsairDeviceFilter, int, nint, out int, CorsairError>)LoadFunction("CorsairGetDevices"); + _corsairGetDeviceInfo = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetDeviceInfo"); + _corsairGetLedPositions = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetLedPositions"); + _corsairSetLedColors = (delegate* unmanaged[Cdecl])LoadFunction("CorsairSetLedColors"); + _corsairSetLayerPriority = (delegate* unmanaged[Cdecl])LoadFunction("CorsairSetLayerPriority"); + _corsairGetLedLuidForKeyName = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetLedLuidForKeyName"); + _corsairRequestControl = (delegate* unmanaged[Cdecl])LoadFunction("CorsairRequestControl"); + _corsairReleaseControl = (delegate* unmanaged[Cdecl])LoadFunction("CorsairReleaseControl"); + _getDevicePropertyInfo = (delegate* unmanaged[Cdecl])LoadFunction("CorsairGetDevicePropertyInfo"); + _readDeviceProperty = (delegate* unmanaged[Cdecl])LoadFunction("CorsairReadDeviceProperty"); + } + + private static nint LoadFunction(string function) + { + if (!NativeLibrary.TryGetExport(_handle, function, out nint ptr)) throw new RGBDeviceException($"Failed to load Corsair function '{function}'"); + return ptr; } private static IEnumerable GetPossibleLibraryPaths() @@ -71,23 +132,24 @@ internal static class _CUESDK internal static void UnloadCUESDK() { - if (_handle == IntPtr.Zero) return; + if (_handle == 0) return; - _corsairSetLedsColorsBufferByDeviceIndexPointer = IntPtr.Zero; - _corsairSetLedsColorsFlushBufferPointer = IntPtr.Zero; - _corsairGetLedsColorsByDeviceIndexPointer = IntPtr.Zero; - _corsairSetLayerPriorityPointer = IntPtr.Zero; - _corsairGetDeviceCountPointer = IntPtr.Zero; - _corsairGetDeviceInfoPointer = IntPtr.Zero; - _corsairGetLedIdForKeyNamePointer = IntPtr.Zero; - _corsairGetLedPositionsByDeviceIndexPointer = IntPtr.Zero; - _corsairRequestControlPointer = IntPtr.Zero; - _corsairReleaseControlPointer = IntPtr.Zero; - _corsairPerformProtocolHandshakePointer = IntPtr.Zero; - _corsairGetLastErrorPointer = IntPtr.Zero; + _corsairConnectPtr = null; + _corsairGetSessionDetails = null; + _corsairDisconnect = null; + _corsairGetDevices = null; + _corsairGetDeviceInfo = null; + _corsairGetLedPositions = null; + _corsairSetLedColors = null; + _corsairSetLayerPriority = null; + _corsairGetLedLuidForKeyName = null; + _corsairRequestControl = null; + _corsairReleaseControl = null; + _getDevicePropertyInfo = null; + _readDeviceProperty = null; NativeLibrary.Free(_handle); - _handle = IntPtr.Zero; + _handle = 0; } #endregion @@ -96,97 +158,182 @@ internal static class _CUESDK #region Pointers - private static IntPtr _corsairSetLedsColorsBufferByDeviceIndexPointer; - private static IntPtr _corsairSetLedsColorsFlushBufferPointer; - private static IntPtr _corsairGetLedsColorsByDeviceIndexPointer; - private static IntPtr _corsairSetLayerPriorityPointer; - private static IntPtr _corsairGetDeviceCountPointer; - private static IntPtr _corsairGetDeviceInfoPointer; - private static IntPtr _corsairGetLedIdForKeyNamePointer; - private static IntPtr _corsairGetLedPositionsByDeviceIndexPointer; - private static IntPtr _corsairRequestControlPointer; - private static IntPtr _corsairReleaseControlPointer; - private static IntPtr _corsairPerformProtocolHandshakePointer; - private static IntPtr _corsairGetLastErrorPointer; + private static delegate* unmanaged[Cdecl] _corsairConnectPtr; + private static delegate* unmanaged[Cdecl] _corsairGetSessionDetails; + private static delegate* unmanaged[Cdecl] _corsairDisconnect; + private static delegate* unmanaged[Cdecl]<_CorsairDeviceFilter, int, nint, out int, CorsairError> _corsairGetDevices; + private static delegate* unmanaged[Cdecl] _corsairGetDeviceInfo; + private static delegate* unmanaged[Cdecl] _corsairGetLedPositions; + private static delegate* unmanaged[Cdecl] _corsairSetLedColors; + private static delegate* unmanaged[Cdecl] _corsairSetLayerPriority; + private static delegate* unmanaged[Cdecl] _corsairGetLedLuidForKeyName; + private static delegate* unmanaged[Cdecl] _corsairRequestControl; + private static delegate* unmanaged[Cdecl] _corsairReleaseControl; + private static delegate* unmanaged[Cdecl] _getDevicePropertyInfo; + private static delegate* unmanaged[Cdecl] _readDeviceProperty; #endregion - /// - /// CUE-SDK: set specified LEDs to some colors. - /// This function set LEDs colors in the buffer which is written to the devices via CorsairSetLedsColorsFlushBuffer or CorsairSetLedsColorsFlushBufferAsync. - /// Typical usecase is next: CorsairSetLedsColorsFlushBuffer or CorsairSetLedsColorsFlushBufferAsync is called to write LEDs colors to the device - /// and follows after one or more calls of CorsairSetLedsColorsBufferByDeviceIndex to set the LEDs buffer. - /// This function does not take logical layout into account. - /// - internal static unsafe bool CorsairSetLedsColorsBufferByDeviceIndex(int deviceIndex, int size, IntPtr ledsColors) - => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairSetLedsColorsBufferByDeviceIndexPointer))(deviceIndex, size, ledsColors); - - /// - /// CUE-SDK: writes to the devices LEDs colors buffer which is previously filled by the CorsairSetLedsColorsBufferByDeviceIndex function. - /// This function executes synchronously, if you are concerned about delays consider using CorsairSetLedsColorsFlushBufferAsync - /// - internal static unsafe bool CorsairSetLedsColorsFlushBuffer() => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairSetLedsColorsFlushBufferPointer))(); - - /// - /// CUE-SDK: get current color for the list of requested LEDs. - /// The color should represent the actual state of the hardware LED, which could be a combination of SDK and/or CUE input. - /// This function works for keyboard, mouse, mousemat, headset, headset stand and DIY-devices. - /// - internal static unsafe bool CorsairGetLedsColorsByDeviceIndex(int deviceIndex, int size, IntPtr ledsColors) - => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetLedsColorsByDeviceIndexPointer))(deviceIndex, size, ledsColors); - - /// - /// CUE-SDK: set layer priority for this shared client. - /// By default CUE has priority of 127 and all shared clients have priority of 128 if they don’t call this function. - /// Layers with higher priority value are shown on top of layers with lower priority. - /// - internal static unsafe bool CorsairSetLayerPriority(int priority) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairSetLayerPriorityPointer))(priority); - - /// - /// CUE-SDK: returns number of connected Corsair devices that support lighting control. - /// - internal static unsafe int CorsairGetDeviceCount() => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetDeviceCountPointer))(); - - /// - /// CUE-SDK: returns information about device at provided index. - /// - internal static unsafe IntPtr CorsairGetDeviceInfo(int deviceIndex) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetDeviceInfoPointer))(deviceIndex); - - /// - /// CUE-SDK: provides list of keyboard or mousepad LEDs with their physical positions. - /// - internal static unsafe IntPtr CorsairGetLedPositionsByDeviceIndex(int deviceIndex) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetLedPositionsByDeviceIndexPointer))(deviceIndex); - - /// - /// CUE-SDK: retrieves led id for key name taking logical layout into account. - /// - internal static unsafe CorsairLedId CorsairGetLedIdForKeyName(char keyName) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetLedIdForKeyNamePointer))(keyName); - - /// - /// CUE-SDK: requestes control using specified access mode. - /// By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control. - /// - internal static unsafe bool CorsairRequestControl(CorsairAccessMode accessMode) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairRequestControlPointer))(accessMode); - - /// - /// CUE-SDK: releases previously requested control for specified access mode. - /// - internal static unsafe bool CorsairReleaseControl(CorsairAccessMode accessMode) => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairReleaseControlPointer))(accessMode); - - /// - /// CUE-SDK: checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE. - /// - internal static unsafe _CorsairProtocolDetails CorsairPerformProtocolHandshake() => ((delegate* unmanaged[Cdecl]<_CorsairProtocolDetails>)ThrowIfZero(_corsairPerformProtocolHandshakePointer))(); - - /// - /// CUE-SDK: returns last error that occured while using any of Corsair* functions. - /// - internal static unsafe CorsairError CorsairGetLastError() => ((delegate* unmanaged[Cdecl])ThrowIfZero(_corsairGetLastErrorPointer))(); - - private static IntPtr ThrowIfZero(IntPtr ptr) + internal static CorsairError CorsairConnect() { - if (ptr == IntPtr.Zero) throw new RGBDeviceException("The Corsair-SDK is not initialized."); - return ptr; + if (_corsairConnectPtr == null) throw new RGBDeviceException("The Corsair-SDK is not initialized."); + if (IsConnected) throw new RGBDeviceException("The Corsair-SDK is already connected."); + return _corsairConnectPtr(CorsairSessionStateChangedCallback, 0); + } + + internal static CorsairError CorsairGetSessionDetails(out _CorsairSessionDetails? details) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + + nint sessionDetailPtr = Marshal.AllocHGlobal(Marshal.SizeOf<_CorsairSessionDetails>()); + try + { + CorsairError error = _corsairGetSessionDetails(sessionDetailPtr); + details = Marshal.PtrToStructure<_CorsairSessionDetails>(sessionDetailPtr); + + return error; + } + finally + { + Marshal.FreeHGlobal(sessionDetailPtr); + } + } + + internal static CorsairError CorsairDisconnect() + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairDisconnect(); + } + + internal static CorsairError CorsairGetDevices(_CorsairDeviceFilter filter, out _CorsairDeviceInfo[] devices) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + + int structSize = Marshal.SizeOf<_CorsairDeviceInfo>(); + nint devicePtr = Marshal.AllocHGlobal(structSize * CORSAIR_DEVICE_COUNT_MAX); + try + { + CorsairError error = _corsairGetDevices(filter, CORSAIR_DEVICE_COUNT_MAX, devicePtr, out int size); + devices = devicePtr.ToArray<_CorsairDeviceInfo>(size); + + return error; + } + finally + { + Marshal.FreeHGlobal(devicePtr); + } + } + + internal static CorsairError CorsairGetDeviceInfo(string deviceId, _CorsairDeviceInfo deviceInfo) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairGetDeviceInfo(deviceId, deviceInfo); + } + + internal static CorsairError CorsairGetLedPositions(string deviceId, out _CorsairLedPosition[] ledPositions) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + + int structSize = Marshal.SizeOf<_CorsairLedPosition>(); + nint ledPositionsPtr = Marshal.AllocHGlobal(structSize * CORSAIR_DEVICE_LEDCOUNT_MAX); + try + { + CorsairError error = _corsairGetLedPositions(deviceId, CORSAIR_DEVICE_LEDCOUNT_MAX, ledPositionsPtr, out int size); + ledPositions = ledPositionsPtr.ToArray<_CorsairLedPosition>(size); + + return error; + } + finally + { + Marshal.FreeHGlobal(ledPositionsPtr); + } + } + + internal static CorsairError CorsairSetLedColors(string deviceId, int ledCount, nint ledColorsPtr) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairSetLedColors(deviceId, ledCount, ledColorsPtr); + } + + internal static CorsairError CorsairSetLayerPriority(uint priority) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairSetLayerPriority(priority); + } + + internal static CorsairError CorsairGetLedLuidForKeyName(string deviceId, char keyName, out uint ledId) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairGetLedLuidForKeyName(deviceId, keyName, out ledId); + } + + internal static CorsairError CorsairRequestControl(string deviceId, CorsairAccessLevel accessLevel) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairRequestControl(deviceId, accessLevel); + } + + internal static CorsairError CorsairReleaseControl(string deviceId) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _corsairReleaseControl(deviceId); + } + + internal static CorsairError GetDevicePropertyInfo(string deviceId, CorsairDevicePropertyId propertyId, uint index, out CorsairDataType dataType, out CorsairPropertyFlag flags) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + return _getDevicePropertyInfo(deviceId, propertyId, index, out dataType, out flags); + } + + internal static CorsairError ReadDeviceProperty(string deviceId, CorsairDevicePropertyId propertyId, uint index, out _CorsairProperty? property) + { + if (!IsConnected) throw new RGBDeviceException("The Corsair-SDK is not connected."); + + nint propertyPtr = Marshal.AllocHGlobal(Marshal.SizeOf<_CorsairProperty>()); + try + { + CorsairError error = _readDeviceProperty(deviceId, propertyId, index, propertyPtr); + property = Marshal.PtrToStructure<_CorsairProperty>(propertyPtr); + + return error; + } + finally + { + Marshal.FreeHGlobal(propertyPtr); + } + } + + internal static int ReadDevicePropertySimpleInt32(string deviceId, CorsairDevicePropertyId propertyId, uint index = 0) => ReadDevicePropertySimple(deviceId, propertyId, CorsairDataType.Int32, index).int32; + + internal static int[] ReadDevicePropertySimpleInt32Array(string deviceId, CorsairDevicePropertyId propertyId, uint index = 0) + { + _CorsairDataValue dataValue = ReadDevicePropertySimple(deviceId, propertyId, CorsairDataType.Int32Array, index); + return dataValue.int32Array.items.ToArray((int)dataValue.int32Array.count); + } + + internal static _CorsairDataValue ReadDevicePropertySimple(string deviceId, CorsairDevicePropertyId propertyId, CorsairDataType expectedDataType, uint index = 0) + { + CorsairError errorCode = GetDevicePropertyInfo(deviceId, propertyId, index, out CorsairDataType dataType, out CorsairPropertyFlag flags); + if (errorCode != CorsairError.Success) + throw new RGBDeviceException($"Failed to read device-property-info '{propertyId}' for corsair device '{deviceId}'. (ErrorCode: {errorCode})"); + + if (dataType != expectedDataType) + throw new RGBDeviceException($"Failed to read device-property-info '{propertyId}' for corsair device '{deviceId}'. (Wrong data-type '{dataType}', expected: '{expectedDataType}')"); + + if (!flags.HasFlag(CorsairPropertyFlag.CanRead)) + throw new RGBDeviceException($"Failed to read device-property-info '{propertyId}' for corsair device '{deviceId}'. (Not readable)"); + + errorCode = ReadDeviceProperty(deviceId, propertyId, index, out _CorsairProperty? property); + if (errorCode != CorsairError.Success) + throw new RGBDeviceException($"Failed to read device-property '{propertyId}' for corsair device '{deviceId}'. (ErrorCode: {errorCode})"); + + if (property == null) + throw new RGBDeviceException($"Failed to read device-property '{propertyId}' for corsair device '{deviceId}'. (Invalid return value)"); + + if (property.Value.type != expectedDataType) + throw new RGBDeviceException($"Failed to read device-property '{propertyId}' for corsair device '{deviceId}'. (Wrong data-type '{dataType}', expected: '{expectedDataType}')"); + + return property.Value.value; } #endregion diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairChannelInfo.cs b/RGB.NET.Devices.Corsair/Native/_CorsairChannelInfo.cs deleted file mode 100644 index 3190b87..0000000 --- a/RGB.NET.Devices.Corsair/Native/_CorsairChannelInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -#pragma warning disable 169 // Field 'x' is never used -#pragma warning disable 414 // Field 'x' is assigned but its value never used -#pragma warning disable 649 // Field 'x' is never assigned -#pragma warning disable IDE1006 // Naming Styles - -using System; -using System.Runtime.InteropServices; - -namespace RGB.NET.Devices.Corsair.Native; - -// ReSharper disable once InconsistentNaming -/// -/// CUE-SDK: contains information about separate channel of the DIY-device. -/// -[StructLayout(LayoutKind.Sequential)] -internal class _CorsairChannelInfo -{ - /// - /// CUE-SDK: total number of LEDs connected to the channel; - /// - internal int totalLedsCount; - - /// - /// CUE-SDK: number of LED-devices (fans, strips, etc.) connected to the channel which is controlled by the DIY device - /// - internal int devicesCount; - - /// - /// CUE-SDK: array containing information about each separate LED-device connected to the channel controlled by the DIY device. - /// Index of the LED-device in array is same as the index of the LED-device connected to the DIY-device. - /// - internal IntPtr devices; -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairDataValue.cs b/RGB.NET.Devices.Corsair/Native/_CorsairDataValue.cs new file mode 100644 index 0000000..bfb5e3d --- /dev/null +++ b/RGB.NET.Devices.Corsair/Native/_CorsairDataValue.cs @@ -0,0 +1,140 @@ +#pragma warning disable 169 // Field 'x' is never used +#pragma warning disable 414 // Field 'x' is assigned but its value never used +#pragma warning disable 649 // Field 'x' is never assigned +#pragma warning disable IDE1006 // Naming Styles + +using System.Runtime.InteropServices; + +namespace RGB.NET.Devices.Corsair.Native; + +// ReSharper disable once InconsistentNaming +/// +/// iCUE-SDK: a union of all property data types +/// +[StructLayout(LayoutKind.Explicit)] +internal struct _CorsairDataValue +{ + #region Properties & Fields + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Boolean + /// + [FieldOffset(0)] + internal bool boolean; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Int32 + /// + [FieldOffset(0)] + internal int int32; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Float64 + /// + [FieldOffset(0)] + internal double float64; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_String + /// + [FieldOffset(0)] + internal nint @string; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Boolean_Array + /// + [FieldOffset(0)] + internal CorsairDataTypeBooleanArray booleanArray; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Int32_Array + /// + [FieldOffset(0)] + internal CorsairDataTypeInt32Array int32Array; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_Float64_Array + /// + [FieldOffset(0)] + internal CorsairDataTypeFloat64Array float64Array; + + /// + /// iCUE-SDK: actual property value if it’s type is CPDT_String_Array + /// + [FieldOffset(0)] + internal CorsairDataTypeStringArray stringArray; + + #endregion + + #region Data Types + + /// + /// iCUE: represents an array of boolean values + /// + [StructLayout(LayoutKind.Sequential)] + internal struct CorsairDataTypeBooleanArray + { + /// + /// iCUE: an array of boolean values + /// + internal nint items; + + /// + /// iCUE: number of items array elements + /// + internal uint count; + }; + + /// + /// iCUE: represents an array of integer values + /// + [StructLayout(LayoutKind.Sequential)] + internal struct CorsairDataTypeInt32Array + { + /// + /// iCUE: an array of integer values + /// + internal nint items; + + /// + /// iCUE: number of items array elements + /// + internal uint count; + }; + + /// + /// iCUE: represents an array of double values + /// + [StructLayout(LayoutKind.Sequential)] + internal struct CorsairDataTypeFloat64Array + { + /// + /// iCUE: an array of double values + /// + internal nint items; + + /// + /// iCUE: number of items array elements + /// + internal uint count; + }; + + /// + /// iCUE: represents an array of pointers to null terminated strings + /// + [StructLayout(LayoutKind.Sequential)] + internal struct CorsairDataTypeStringArray + { + /// + /// iCUE: an array of pointers to null terminated strings + /// + internal nint items; + + /// + /// iCUE: number of items array elements + /// + internal uint count; + }; + + #endregion +} diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairChannelsInfo.cs b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs similarity index 50% rename from RGB.NET.Devices.Corsair/Native/_CorsairChannelsInfo.cs rename to RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs index e2a5a12..76f179d 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairChannelsInfo.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceFilter.cs @@ -3,26 +3,34 @@ #pragma warning disable 649 // Field 'x' is never assigned #pragma warning disable IDE1006 // Naming Styles -using System; using System.Runtime.InteropServices; namespace RGB.NET.Devices.Corsair.Native; // ReSharper disable once InconsistentNaming /// -/// CUE-SDK: contains information about channels of the DIY-devices. +/// iCUE-SDK: contains device search filter /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairChannelsInfo +internal class _CorsairDeviceFilter { - /// - /// CUE-SDK: number of channels controlled by the device - /// - internal int channelsCount; + #region Properties & Fields /// - /// CUE-SDK: array containing information about each separate channel of the DIY-device. - /// Index of the channel in the array is same as index of the channel on the DIY-device. + /// iCUE-SDK: mask that describes device types, formed as logical “or” of CorsairDeviceType enum values /// - internal IntPtr channels; -} \ No newline at end of file + internal CorsairDeviceType deviceTypeMask; + + #endregion + + #region Constructors + + public _CorsairDeviceFilter() { } + + public _CorsairDeviceFilter(CorsairDeviceType filter) + { + this.deviceTypeMask = filter; + } + + #endregion +} diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs index 799fc5a..f122879 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairDeviceInfo.cs @@ -3,56 +3,47 @@ #pragma warning disable 649 // Field 'x' is never assigned #pragma warning disable IDE1006 // Naming Styles -using System; using System.Runtime.InteropServices; namespace RGB.NET.Devices.Corsair.Native; // ReSharper disable once InconsistentNaming /// -/// CUE-SDK: contains information about device +/// iCUE-SDK: contains information about device /// [StructLayout(LayoutKind.Sequential)] internal class _CorsairDeviceInfo { /// - /// CUE-SDK: enum describing device type + /// iCUE-SDK: enum describing device type /// internal CorsairDeviceType type; /// - /// CUE-SDK: null - terminated device model(like “K95RGB”) + /// iCUE-SDK: null terminated Unicode string that contains unique device identifier serial number. Can be empty, if serial number is not available for the device /// - internal IntPtr model; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = _CUESDK.CORSAIR_STRING_SIZE_M)] + internal string? id; /// - /// CUE-SDK: enum describing physical layout of the keyboard or mouse + /// iCUE-SDK: null terminated Unicode string that contains device serial number. Can be empty, if serial number is not available for the device /// - internal int physicalLayout; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = _CUESDK.CORSAIR_STRING_SIZE_M)] + internal string? serial; /// - /// CUE-SDK: enum describing logical layout of the keyboard as set in CUE settings + /// iCUE-SDK: null terminated Unicode string that contains device model (like “K95RGB”) /// - internal int logicalLayout; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = _CUESDK.CORSAIR_STRING_SIZE_M)] + internal string? model; /// - /// CUE-SDK: mask that describes device capabilities, formed as logical “or” of CorsairDeviceCaps enum values + /// iCUE-SDK: number of controllable LEDs on the device /// - internal int capsMask; + internal int ledCount; /// - /// CUE-SDK: number of controllable LEDs on the device + /// iCUE-SDK: number of channels controlled by the device /// - internal int ledsCount; - - /// - /// CUE-SDK: structure that describes channels of the DIY-devices - /// - internal _CorsairChannelsInfo? channels; - - /// - /// CUE-SDK: null-terminated string that contains unique device identifier that uniquely identifies device at least within session - /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - internal string? deviceId; + internal int channelCount; } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairLedColor.cs b/RGB.NET.Devices.Corsair/Native/_CorsairLedColor.cs index 004b36a..60e6496 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairLedColor.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairLedColor.cs @@ -10,28 +10,52 @@ namespace RGB.NET.Devices.Corsair.Native; // ReSharper disable once InconsistentNaming /// -/// CUE-SDK: contains information about led and its color +/// iCUE-SDK: contains information about led and its color /// [StructLayout(LayoutKind.Sequential)] -internal class _CorsairLedColor +internal struct _CorsairLedColor { - /// - /// CUE-SDK: identifier of LED to set - /// - internal int ledId; + #region Properties & Fields /// - /// CUE-SDK: red brightness[0..255] + /// iCUE-SDK: identifier of LED to set /// - internal int r; + internal CorsairLedId ledId; /// - /// CUE-SDK: green brightness[0..255] + /// iCUE-SDK: red brightness[0..255] /// - internal int g; + internal byte r; /// - /// CUE-SDK: blue brightness[0..255] + /// iCUE-SDK: green brightness[0..255] /// - internal int b; + internal byte g; + + /// + /// iCUE-SDK: blue brightness[0..255] + /// + internal byte b; + + /// + /// iCUE-SDK: alpha channel [0..255]. The opacity of the color from 0 for completely translucent to 255 for opaque + /// + internal byte a; + + #endregion + + #region Constructors + + public _CorsairLedColor() { } + + public _CorsairLedColor(CorsairLedId ledId, byte r, byte g, byte b, byte a) + { + this.ledId = ledId; + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + #endregion }; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs b/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs index 34f4108..b2ff0fe 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairLedPosition.cs @@ -2,41 +2,31 @@ #pragma warning disable 414 // Field 'x' is assigned but its value never used #pragma warning disable 649 // Field 'x' is never assigned #pragma warning disable IDE1006 // Naming Styles +// ReSharper disable NotAccessedField.Global using System.Runtime.InteropServices; namespace RGB.NET.Devices.Corsair.Native; -// ReSharper disable once InconsistentNaming +// ReSharper disable once InconsistentNaming /// -/// CUE-SDK: contains led id and position of led rectangle.Most of the keys are rectangular. -/// In case if key is not rectangular(like Enter in ISO / UK layout) it returns the smallest rectangle that fully contains the key +/// iCUE-SDK: contains led id and position of led /// [StructLayout(LayoutKind.Sequential)] internal class _CorsairLedPosition { /// - /// CUE-SDK: identifier of led + /// iCUE-SDK: unique identifier of led /// - internal CorsairLedId LedId; + internal uint id; /// - /// CUE-SDK: values in mm + /// iCUE-SDK: for keyboards, mice, mousemats, headset stands and memory modules values are /// - internal double top; + internal double cx; /// - /// CUE-SDK: values in mm + /// iCUE-SDK: in mm, for DIY-devices, headsets and coolers values are in logical units /// - internal double left; - - /// - /// CUE-SDK: values in mm - /// - internal double height; - - /// - /// CUE-SDK: values in mm - /// - internal double width; -} \ No newline at end of file + internal double cy; +}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairLedPositions.cs b/RGB.NET.Devices.Corsair/Native/_CorsairLedPositions.cs deleted file mode 100644 index c3186d3..0000000 --- a/RGB.NET.Devices.Corsair/Native/_CorsairLedPositions.cs +++ /dev/null @@ -1,26 +0,0 @@ -#pragma warning disable 169 // Field 'x' is never used -#pragma warning disable 414 // Field 'x' is assigned but its value never used -#pragma warning disable 649 // Field 'x' is never assigned - -using System; -using System.Runtime.InteropServices; - -namespace RGB.NET.Devices.Corsair.Native; - -// ReSharper disable once InconsistentNaming -/// -/// CUE-SDK: contains number of leds and arrays with their positions -/// -[StructLayout(LayoutKind.Sequential)] -internal class _CorsairLedPositions -{ - /// - /// CUE-SDK: integer value.Number of elements in following array - /// - internal int numberOfLed; - - /// - /// CUE-SDK: array of led positions - /// - internal IntPtr pLedPosition; -} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairChannelDeviceInfo.cs b/RGB.NET.Devices.Corsair/Native/_CorsairProperty.cs similarity index 60% rename from RGB.NET.Devices.Corsair/Native/_CorsairChannelDeviceInfo.cs rename to RGB.NET.Devices.Corsair/Native/_CorsairProperty.cs index 3f44c7a..4a275b2 100644 --- a/RGB.NET.Devices.Corsair/Native/_CorsairChannelDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Native/_CorsairProperty.cs @@ -9,19 +9,22 @@ namespace RGB.NET.Devices.Corsair.Native; // ReSharper disable once InconsistentNaming /// -/// CUE-SDK: contains information about separate LED-device connected to the channel controlled by the DIY-device. +/// iCUE-SDK: contains information about device property type and value /// [StructLayout(LayoutKind.Sequential)] - -internal class _CorsairChannelDeviceInfo +internal struct _CorsairProperty { - /// - /// CUE-SDK: type of the LED-device - /// - internal CorsairChannelDeviceType type; + #region Properties & Fields /// - /// CUE-SDK: number of LEDs controlled by LED-device. + /// iCUE-SDK: type of property /// - internal int deviceLedCount; -} \ No newline at end of file + internal CorsairDataType type; + + /// + /// iCUE-SDK: property value + /// + internal _CorsairDataValue value; + + #endregion +} diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairProtocolDetails.cs b/RGB.NET.Devices.Corsair/Native/_CorsairProtocolDetails.cs deleted file mode 100644 index cd6bf6e..0000000 --- a/RGB.NET.Devices.Corsair/Native/_CorsairProtocolDetails.cs +++ /dev/null @@ -1,43 +0,0 @@ -#pragma warning disable 169 // Field 'x' is never used -#pragma warning disable 414 // Field 'x' is assigned but its value never used -#pragma warning disable 649 // Field 'x' is never assigned - -using System; -using System.Runtime.InteropServices; - -namespace RGB.NET.Devices.Corsair.Native; - -// ReSharper disable once InconsistentNaming -/// -/// CUE-SDK: contains information about SDK and CUE versions -/// -[StructLayout(LayoutKind.Sequential)] -internal struct _CorsairProtocolDetails -{ - /// - /// CUE-SDK: null - terminated string containing version of SDK(like “1.0.0.1”). Always contains valid value even if there was no CUE found - /// - internal IntPtr sdkVersion; - - /// - /// CUE-SDK: null - terminated string containing version of CUE(like “1.0.0.1”) or NULL if CUE was not found. - /// - internal IntPtr serverVersion; - - /// - /// CUE-SDK: integer number that specifies version of protocol that is implemented by current SDK. - /// Numbering starts from 1. Always contains valid value even if there was no CUE found - /// - internal int sdkProtocolVersion; - - /// - /// CUE-SDK: integer number that specifies version of protocol that is implemented by CUE. - /// Numbering starts from 1. If CUE was not found then this value will be 0 - /// - internal int serverProtocolVersion; - - /// - /// CUE-SDK: boolean value that specifies if there were breaking changes between version of protocol implemented by server and client - /// - internal byte breakingChanges; -}; \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs b/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs new file mode 100644 index 0000000..392a30b --- /dev/null +++ b/RGB.NET.Devices.Corsair/Native/_CorsairSessionDetails.cs @@ -0,0 +1,32 @@ +#pragma warning disable 169 // Field 'x' is never used +#pragma warning disable 414 // Field 'x' is assigned but its value never used +#pragma warning disable 649 // Field 'x' is never assigned +#pragma warning disable IDE1006 // Naming Styles +// ReSharper disable NotAccessedField.Global + +using System.Runtime.InteropServices; + +namespace RGB.NET.Devices.Corsair.Native; + +// ReSharper disable once InconsistentNaming +/// +/// iCUE-SDK: contains information about SDK and iCUE versions +/// +[StructLayout(LayoutKind.Sequential)] +internal class _CorsairSessionDetails +{ + /// + /// iCUE-SDK: version of SDK client (like {4,0,1}). Always contains valid value even if there was no iCUE found. Must comply with the semantic versioning rules. + /// + internal _CorsairVersion clientVersion = new(); + + /// + /// iCUE-SDK: version of SDK server (like {4,0,1}) or empty struct ({0,0,0}) if the iCUE was not found. Must comply with the semantic versioning rules. + /// + internal _CorsairVersion serverVersion = new(); + + /// + /// iCUE-SDK: version of iCUE (like {3,33,100}) or empty struct ({0,0,0}) if the iCUE was not found. + /// + internal _CorsairVersion serverHostVersion = new(); +}; diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs b/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs new file mode 100644 index 0000000..99aa8fd --- /dev/null +++ b/RGB.NET.Devices.Corsair/Native/_CorsairSessionStateChanged.cs @@ -0,0 +1,27 @@ +#pragma warning disable 169 // Field 'x' is never used +#pragma warning disable 414 // Field 'x' is assigned but its value never used +#pragma warning disable 649 // Field 'x' is never assigned +#pragma warning disable IDE1006 // Naming Styles +// ReSharper disable NotAccessedField.Global + +using System.Runtime.InteropServices; + +namespace RGB.NET.Devices.Corsair.Native; + +// ReSharper disable once InconsistentNaming +/// +/// iCUE-SDK: contains information about session state and client/server versions +/// +[StructLayout(LayoutKind.Sequential)] +internal class _CorsairSessionStateChanged +{ + /// + /// iCUE-SDK: new session state which SDK client has been transitioned to + /// + internal CorsairSessionState state; + + /// + /// iCUE-SDK: information about client/server versions + /// + internal _CorsairSessionDetails details = new(); +}; diff --git a/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs b/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs new file mode 100644 index 0000000..790226e --- /dev/null +++ b/RGB.NET.Devices.Corsair/Native/_CorsairVersion.cs @@ -0,0 +1,31 @@ +#pragma warning disable 169 // Field 'x' is never used +#pragma warning disable 414 // Field 'x' is assigned but its value never used +#pragma warning disable 649 // Field 'x' is never assigned +#pragma warning disable IDE1006 // Naming Styles +// ReSharper disable NotAccessedField.Global + +using System.Runtime.InteropServices; + +namespace RGB.NET.Devices.Corsair.Native; + +// ReSharper disable once InconsistentNaming +/// +/// iCUE-SDK: contains information about version that consists of three components +/// +[StructLayout(LayoutKind.Sequential)] +internal class _CorsairVersion +{ + #region Properties & Fields + + internal int major; + internal int minor; + internal int patch; + + #endregion + + #region Methods + + public override string ToString() => $"{major}.{minor}.{patch}"; + + #endregion +}; diff --git a/RGB.NET.Devices.Corsair/README.md b/RGB.NET.Devices.Corsair/README.md index dd30377..c6c1803 100644 --- a/RGB.NET.Devices.Corsair/README.md +++ b/RGB.NET.Devices.Corsair/README.md @@ -11,14 +11,16 @@ surface.Load(CorsairDeviceProvider.Instance); This providers requires native SDK-dlls. You can get them directly from Corsair at [https://github.com/CorsairOfficial/cue-sdk/releases](https://github.com/CorsairOfficial/cue-sdk/releases) +(Developed and tested with iCUE SDK v4.0.48) + Since the SDK-dlls are native it's important to use the correct architecture you're building your application for. (If in doubt you can always include both.) ### x64 -`redist\x64\CUESDK.x64_2019.dll` from the SDK-zip needs to be distributed as `\x64\CUESDK.x64_2019.dll` (or simply named `CUESDK.dll`) +`redist\x64\iCUESDK.x64_2019.dll` from the SDK-zip needs to be distributed as `\x64\iCUESDK.x64_2019.dll` (or simply named `iCUESDK.dll`) You can use other, custom paths by adding them to `CorsairDeviceProvider.PossibleX64NativePaths`. ### x86 -`redist\i386\CUESDK_2019.dll` from the SDK-zip needs to be distributed as `\x86\CUESDK_2019.dll` (or simply named `CUESDK.dll`) +`redist\i386\iCUESDK_2019.dll` from the SDK-zip needs to be distributed as `\x86\iCUESDK_2019.dll` (or simply named `iCUESDK.dll`) You can use other, custom paths by adding them to `CorsairDeviceProvider.PossibleX86NativePaths`. diff --git a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj.DotSettings b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj.DotSettings index eeca971..16defe6 100644 --- a/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj.DotSettings +++ b/RGB.NET.Devices.Corsair/RGB.NET.Devices.Corsair.csproj.DotSettings @@ -1,8 +1,12 @@  + True + True True True True True + True + True True True True @@ -19,4 +23,5 @@ True True True + True \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs index 092e84c..d704343 100644 --- a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs +++ b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDevice.cs @@ -2,6 +2,7 @@ // ReSharper disable UnusedMember.Global using RGB.NET.Core; +using System.Collections.Generic; namespace RGB.NET.Devices.Corsair; @@ -9,7 +10,7 @@ namespace RGB.NET.Devices.Corsair; /// /// Represents a corsair touchbar. /// -public class CorsairTouchbarRGBDevice : CorsairRGBDevice, IDRAM +public class CorsairTouchbarRGBDevice : CorsairRGBDevice, ILedStripe { #region Constructors @@ -20,8 +21,14 @@ public class CorsairTouchbarRGBDevice : CorsairRGBDeviceThe specific information provided by CUE for the touchbar. /// The queue used to update this device. internal CorsairTouchbarRGBDevice(CorsairTouchbarRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) - : base(info, LedMappings.Keyboard, updateQueue) //TODO DarthAffe 17.07.2022: Find someone with such a device and check which LedIds are actually used + : base(info, updateQueue) { } #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateLedStripMapping(ids); + + #endregion } \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs index 9ee690c..68ea4f0 100644 --- a/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Touchbar/CorsairTouchbarRGBDeviceInfo.cs @@ -15,13 +15,8 @@ public class CorsairTouchbarRGBDeviceInfo : CorsairRGBDeviceInfo #region Constructors /// - /// - /// Internal constructor of managed . - /// - /// The index of the . - /// The native -struct - internal CorsairTouchbarRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo) - : base(deviceIndex, RGBDeviceType.Keypad, nativeInfo) + internal CorsairTouchbarRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.LedStripe, nativeInfo, ledCount, ledOffset) { } #endregion diff --git a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs new file mode 100644 index 0000000..d860336 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDevice.cs @@ -0,0 +1,34 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using System.Collections.Generic; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a unknown corsair device. +/// +public class CorsairUnknownRGBDevice : CorsairRGBDevice, IUnknownDevice +{ + #region Constructors + + /// + /// + /// Initializes a new instance of the class. + /// + /// The specific information provided by CUE for the unknown device. + /// The queue used to update this device. + internal CorsairUnknownRGBDevice(CorsairUnknownRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue) + : base(info, updateQueue) + { } + + #endregion + + #region Methods + + protected override LedMapping CreateMapping(IEnumerable ids) => LedMappings.CreateUnknownMapping(ids); + + #endregion +} \ No newline at end of file diff --git a/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs new file mode 100644 index 0000000..e9b6da5 --- /dev/null +++ b/RGB.NET.Devices.Corsair/Unknown/CorsairUnknownRGBDeviceInfo.cs @@ -0,0 +1,23 @@ +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Global + +using RGB.NET.Core; +using RGB.NET.Devices.Corsair.Native; + +namespace RGB.NET.Devices.Corsair; + +/// +/// +/// Represents a generic information for a . +/// +public class CorsairUnknownRGBDeviceInfo : CorsairRGBDeviceInfo +{ + #region Constructors + + /// + internal CorsairUnknownRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset) + : base(RGBDeviceType.Unknown, nativeInfo, ledCount, ledOffset) + { } + + #endregion +} \ No newline at end of file