using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.SteelSeries
{
///
///
///
/// Represents a SteelSeries-device. (keyboard, mouse, headset, mousepad).
///
public class SteelSeriesRGBDevice : AbstractRGBDevice, ISteelSeriesRGBDevice, 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 Dictionary _ledMapping;
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The generic information provided by SteelSeries for the device.
internal SteelSeriesRGBDevice(SteelSeriesRGBDeviceInfo info, string apiName, Dictionary ledMapping, IDeviceUpdateTrigger updateTrigger)
: base(info, new SteelSeriesDeviceUpdateQueue(updateTrigger, apiName))
{
this._ledMapping = ledMapping;
InitializeLayout();
}
#endregion
#region Methods
private void InitializeLayout()
{
int counter = 0;
foreach (KeyValuePair mapping in _ledMapping)
AddLed(mapping.Key, new Point((counter++) * 10, 0), new Size(10, 10));
}
///
protected override object GetLedCustomData(LedId ledId) => _ledMapping[ledId];
///
protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
///
public override void Dispose()
{
try { UpdateQueue?.Dispose(); }
catch { /* at least we tried */ }
base.Dispose();
}
#endregion
}
}