using System;
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.DMX.E131;
///
/// Represents a E1.31-DXM-device.
///
public sealed class E131Device : AbstractRGBDevice, IUnknownDevice
{
#region Properties & Fields
private readonly Dictionary getValueFunc)>> _ledMappings;
#endregion
#region Constructors
///
internal E131Device(E131DeviceInfo deviceInfo, Dictionary getValueFunc)>> ledMappings, IDeviceUpdateTrigger updateTrigger)
: base(deviceInfo, new E131UpdateQueue(updateTrigger, deviceInfo.Hostname, deviceInfo.Port))
{
this._ledMappings = ledMappings;
InitializeLayout();
E131UpdateQueue updateQueue = (E131UpdateQueue)UpdateQueue;
updateQueue.DataPacket.SetCID(DeviceInfo.CID);
updateQueue.DataPacket.SetUniverse(DeviceInfo.Universe);
}
#endregion
#region Methods
private void InitializeLayout()
{
int count = 0;
foreach (LedId id in _ledMappings.Keys)
AddLed(id, new Point((count++) * 10, 0), new Size(10, 10));
}
///
protected override object GetLedCustomData(LedId ledId) => new LedChannelMapping(_ledMappings[ledId]);
#endregion
}