From a86d5f7e84b8ba586f819d5b672b7176ae1416f4 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 10 Jul 2018 20:06:38 +0200 Subject: [PATCH] Added Id to devices --- RGB.NET.Core/Devices/IRGBDeviceInfo.cs | 5 +++++ RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs | 3 +++ .../Generic/CoolerMasterRGBDeviceInfo.cs | 3 +++ RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs | 3 +++ RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs | 3 +++ RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs | 7 ++++++- RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs | 3 +++ RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs | 3 +++ RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs | 2 +- RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs | 7 +++++-- .../ChromaLink/RazerChromaLinkRGBDevice.cs | 2 +- RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs | 7 +++++-- RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs | 2 +- RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs | 2 +- RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs | 2 +- RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs | 2 +- RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs | 2 +- RGB.NET.Devices.SoIP/Client/SoIPClientRGBDeviceInfo.cs | 3 +++ RGB.NET.Devices.SoIP/Server/SoIPServerRGBDeviceInfo.cs | 3 +++ 19 files changed, 52 insertions(+), 12 deletions(-) diff --git a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs index 61cc868..98424d8 100644 --- a/RGB.NET.Core/Devices/IRGBDeviceInfo.cs +++ b/RGB.NET.Core/Devices/IRGBDeviceInfo.cs @@ -9,6 +9,11 @@ namespace RGB.NET.Core { #region Properties & Fields + /// + /// Gets an unique identifier of the this info belongs to. + /// + object DeviceId { get; } + /// /// Gets the of the . /// diff --git a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs index 488a2b7..c7aad3e 100644 --- a/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/Generic/AsusRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.Asus { #region Properties & Fields + /// + public object DeviceId => Handle.ToInt32(); + /// public RGBDeviceType DeviceType { get; } diff --git a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs index b9790ca..e6bdb63 100644 --- a/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs +++ b/RGB.NET.Devices.CoolerMaster/Generic/CoolerMasterRGBDeviceInfo.cs @@ -12,6 +12,9 @@ namespace RGB.NET.Devices.CoolerMaster { #region Properties & Fields + /// + public object DeviceId => DeviceIndex; + /// public RGBDeviceType DeviceType { get; } diff --git a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs index 012cfb5..6d3f424 100644 --- a/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Corsair/Generic/CorsairRGBDeviceInfo.cs @@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Corsair { #region Properties & Fields + /// + public object DeviceId => CorsairDeviceIndex; + /// /// Gets the corsair specific device type. /// diff --git a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs index 8da933e..8a84459 100644 --- a/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs +++ b/RGB.NET.Devices.DMX/E131/E131DeviceInfo.cs @@ -21,6 +21,9 @@ namespace RGB.NET.Devices.DMX.E131 #region Properties & Fields + /// + public object DeviceId => CID; + /// public RGBDeviceType DeviceType { get; } diff --git a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs index 10ad430..6440cdc 100644 --- a/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Debug/DebugRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.Debug { #region Properties & Fields + /// + public object DeviceId { get; } + /// public RGBDeviceType DeviceType { get; } @@ -41,13 +44,15 @@ namespace RGB.NET.Devices.Debug /// The model of the device. /// The of the device. /// True if the device supports syncback; false if not. - internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, RGBDeviceLighting lighting, bool supportsSyncBack) + /// The unique identifier of this device. + internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, RGBDeviceLighting lighting, bool supportsSyncBack, object deviceId = null) { this.DeviceType = deviceType; this.Manufacturer = manufacturer; this.Model = model; this.Lighting = lighting; this.SupportsSyncBack = supportsSyncBack; + this.DeviceId = deviceId; } #endregion diff --git a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs index 3fc5017..ccd52a2 100644 --- a/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Logitech/Generic/LogitechRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.Logitech { #region Properties & Fields + /// + public object DeviceId => Lighting; + /// public RGBDeviceType DeviceType { get; } diff --git a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs index f0d5c15..eda003f 100644 --- a/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Msi/Generic/MsiRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.Msi { #region Properties & Fields + /// + public object DeviceId => MsiDeviceType; + /// public RGBDeviceType DeviceType { get; } diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs index c1904eb..ee8a7ea 100644 --- a/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs +++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDevice.cs @@ -58,7 +58,7 @@ namespace RGB.NET.Devices.Novation } if (DeviceInfo.ColorCapabilities == NovationColorCapabilities.LimitedRG) - UpdateQueue = new LimitedColorUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + UpdateQueue = new LimitedColorUpdateQueue(updateTrigger, DeviceInfo.MidiDeviceId); } /// diff --git a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs index c419719..991582d 100644 --- a/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Novation/Generic/NovationRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.Novation { #region Properties & Fields + /// + public object DeviceId => MidiDeviceId; + /// public RGBDeviceType DeviceType { get; } @@ -37,7 +40,7 @@ namespace RGB.NET.Devices.Novation /// /// Gets the (midi)-id of the .. /// - public int DeviceId { get; } + public int MidiDeviceId { get; } #endregion @@ -54,7 +57,7 @@ namespace RGB.NET.Devices.Novation { this.DeviceType = deviceType; this.Model = model; - this.DeviceId = deviceId; + this.MidiDeviceId = deviceId; this.ColorCapabilities = colorCapabilities; } diff --git a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs index 069aab8..bf0008e 100644 --- a/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs +++ b/RGB.NET.Devices.Razer/ChromaLink/RazerChromaLinkRGBDevice.cs @@ -42,7 +42,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Custom1; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerChromaLinkUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerChromaLinkUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs index 2385b01..5ab0d43 100644 --- a/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Razer/Generic/RazerRGBDeviceInfo.cs @@ -11,10 +11,13 @@ namespace RGB.NET.Devices.Razer { #region Properties & Fields + /// + public object DeviceId => RazerDeviceId; + /// /// Gets the Id of the . /// - public Guid DeviceId { get; } + public Guid RazerDeviceId { get; } /// public RGBDeviceType DeviceType { get; } @@ -46,7 +49,7 @@ namespace RGB.NET.Devices.Razer /// The model of the . internal RazerRGBDeviceInfo(Guid deviceId, RGBDeviceType deviceType, string model) { - this.DeviceId = deviceId; + this.RazerDeviceId = deviceId; this.DeviceType = deviceType; this.Model = model; } diff --git a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs index a5ef0ab..cbdef3b 100644 --- a/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Headset/RazerHeadsetRGBDevice.cs @@ -42,7 +42,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Headset1; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerHeadsetUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerHeadsetUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs index 763fd47..5f6ebbd 100644 --- a/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keyboard/RazerKeyboardRGBDevice.cs @@ -48,7 +48,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keyboard_Escape; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeyboardUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeyboardUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs index 589faae..3ccf566 100644 --- a/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Keypad/RazerKeypadRGBDevice.cs @@ -45,7 +45,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Keypad1; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeypadUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerKeypadUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs index 2eeba61..7269b04 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs @@ -45,7 +45,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMouseUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMouseUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs index d0d8e1c..000d7e6 100644 --- a/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mousepad/RazerMousepadRGBDevice.cs @@ -42,7 +42,7 @@ namespace RGB.NET.Devices.Razer protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mousepad1; /// - protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMousepadUpdateQueue(updateTrigger, DeviceInfo.DeviceId); + protected override RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger) => new RazerMousepadUpdateQueue(updateTrigger, DeviceInfo.RazerDeviceId); #endregion } diff --git a/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDeviceInfo.cs b/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDeviceInfo.cs index a878d09..f017e48 100644 --- a/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDeviceInfo.cs +++ b/RGB.NET.Devices.SoIP/Client/SoIPClientRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.SoIP.Client { #region Properties & Fields + /// + public object DeviceId => $"{Hostname}:{Port}"; + /// public RGBDeviceType DeviceType => RGBDeviceType.Unknown; diff --git a/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDeviceInfo.cs b/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDeviceInfo.cs index 25db97e..ee2d548 100644 --- a/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDeviceInfo.cs +++ b/RGB.NET.Devices.SoIP/Server/SoIPServerRGBDeviceInfo.cs @@ -11,6 +11,9 @@ namespace RGB.NET.Devices.SoIP.Server { #region Properties & Fields + /// + public object DeviceId => Port; + /// public RGBDeviceType DeviceType => RGBDeviceType.Unknown;