using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech;
///
///
/// Represents a logitech per-key-lightable device.
///
public sealed class LogitechPerKeyRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Properties & Fields
private readonly LedMapping _ledMapping;
#endregion
#region Constructors
///
///
/// Initializes a new instance of the class.
///
internal LogitechPerKeyRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue, LedMapping ledMapping)
: base(info, updateQueue)
{
this._ledMapping = ledMapping;
InitializeLayout();
}
#endregion
#region Methods
private void InitializeLayout()
{
int pos = 0;
foreach ((LedId ledId, LogitechLedId mapping) in _ledMapping)
AddLed(ledId, new Point(pos++ * 19, 0), new Size(19, 19));
}
///
protected override object GetLedCustomData(LedId ledId) => _ledMapping.TryGetValue(ledId, out LogitechLedId logitechLedId) ? logitechLedId : -1;
#endregion
}