-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathDebugRGBDevice.cs
46 lines (35 loc) · 1.26 KB
/
DebugRGBDevice.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using RGB.NET.Core;
using RGB.NET.Layout;
namespace RGB.NET.Devices.Debug;
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a debug device.
/// </summary>
public sealed class DebugRGBDevice : AbstractRGBDevice<DebugRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
/// <summary>
/// Gets the layour used to describe this debug device.
/// </summary>
public IDeviceLayout Layout { get; }
private Action<IEnumerable<Led>>? _updateLedsAction;
#endregion
#region Constructors
/// <summary>
/// Internal constructor of <see cref="DebugRGBDeviceInfo"/>.
/// </summary>
internal DebugRGBDevice(IDeviceLayout layout, Action<IEnumerable<Led>>? updateLedsAction = null)
: base(new DebugRGBDeviceInfo(layout.Type, layout.Vendor ?? "RGB.NET", layout.Model ?? "Debug", layout.CustomData), new DebugDeviceUpdateQueue())
{
this.Layout = layout;
this._updateLedsAction = updateLedsAction;
Layout.ApplyTo(this, true);
}
#endregion
#region Methods
/// <inheritdoc />
protected override void UpdateLeds(IEnumerable<Led> ledsToUpdate) => _updateLedsAction?.Invoke(ledsToUpdate);
#endregion
}