Added OpenRGB device provider

This commit is contained in:
Diogo Trindade committed 2022-09-25 15:25:20 +01:00
1 parent a9adf9763c
commit 2d203d31ab
14 files changed
+770

No files matched your search

@@ -0,0 +1,25 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB
{
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a generic OpenRGB Device.
/// </summary>
public abstract class AbstractOpenRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IOpenRGBDevice
where TDeviceInfo : AbstractOpenRGBDeviceInfo
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AbstractOpenRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by OpenRGB for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
protected AbstractOpenRGBDevice(TDeviceInfo info, IUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}
}
@@ -0,0 +1,45 @@
using RGB.NET.Core;
using System.Collections.Generic;
using OpenRGBDevice = OpenRGB.NET.Models.Device;
namespace RGB.NET.Devices.OpenRGB
{
/// <summary>
/// Represents generic information for an OpenRGB Device
/// </summary>
public abstract class AbstractOpenRGBDeviceInfo : IRGBDeviceInfo
{
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer { get; }
/// <inheritdoc />
public string Model { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Gets the OpenRGB device.
/// </summary>
public OpenRGBDevice OpenRGBDevice { get; }
/// <summary>
/// Initializes a new instance of <see cref="AbstractOpenRGBDeviceInfo"/>.
/// </summary>
/// <param name="openRGBDevice">The OpenRGB device to extract information from.</param>
protected AbstractOpenRGBDeviceInfo(OpenRGBDevice openRGBDevice)
{
OpenRGBDevice = openRGBDevice;
DeviceType = Helper.GetRgbNetDeviceType(openRGBDevice.Type);
Manufacturer = Helper.GetVendorName(openRGBDevice);
Model = Helper.GetModelName(openRGBDevice);
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
}
}
@@ -0,0 +1,7 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.OpenRGB
{
internal interface IOpenRGBDevice : IRGBDevice
{ }
}