// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.WS281X.Bitwizard
{
// ReSharper disable once InconsistentNaming
///
///
/// Represents a definition of an bitwizard WS2812 devices.
///
public class BitwizardWS281XDeviceDefinition : IWS281XDeviceDefinition
{
#region Properties & Fields
///
/// Gets the name of the serial-port to connect to.
///
public string Port { get; }
///
/// Gets the baud-rate used by the serial-connection.
///
public int BaudRate { get; set; } = 115200;
///
/// Gets or sets the name used by this device.
///
public string Name { get; set; }
///
/// Gets or sets the amount of leds of this device.
///
public int StripLength { get; set; } = 384;
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The name of the serial-port to connect to.
public BitwizardWS281XDeviceDefinition(string port)
{
this.Port = port;
}
#endregion
#region Methods
///
public IEnumerable CreateDevices(IDeviceUpdateTrigger updateTrigger)
{
BitwizardWS2812USBUpdateQueue queue = new BitwizardWS2812USBUpdateQueue(updateTrigger, Port, BaudRate);
string name = Name ?? $"Bitwizard WS2812 USB ({Port})";
BitwizardWS2812USBDevice device = new BitwizardWS2812USBDevice(new BitwizardWS2812USBDeviceInfo(name), queue);
device.Initialize(StripLength);
yield return device;
}
#endregion
}
}