using System.Collections.Generic;
using System.IO.Ports;
using RGB.NET.Core;
namespace RGB.NET.Devices.WS281X
{
///
///
/// Represents a update queue for serial devices.
///
/// The type of data sent through the serial connection.
public abstract class SerialConnectionUpdateQueue : UpdateQueue
{
#region Properties & Fields
///
/// Gets or sets the prompt to wait for between sending commands.
///
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
protected char Prompt { get; set; } = '>';
///
/// Gets the serial port used by this queue.
///
protected ISerialConnection SerialConnection { get; }
#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.
internal SerialConnectionUpdateQueue(IDeviceUpdateTrigger updateTrigger, ISerialConnection serialConnection)
: base(updateTrigger)
{
SerialConnection = serialConnection;
}
#endregion
#region Methods
///
protected override void OnStartup(object sender, CustomUpdateData customData)
{
base.OnStartup(sender, customData);
if (!SerialConnection.IsOpen)
SerialConnection.Open();
SerialConnection.DiscardInBuffer();
}
///
protected override void Update(Dictionary