using System.Collections.Generic;
using System.Linq;
using RGB.NET.Core;
namespace RGB.NET.Devices.WS281X.Arduino
{
// ReSharper disable once InconsistentNaming
///
///
/// Represents the update-queue performing updates for arduino WS2812 devices.
///
public class ArduinoWS2812USBUpdateQueue : SerialConnectionUpdateQueue
{
#region Constants
private static readonly byte[] COUNT_COMMAND = { 0x01 };
private static readonly byte[] UPDATE_COMMAND = { 0x02 };
private static readonly byte[] ASK_PROMPT_COMMAND = { 0x0F };
#endregion
#region Properties & Fields
private readonly Dictionary _dataBuffer = new Dictionary();
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The update trigger used by this queue.
/// The name of the serial-port to connect to.
/// The baud-rate used by the serial-connection.
public ArduinoWS2812USBUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
: base(updateTrigger, serialConnection)
{ }
#endregion
#region Methods
///
protected override void OnStartup(object sender, CustomUpdateData customData)
{
base.OnStartup(sender, customData);
SendCommand(ASK_PROMPT_COMMAND); // Get initial prompt
}
///
protected override IEnumerable GetCommands(Dictionary