using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
///
///
/// Represents a logitech zone-lightable device.
///
public class LogitechZoneRGBDevice : LogitechRGBDevice, IUnknownDevice //TODO DarthAffe 18.04.2020: It's know which kind of device this is, but they would need to be separated
{
#region Constants
private static readonly Dictionary BASE_LED_MAPPING = new()
{
{ RGBDeviceType.Keyboard, LedId.Keyboard_Programmable1 },
{ RGBDeviceType.Mouse, LedId.Mouse1 },
{ RGBDeviceType.Headset, LedId.Headset1 },
{ RGBDeviceType.Mousepad, LedId.Mousepad1 },
{ RGBDeviceType.Speaker, LedId.Speaker1 }
};
#endregion
#region Properties & Fields
private LedId _baseLedId;
#endregion
#region Constructors
///
///
/// Initializes a new instance of the class.
///
/// The specific information provided by logitech for the zone-lightable device
internal LogitechZoneRGBDevice(LogitechRGBDeviceInfo info, IUpdateQueue updateQueue)
: base(info, updateQueue)
{
_baseLedId = BASE_LED_MAPPING.TryGetValue(info.DeviceType, out LedId id) ? id : LedId.Custom1;
InitializeLayout();
}
#endregion
#region Methods
private void InitializeLayout()
{
for (int i = 0; i < DeviceInfo.Zones; i++)
AddLed(_baseLedId + i, new Point(i * 10, 0), new Size(10, 10));
}
///
protected override object? GetLedCustomData(LedId ledId) => (int)(ledId - _baseLedId);
///
protected override void UpdateLeds(IEnumerable ledsToUpdate) => UpdateQueue.SetData(GetUpdateData(ledsToUpdate));
#endregion
}
}