mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-12 17:48:31 +00:00
Fixed code issues
This commit is contained in:
parent
59e11e5b82
commit
7c0a216ccd
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusDramRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the DRAM.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusDramRGBDevice(AsusRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="AsusRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Asus for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected AsusRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new AsusUpdateQueue(updateTrigger, info.Device))
|
||||
{ }
|
||||
|
||||
@ -23,8 +23,12 @@ namespace RGB.NET.Devices.Asus
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SDK-aura-device this device represents.
|
||||
/// </summary>
|
||||
public IAuraSyncDevice Device { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -21,6 +21,8 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusHeadsetRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the headset.</param>
|
||||
/// <param name="baseLedId">The ledId of the first led of this device. All other leds are created by incrementing this base-id by 1.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusUnspecifiedRGBDevice(AsusRGBDeviceInfo info, LedId baseLedId, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -25,6 +25,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="AsusUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="device">The SDK-aura-device this device represents.</param>
|
||||
public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger, IAuraSyncDevice device)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusGraphicsCardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the graphics card.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusGraphicsCardRGBDevice(AsusRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusHeadsetRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the headset.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusHeadsetRGBDevice(AsusRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -31,9 +31,10 @@ namespace RGB.NET.Devices.Asus
|
||||
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of extra LED mappings to apply to modes that match the provided regex
|
||||
/// <para>Note: These LED mappings should be based on light indexes</para>
|
||||
/// Gets or sets a list of extra LED mappings to apply to modes that match the provided regex.
|
||||
/// <para>Note: These LED mappings should be based on light indexes.</para>
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static readonly List<AsusKeyboardExtraMapping> ExtraLedMappings = new()
|
||||
{
|
||||
new AsusKeyboardExtraMapping(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15)
|
||||
@ -48,6 +49,8 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the keyboard.</param>
|
||||
/// <param name="ledMapping">A mapping of leds this device is initialized with.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusKeyboardRGBDevice(AsusKeyboardRGBDeviceInfo info, LedMapping<AsusLedId>? ledMapping, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMainboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the mainboard.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusMainboardRGBDevice(AsusRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Asus
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Asus.AsusMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the mouse.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal AsusMouseRGBDevice(AsusRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -53,12 +53,14 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
_CoolerMasterSDK.Reload();
|
||||
if (_CoolerMasterSDK.GetSDKVersion() <= 0) Throw(new RGBDeviceException("Failed to initialize CoolerMaster-SDK"), true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
foreach (CoolerMasterDevicesIndexes index in Enum.GetValues(typeof(CoolerMasterDevicesIndexes)))
|
||||
|
||||
@ -17,6 +17,7 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
/// Initializes a new instance of the <see cref="CoolerMasterRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by CoolerMaster for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected CoolerMasterRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new CoolerMasterUpdateQueue(updateTrigger, info.DeviceIndex))
|
||||
{ }
|
||||
|
||||
@ -22,6 +22,7 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.CoolerMaster.CoolerMasterKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CoolerMaster for the keyboard</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal CoolerMasterKeyboardRGBDevice(CoolerMasterKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -63,6 +63,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
_CUESDK.Reload();
|
||||
@ -193,6 +194,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Reset()
|
||||
{
|
||||
ProtocolDetails = null;
|
||||
|
||||
@ -17,8 +17,19 @@ namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the corsair-id of the first LED of this device.
|
||||
/// </summary>
|
||||
public CorsairLedId ReferenceCorsairLed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of LEDs this device contains.
|
||||
/// </summary>
|
||||
public int LedCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the offset used to access the LEDs of this device.
|
||||
/// </summary>
|
||||
internal int LedOffset { get; }
|
||||
|
||||
#endregion
|
||||
@ -33,7 +44,8 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair._CorsairChannelDeviceInfo" />.</param>
|
||||
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
|
||||
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
|
||||
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
|
||||
/// <param name="referenceCorsairLed">The id of the first LED of this device.</param>
|
||||
/// <param name="ledOffset">The offset used to find the LEDs of this device.</param>
|
||||
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo, CorsairLedId referenceCorsairLed, 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))
|
||||
|
||||
@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mapping of <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.
|
||||
/// </summary>
|
||||
protected LedMapping<CorsairLedId> Mapping { get; }
|
||||
|
||||
#endregion
|
||||
@ -24,6 +27,8 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// Initializes a new instance of the <see cref="CorsairRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by CUE for the device.</param>
|
||||
/// <param name="mapping">The mapping <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.</param>
|
||||
/// <param name="updateQueue">The queue used to update this device.</param>
|
||||
protected CorsairRGBDevice(TDeviceInfo info, LedMapping<CorsairLedId> mapping, CorsairDeviceUpdateQueue updateQueue)
|
||||
: base(info, updateQueue)
|
||||
{
|
||||
@ -35,7 +40,10 @@ namespace RGB.NET.Devices.Corsair
|
||||
#region Methods
|
||||
|
||||
void ICorsairRGBDevice.Initialize() => InitializeLayout();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the LEDs of the device based on the data provided by the SDK.
|
||||
/// </summary>
|
||||
protected virtual void InitializeLayout()
|
||||
{
|
||||
_CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
|
||||
|
||||
@ -23,7 +23,7 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keyboard</param>
|
||||
/// <param name="info">The specific information provided by CUE for the keyboard.</param>
|
||||
/// <param name="updateQueue">The queue used to update this device.</param>
|
||||
internal CorsairKeyboardRGBDevice(CorsairKeyboardRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue)
|
||||
: base(info, LedMappings.Keyboard, updateQueue)
|
||||
|
||||
@ -51,8 +51,10 @@ namespace RGB.NET.Devices.DMX
|
||||
/// <param name="deviceDefinition">The <see cref="IDMXDeviceDefinition"/> to add.</param>
|
||||
public void AddDeviceDefinition(IDMXDeviceDefinition deviceDefinition) => DeviceDefinitions.Add(deviceDefinition);
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
foreach (IDMXDeviceDefinition dmxDeviceDefinition in DeviceDefinitions)
|
||||
|
||||
@ -33,6 +33,7 @@ namespace RGB.NET.Devices.DMX.E131
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -55,8 +55,10 @@ namespace RGB.NET.Devices.Debug
|
||||
/// </summary>
|
||||
public void ClearFakeDeviceDefinitions() => _fakeDeviceDefinitions.Clear();
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
foreach ((IDeviceLayout layout, Action<IEnumerable<Led>>? updateLedsAction) in _fakeDeviceDefinitions)
|
||||
|
||||
@ -13,6 +13,9 @@ namespace RGB.NET.Devices.Debug
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the layour used to describe this debug device.
|
||||
/// </summary>
|
||||
public IDeviceLayout Layout { get; }
|
||||
|
||||
private Action<IEnumerable<Led>>? _updateLedsAction;
|
||||
|
||||
@ -22,6 +22,7 @@ namespace RGB.NET.Devices.Debug
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
#endregion
|
||||
@ -34,6 +35,7 @@ namespace RGB.NET.Devices.Debug
|
||||
/// <param name="deviceType">The <see cref="RGBDeviceType"/> of the device.</param>
|
||||
/// <param name="manufacturer">The manufacturer of the device.</param>
|
||||
/// <param name="model">The model of the device.</param>
|
||||
/// <param name="customData">Some custom data for this device provided by the layout.</param>
|
||||
internal DebugRGBDeviceInfo(RGBDeviceType deviceType, string manufacturer, string model, object? customData)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
#pragma warning disable 1591
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains list of available logitech device types.
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// Initializes a new instance of the <see cref="LogitechRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Logitech for the device.</param>
|
||||
/// <param name="updateQueue">The queue used to update this device.</param>
|
||||
protected LogitechRGBDevice(TDeviceInfo info, IUpdateQueue updateQueue)
|
||||
: base(info, updateQueue)
|
||||
{ }
|
||||
|
||||
@ -22,6 +22,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -45,8 +46,6 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <param name="model">The represented device model.</param>
|
||||
/// <param name="deviceCaps">The lighting-capabilities of the device.</param>
|
||||
/// <param name="zones">The amount of zones the device is able to control.</param>
|
||||
/// <param name="imageLayout">The layout used to decide which images to load.</param>
|
||||
/// <param name="layoutPath">The path/name of the layout-file.</param>
|
||||
internal LogitechRGBDeviceInfo(RGBDeviceType deviceType, string model, LogitechDeviceCaps deviceCaps, int zones)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
|
||||
@ -42,6 +42,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
|
||||
private const int VENDOR_ID = 0x046D;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for per-key-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<LogitechLedId, int> PerKeyDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC32B, RGBDeviceType.Keyboard, "G910", LedMappings.PerKey, 0 },
|
||||
@ -60,6 +63,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
{ 0xC545, RGBDeviceType.Keyboard, "Lightspeed Keyboard Dongle", LedMappings.PerKey, 0 },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for per-zone-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<int, (LogitechDeviceType deviceType, int zones)> PerZoneDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC336, RGBDeviceType.Keyboard, "G213", LedMappings.ZoneKeyboard, (LogitechDeviceType.Keyboard, 2) },
|
||||
@ -83,6 +89,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
{ 0xAB5, RGBDeviceType.Speaker, "G733", LedMappings.ZoneSpeaker, (LogitechDeviceType.Speaker, 2) },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for per-device-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<int, int> PerDeviceDeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
{ 0xC228, RGBDeviceType.Keyboard, "G19", LedMappings.Device, 0 },
|
||||
@ -117,6 +126,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
_perDeviceUpdateQueue = new LogitechPerDeviceUpdateQueue(GetUpdateTrigger());
|
||||
@ -128,6 +138,7 @@ namespace RGB.NET.Devices.Logitech
|
||||
_LogitechGSDK.LogiLedSaveCurrentLighting();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
PerKeyDeviceDefinitions.LoadFilter = loadFilter;
|
||||
@ -136,8 +147,8 @@ namespace RGB.NET.Devices.Logitech
|
||||
|
||||
return base.GetLoadedDevices(loadFilter);
|
||||
}
|
||||
|
||||
//TODO DarthAffe 04.03.2021: Rework device selection and configuration for HID-based providers
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
(HIDDeviceDefinition<LogitechLedId, int> definition, HidDevice device) perKeyDevice = PerKeyDeviceDefinitions.GetConnectedDevices().FirstOrDefault();
|
||||
|
||||
@ -15,6 +15,7 @@ namespace RGB.NET.Devices.Msi
|
||||
/// Initializes a new instance of the <see cref="MsiRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by MSI for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected MsiRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new MsiDeviceUpdateQueue(updateTrigger, info.MsiDeviceType))
|
||||
{ }
|
||||
|
||||
@ -16,6 +16,8 @@ namespace RGB.NET.Devices.Msi
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiGraphicsCardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by MSI for graphics cards.</param>
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal MsiGraphicsCardRGBDevice(MsiRGBDeviceInfo info, int ledCount, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -16,6 +16,8 @@ namespace RGB.NET.Devices.Msi
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiMainboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by MSI for the mainboard.</param>
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal MsiMainboardRGBDevice(MsiRGBDeviceInfo info, int ledCount, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -16,6 +16,8 @@ namespace RGB.NET.Devices.Msi
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by MSI for the mouse.</param>
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal MsiMouseRGBDevice(MsiRGBDeviceInfo info, int ledCount, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -53,6 +53,7 @@ namespace RGB.NET.Devices.Msi
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
_MsiSDK.Reload();
|
||||
@ -62,6 +63,7 @@ namespace RGB.NET.Devices.Msi
|
||||
ThrowMsiError(errorCode, true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
int errorCode;
|
||||
|
||||
@ -51,11 +51,11 @@ namespace RGB.NET.Devices.Novation
|
||||
_outputDevice.SendShort(message.Message);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a update-message out of a specified data set.
|
||||
/// </summary>
|
||||
/// <param name="data">The data set to create the message from.</param>
|
||||
/// <param name="key">The key used to identify the LED to update.</param>
|
||||
/// <param name="color">The color to send.</param>
|
||||
/// <returns>The message created out of the data set.</returns>
|
||||
protected abstract ShortMessage? CreateMessage(object key, in Color color);
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ namespace RGB.NET.Devices.Novation
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Novation.NovationLaunchpadRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Novation for the launchpad</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal NovationLaunchpadRGBDevice(NovationLaunchpadRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
@ -44,8 +45,13 @@ namespace RGB.NET.Devices.Novation
|
||||
protected override object GetLedCustomData(LedId ledId) => GetDeviceMapping().TryGetValue(ledId, out (byte mode, byte id, int _, int __) data) ? (data.mode, data.id) : ((byte)0x00, (byte)0x00);
|
||||
// ReSharper restore RedundantCast
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mapping used to access the LEDs of the device based on <see cref="NovationLaunchpadRGBDeviceInfo.LedMapping"/>.
|
||||
/// </summary>
|
||||
/// <returns>The mapping of the device.</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Thrown if the value of <see cref="NovationLaunchpadRGBDeviceInfo.LedMapping"/> is not known.</exception>
|
||||
protected virtual Dictionary<LedId, (byte mode, byte id, int x, int y)> GetDeviceMapping()
|
||||
=> DeviceInfo.LedIdMapping switch
|
||||
=> DeviceInfo.LedMapping switch
|
||||
{
|
||||
LedIdMappings.Current => LaunchpadIdMapping.CURRENT,
|
||||
LedIdMappings.Legacy => LaunchpadIdMapping.LEGACY,
|
||||
|
||||
@ -10,7 +10,7 @@ namespace RGB.NET.Devices.Novation
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
internal LedIdMappings LedIdMapping { get; }
|
||||
internal LedIdMappings LedMapping { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -23,11 +23,11 @@ namespace RGB.NET.Devices.Novation
|
||||
/// <param name="model">The represented device model.</param>
|
||||
/// <param name="deviceId"></param>
|
||||
/// <param name="colorCapabilities">The <see cref="T:RGB.NET.Devices.Novation.NovationColorCapabilities" /> of the <see cref="T:RGB.NET.Core.IRGBDevice" />.</param>
|
||||
internal NovationLaunchpadRGBDeviceInfo(string model, int deviceId, NovationColorCapabilities colorCapabilities,
|
||||
LedIdMappings ledIdMapping)
|
||||
/// <param name="ledMapping">A mapping of leds this device is initialized with.</param>
|
||||
internal NovationLaunchpadRGBDeviceInfo(string model, int deviceId, NovationColorCapabilities colorCapabilities, LedIdMappings ledMapping)
|
||||
: base(RGBDeviceType.LedMatrix, model, deviceId, colorCapabilities)
|
||||
{
|
||||
this.LedIdMapping = ledIdMapping;
|
||||
this.LedMapping = ledMapping;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -41,8 +41,10 @@ namespace RGB.NET.Devices.Novation
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
for (int index = 0; index < OutputDeviceBase.DeviceCount; index++)
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
#pragma warning disable 1591
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains a list of possible ways of communication with the device.
|
||||
/// </summary>
|
||||
public enum UpdateMode
|
||||
{
|
||||
Auto = 0x00,
|
||||
|
||||
@ -3,6 +3,13 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for Pico-Pi bulk-devices.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Using this requires the libusb driver to be installed!
|
||||
/// </remarks>
|
||||
public class PicoPiBulkUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -16,6 +23,13 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PicoPiBulkUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="sdk">The sdk used to access the device.</param>
|
||||
/// <param name="channel">The channel to update.</param>
|
||||
/// <param name="ledCount">The maximum amount of leds to update.</param>
|
||||
public PicoPiBulkUpdateQueue(IDeviceUpdateTrigger updateTrigger, PicoPiSDK sdk, int channel, int ledCount)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
@ -29,6 +43,7 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
Span<byte> buffer = _dataBuffer;
|
||||
|
||||
@ -3,6 +3,10 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for Pico-Pi HID-devices.
|
||||
/// </summary>
|
||||
public class PicoPiHIDUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constants
|
||||
@ -22,6 +26,13 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PicoPiHIDUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="sdk">The sdk used to access the device.</param>
|
||||
/// <param name="channel">The channel to update.</param>
|
||||
/// <param name="ledCount">The maximum amount of leds to update.</param>
|
||||
public PicoPiHIDUpdateQueue(IDeviceUpdateTrigger updateTrigger, PicoPiSDK sdk, int channel, int ledCount)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
@ -35,6 +46,7 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(in ReadOnlySpan<(object key, Color color)> dataSet)
|
||||
{
|
||||
Span<byte> buffer = _dataBuffer;
|
||||
|
||||
@ -2,6 +2,10 @@
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <inheritdoc cref="AbstractRGBDevice{PicoPiRGBDeviceInfo}" />
|
||||
/// <summary>
|
||||
/// Represents a device based on an Raspberry Pi Pico.
|
||||
/// </summary>
|
||||
public class PicoPiRGBDevice : AbstractRGBDevice<PicoPiRGBDeviceInfo>
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -12,6 +16,13 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PicoPiRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="deviceInfo">The device info of this device.</param>
|
||||
/// <param name="updateQueue">The queue used to update this device.</param>
|
||||
/// <param name="ledMapping">A mapping of leds this device is initialized with.</param>
|
||||
public PicoPiRGBDevice(PicoPiRGBDeviceInfo deviceInfo, IUpdateQueue updateQueue, LedMapping<int> ledMapping)
|
||||
: base(deviceInfo, updateQueue)
|
||||
{
|
||||
|
||||
@ -2,19 +2,46 @@
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic information for a <see cref="PicoPiRGBDevice" />.
|
||||
/// </summary>
|
||||
public class PicoPiRGBDeviceInfo : IRGBDeviceInfo
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <inheritdoc />
|
||||
public RGBDeviceType DeviceType { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DeviceName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Manufacturer => "RGB.NET";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Model { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the device.
|
||||
/// </summary>
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the device firmware.
|
||||
/// </summary>
|
||||
public int Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the channel this device is using.
|
||||
/// </summary>
|
||||
public int Channel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of LEDs on this device.
|
||||
/// </summary>
|
||||
public int LedCount { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -9,6 +9,9 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.PicoPi
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SDK to access devices based on a Raspberry Pi Pico.
|
||||
/// </summary>
|
||||
public class PicoPiSDK : IDisposable
|
||||
{
|
||||
#region Constants
|
||||
@ -49,16 +52,34 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
private int _bulkTransferLength;
|
||||
|
||||
/// <summary>
|
||||
/// Gets if updates via the Bulk-Enbpoint are possible.
|
||||
/// </summary>
|
||||
public bool IsBulkSupported { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the device.
|
||||
/// </summary>
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version of the device firmware.
|
||||
/// </summary>
|
||||
public int Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of channels, led counts and pins that are available on this device.
|
||||
/// </summary>
|
||||
public IReadOnlyList<(int channel, int ledCount, int pin)> Channels { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PicoPiSDK" /> class.
|
||||
/// </summary>
|
||||
/// <param name="device">The underlying hid device.</param>
|
||||
public PicoPiSDK(HidDevice device)
|
||||
{
|
||||
this._hidDevice = device;
|
||||
@ -79,6 +100,11 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Configures the amount of leds to update on the specified channels.
|
||||
/// </summary>
|
||||
/// <remarks>This is a configuration function. The value is persistent on the device.</remarks>
|
||||
/// <param name="ledCounts">The values to set on the device.</param>
|
||||
public void SetLedCounts(params (int channel, int ledCount)[] ledCounts)
|
||||
{
|
||||
byte[] data = new byte[Channels.Count + 2];
|
||||
@ -92,6 +118,11 @@ namespace RGB.NET.Devices.PicoPi
|
||||
SendHID(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures the pins used by the specified channels.
|
||||
/// </summary>
|
||||
/// <remarks>This is a configuration function. The value is persistent on the device.</remarks>
|
||||
/// <param name="pins">T values to set on the device.</param>
|
||||
public void SetPins(params (int channel, int pin)[] pins)
|
||||
{
|
||||
byte[] data = new byte[Channels.Count + 2];
|
||||
@ -173,6 +204,13 @@ namespace RGB.NET.Devices.PicoPi
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a update to the device using the HID-endpoint.
|
||||
/// </summary>
|
||||
/// <param name="data">The data packet to send.</param>
|
||||
/// <param name="channel">The channel to update.</param>
|
||||
/// <param name="chunk">The chunk id of the packet. (Required if packets are fragmented.)</param>
|
||||
/// <param name="update">A value indicating if the device should update directly after receiving this packet. (If packets are fragmented this should only be true for the last chunk.)</param>
|
||||
public void SendHidUpdate(in Span<byte> data, int channel, int chunk, bool update)
|
||||
{
|
||||
if (data.Length == 0) return;
|
||||
@ -186,6 +224,14 @@ namespace RGB.NET.Devices.PicoPi
|
||||
SendHID(_hidSendBuffer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a update to the device using the bulk-endpoint.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Silently fails if not bulk-updates are supported. (Check <see cref="IsBulkSupported"/>)
|
||||
/// </remarks>
|
||||
/// <param name="data">The data packet to send.</param>
|
||||
/// <param name="channel">The channel to update.</param>
|
||||
public void SendBulkUpdate(in Span<byte> data, int channel)
|
||||
{
|
||||
if ((data.Length == 0) || !IsBulkSupported) return;
|
||||
@ -200,6 +246,9 @@ namespace RGB.NET.Devices.PicoPi
|
||||
_bulkTransferLength += payloadSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flushing the bulk endpoint, causing the device to update.
|
||||
/// </summary>
|
||||
public void FlushBulk()
|
||||
{
|
||||
if (_bulkTransferLength == 0) return;
|
||||
@ -216,6 +265,7 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
private byte[] Read() => _hidStream.Read();
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
_hidStream.Dispose();
|
||||
|
||||
@ -31,6 +31,9 @@ namespace RGB.NET.Devices.PicoPi
|
||||
/// </summary>
|
||||
public static PicoPiDeviceProvider Instance => _instance ?? new PicoPiDeviceProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for PicoPi-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<int, int> DeviceDefinitions { get; } = new(PicoPiSDK.VENDOR_ID)
|
||||
{
|
||||
{ PicoPiSDK.HID_BULK_CONTROLLER_PID, RGBDeviceType.LedStripe, "WS2812B-Controller", LedMappings.StripeMapping, 0 },
|
||||
@ -38,6 +41,10 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
private readonly List<PicoPiSDK> _sdks = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the endpoint used to update devices. (default <see cref="PicoPi.Enum.UpdateMode.Auto"/>).
|
||||
/// If auto is set it automatically is using bulk-updates for devies with more than 40 LEDs if supported. Else HID is used.
|
||||
/// </summary>
|
||||
public UpdateMode UpdateMode { get; set; } = UpdateMode.Auto;
|
||||
|
||||
#endregion
|
||||
@ -58,6 +65,7 @@ namespace RGB.NET.Devices.PicoPi
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK() { }
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -108,6 +116,7 @@ namespace RGB.NET.Devices.PicoPi
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
@ -19,6 +19,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerChromaLinkRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the chroma link.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal RazerChromaLinkRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerChromaLinkUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -19,6 +19,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerHeadsetRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the headset.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal RazerHeadsetRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerHeadsetUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -27,6 +27,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keyboard.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
/// <param name="ledMapping">A mapping of leds this device is initialized with.</param>
|
||||
internal RazerKeyboardRGBDevice(RazerKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping<int> ledMapping)
|
||||
: base(info, new RazerKeyboardUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -19,6 +19,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerKeypadRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the keypad.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal RazerKeypadRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerKeypadUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -25,6 +25,8 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerMouseRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mouse.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
/// <param name="ledMapping">A mapping of leds this device is initialized with.</param>
|
||||
internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping<int> ledMapping)
|
||||
: base(info, new RazerMouseUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -19,6 +19,7 @@ namespace RGB.NET.Devices.Razer
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Razer.RazerMousepadRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mousepad.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal RazerMousepadRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new RazerMousepadUpdateQueue(updateTrigger))
|
||||
{
|
||||
|
||||
@ -44,6 +44,9 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
private const int VENDOR_ID = 0x1532;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for Razer-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<int, RazerEndpointType> DeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
// Keyboards
|
||||
@ -214,6 +217,7 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
TryUnInit();
|
||||
@ -225,6 +229,7 @@ namespace RGB.NET.Devices.Razer
|
||||
ThrowRazerError(error, true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
|
||||
{
|
||||
DeviceDefinitions.LoadFilter = loadFilter;
|
||||
@ -250,6 +255,7 @@ namespace RGB.NET.Devices.Razer
|
||||
return devices;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
// Only take the first device of each endpoint type, the Razer SDK doesn't allow separate control over multiple devices using the same endpoint
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace RGB.NET.Devices.SteelSeries
|
||||
#pragma warning disable 1591
|
||||
|
||||
namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
// DarthAffe 09.07.2020: Review the LISP-Handler in SteelSeriesSDK after adding new device-types! They need to be initialized.
|
||||
public enum SteelSeriesDeviceType
|
||||
|
||||
@ -25,6 +25,9 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// <inheritdoc />
|
||||
public object? LayoutMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of this device used in the SDK.
|
||||
/// </summary>
|
||||
public SteelSeriesDeviceType SteelSeriesDeviceType { get; }
|
||||
|
||||
#endregion
|
||||
@ -36,9 +39,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
/// </summary>
|
||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The represented device model.</param>
|
||||
/// <param name="deviceCaps">The lighting-capabilities of the device.</param>
|
||||
/// <param name="imageLayout">The layout used to decide which images to load.</param>
|
||||
/// <param name="layoutPath">The path/name of the layout-file.</param>
|
||||
/// <param name="steelSeriesDeviceType">The type of this device used in the SDK.</param>
|
||||
internal SteelSeriesRGBDeviceInfo(RGBDeviceType deviceType, string model, SteelSeriesDeviceType steelSeriesDeviceType)
|
||||
{
|
||||
this.DeviceType = deviceType;
|
||||
|
||||
@ -8,7 +8,7 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a device provider responsible for SteelSeries- devices.
|
||||
/// Represents a device provider responsible for SteelSeries-devices.
|
||||
/// </summary>
|
||||
public class SteelSeriesDeviceProvider : AbstractRGBDeviceProvider
|
||||
{
|
||||
@ -22,6 +22,9 @@ namespace RGB.NET.Devices.SteelSeries
|
||||
|
||||
private const int VENDOR_ID = 0x1038;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HID-definitions for SteelSeries-devices.
|
||||
/// </summary>
|
||||
public static HIDLoader<SteelSeriesLedId, SteelSeriesDeviceType> DeviceDefinitions { get; } = new(VENDOR_ID)
|
||||
{
|
||||
//Mice
|
||||
|
||||
@ -26,9 +26,10 @@ namespace RGB.NET.Devices.WS281X.Arduino
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ArduinoWS2812USBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deviceInfo">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceInfo">The device info of this device.</param>
|
||||
/// <param name="updateQueue">The update queue performing updates for this device.</param>
|
||||
/// <param name="channel">The channel (as defined in the arduino-sketch) this device is attached to.</param>
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
public ArduinoWS2812USBDevice(ArduinoWS2812USBDeviceInfo deviceInfo, ArduinoWS2812USBUpdateQueue updateQueue, int channel, int ledCount)
|
||||
: base(deviceInfo, updateQueue)
|
||||
{
|
||||
|
||||
@ -31,8 +31,7 @@ namespace RGB.NET.Devices.WS281X.Arduino
|
||||
/// Initializes a new instance of the <see cref="ArduinoWS2812USBUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="portName">The name of the serial-port to connect to.</param>
|
||||
/// <param name="baudRate">The baud-rate used by the serial-connection.</param>
|
||||
/// <param name="serialConnection">The serial connection used to access the device.</param>
|
||||
public ArduinoWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
|
||||
: base(updateTrigger, serialConnection)
|
||||
{ }
|
||||
|
||||
@ -24,8 +24,10 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BitwizardWS2812USBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deviceInfo">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceInfo">The device info of this device.</param>
|
||||
/// <param name="updateQueue">The update queue performing updates for this device.</param>
|
||||
/// <param name="ledOffset">The offset used to access the leds on this device.</param>
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
public BitwizardWS2812USBDevice(BitwizardWS2812USBDeviceInfo deviceInfo, BitwizardWS2812USBUpdateQueue updateQueue, int ledOffset, int ledCount)
|
||||
: base(deviceInfo, updateQueue)
|
||||
{
|
||||
|
||||
@ -17,8 +17,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.WS281X.Bitwizard.BitwizardWS2812USBUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="portName">The name of the serial-port to connect to.</param>
|
||||
/// <param name="baudRate">The baud-rate used by the serial-connection.</param>
|
||||
/// <param name="serialConnection">The serial connection used to access the device.</param>
|
||||
public BitwizardWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
|
||||
: base(updateTrigger, serialConnection)
|
||||
{ }
|
||||
|
||||
@ -36,6 +36,9 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of LED-strips configured on this device.
|
||||
/// </summary>
|
||||
public List<(int pin, int stripLength)> Strips { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
@ -52,6 +55,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
|
||||
/// Initializes a new instance of the <see cref="BitwizardWS281XDeviceDefinition"/> class.
|
||||
/// </summary>
|
||||
/// <param name="serialConnection">The serial connection used for the device.</param>
|
||||
/// <param name="strips">A list of LED-strips connected to this device.</param>
|
||||
public BitwizardWS281XDeviceDefinition(ISerialConnection serialConnection, params (int pin, int stripLength)[] strips)
|
||||
{
|
||||
this.SerialConnection = serialConnection;
|
||||
@ -64,6 +68,7 @@ namespace RGB.NET.Devices.WS281X.Bitwizard
|
||||
/// </summary>
|
||||
/// <param name="port">The name of the serial-port to connect to.</param>
|
||||
/// <param name="baudRate">The baud-rate of the serial-connection.</param>
|
||||
/// <param name="strips">A list of LED-strips connected to this device.</param>
|
||||
public BitwizardWS281XDeviceDefinition(string port, int baudRate = 115200, params (int pin, int stripLength)[] strips)
|
||||
{
|
||||
SerialConnection = new SerialPortConnection(port, baudRate);
|
||||
|
||||
@ -28,6 +28,11 @@ namespace RGB.NET.Devices.WS281X
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SerialPortConnection"/> class.
|
||||
/// </summary>
|
||||
/// <param name="port">The name of the serial-port to connect to.</param>
|
||||
/// <param name="baudRate">The baud-rate used by the serial-connection.</param>
|
||||
public SerialPortConnection(string port, int baudRate)
|
||||
{
|
||||
SerialPort = new SerialPort(port, baudRate);
|
||||
|
||||
@ -33,8 +33,7 @@ namespace RGB.NET.Devices.WS281X
|
||||
/// Initializes a new instance of the <see cref="SerialConnectionUpdateQueue{TData}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="portName">The name of the serial-port to connect to.</param>
|
||||
/// <param name="baudRate">The baud-rate used by the serial-connection.</param>
|
||||
/// <param name="serialConnection">The serial connection used to access the device.</param>
|
||||
internal SerialConnectionUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
|
||||
@ -28,11 +28,12 @@ namespace RGB.NET.Devices.WS281X.NodeMCU
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeMCUWS2812USBDevice"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deviceInfo">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceInfo">The device info of this device.</param>
|
||||
/// <param name="updateQueue">The update queue performing updates for this device.</param>
|
||||
/// <param name="channel">The channel (as defined in the NodeMCU-sketch) this device is attached to.</param>
|
||||
public NodeMCUWS2812USBDevice(NodeMCUWS2812USBDeviceInfo info, NodeMCUWS2812USBUpdateQueue updateQueue, int channel, int ledCount)
|
||||
: base(info, updateQueue)
|
||||
/// <param name="ledCount">The amount of leds on this device.</param>
|
||||
public NodeMCUWS2812USBDevice(NodeMCUWS2812USBDeviceInfo deviceInfo, NodeMCUWS2812USBUpdateQueue updateQueue, int channel, int ledCount)
|
||||
: base(deviceInfo, updateQueue)
|
||||
{
|
||||
this.Channel = channel;
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ namespace RGB.NET.Devices.Wooting.Generic
|
||||
/// Initializes a new instance of the <see cref="WootingRGBDevice{TDeviceInfo}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The generic information provided by Wooting for the device.</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
protected WootingRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, new WootingUpdateQueue(updateTrigger))
|
||||
{ }
|
||||
|
||||
@ -24,6 +24,7 @@ namespace RGB.NET.Devices.Wooting.Keyboard
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Wooting.Keyboard.WootingKeyboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Wooting for the keyboard</param>
|
||||
/// <param name="updateTrigger">The update trigger used to update this device.</param>
|
||||
internal WootingKeyboardRGBDevice(WootingKeyboardRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger)
|
||||
: base(info, updateTrigger)
|
||||
{
|
||||
|
||||
@ -23,7 +23,6 @@ namespace RGB.NET.Devices.Wooting.Keyboard
|
||||
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Wooting.WootingKeyboardRGBDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Wooting.WootingKeyboardRGBDevice" />.</param>
|
||||
/// <param name="physicalKeyboardLayout">The <see cref="T:RGB.NET.Devices.Wooting.WootingPhysicalKeyboardLayout" /> of the <see cref="T:RGB.NET.Devices.Wooting.WootingKeyboardRGBDevice" />.</param>
|
||||
internal WootingKeyboardRGBDeviceInfo(WootingDevicesIndexes deviceIndex)
|
||||
: base(RGBDeviceType.Keyboard, deviceIndex)
|
||||
{ }
|
||||
|
||||
@ -53,6 +53,7 @@ namespace RGB.NET.Devices.Wooting
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeSDK()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
@ -61,6 +62,7 @@ namespace RGB.NET.Devices.Wooting
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||
{
|
||||
lock (_WootingSDK.SdkLock)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user