using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using RGB.NET.Core;
namespace RGB.NET.Devices.WS281X.NodeMCU
{
// ReSharper disable once InconsistentNaming
///
///
/// Represents the update-queue performing updates for NodeMCU WS2812 devices.
///
public class NodeMCUWS2812USBUpdateQueue : UpdateQueue
{
#region Constants
private static readonly byte UPDATE_COMMAND = 0x02;
#endregion
#region Properties & Fields
private readonly string _hostname;
private readonly UdpClient _udpClient;
private readonly Dictionary _dataBuffer = new Dictionary();
private readonly Dictionary _sequenceNumbers = new Dictionary();
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The update trigger used by this queue.
/// The hostname to connect to.
/// The port used by the web-connection.
public NodeMCUWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, string hostname, int port)
: base(updateTrigger)
{
this._hostname = hostname;
_udpClient = new UdpClient(_hostname, port);
_udpClient.Connect(_hostname, port);
}
#endregion
#region Methods
///
protected override void Update(Dictionary