diff --git a/RGB.NET.Core/Devices/AbstractRGBDevice.cs b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
index abed2da..fe14e69 100644
--- a/RGB.NET.Core/Devices/AbstractRGBDevice.cs
+++ b/RGB.NET.Core/Devices/AbstractRGBDevice.cs
@@ -14,7 +14,7 @@ namespace RGB.NET.Core
///
///
///
- /// Represents a generic RGB-device
+ /// Represents a generic RGB-device.
///
public abstract class AbstractRGBDevice : AbstractBindable, IRGBDevice
where TDeviceInfo : class, IRGBDeviceInfo
diff --git a/RGB.NET.Core/Events/UpdatingEventArgs.cs b/RGB.NET.Core/Events/UpdatingEventArgs.cs
index 42e87cd..46e1f73 100644
--- a/RGB.NET.Core/Events/UpdatingEventArgs.cs
+++ b/RGB.NET.Core/Events/UpdatingEventArgs.cs
@@ -18,8 +18,14 @@ namespace RGB.NET.Core
///
public double DeltaTime { get; }
+ ///
+ /// Gets the trigger causing this update.
+ ///
public IUpdateTrigger Trigger { get; }
-
+
+ ///
+ /// Gets the custom-data provided by the trigger for this update.
+ ///
public CustomUpdateData CustomData { get; }
#endregion
@@ -31,6 +37,8 @@ namespace RGB.NET.Core
/// Initializes a new instance of the class.
///
/// The elapsed time (in seconds) since the last update.
+ /// The trigger causing this update.
+ /// The custom-data provided by the trigger for this update.
public UpdatingEventArgs(double deltaTime, IUpdateTrigger trigger, CustomUpdateData customData)
{
this.DeltaTime = deltaTime;
diff --git a/RGB.NET.Core/RGBSurface.cs b/RGB.NET.Core/RGBSurface.cs
index 5613d77..c0a4d1a 100644
--- a/RGB.NET.Core/RGBSurface.cs
+++ b/RGB.NET.Core/RGBSurface.cs
@@ -42,6 +42,9 @@ namespace RGB.NET.Core
///
public IEnumerable Devices => new ReadOnlyCollection(_devices);
+ ///
+ /// Gets a readonly list containing all registered .
+ ///
public IEnumerable UpdateTriggers => new ReadOnlyCollection(_updateTriggers);
///
@@ -249,6 +252,10 @@ namespace RGB.NET.Core
public IList GetDevices(RGBDeviceType deviceType)
=> new ReadOnlyCollection(_devices.Where(x => x.DeviceInfo.DeviceType == deviceType).ToList());
+ ///
+ /// Registers the provided .
+ ///
+ /// The to register.
public void RegisterUpdateTrigger(IUpdateTrigger updateTrigger)
{
if (!_updateTriggers.Contains(updateTrigger))
@@ -258,6 +265,10 @@ namespace RGB.NET.Core
}
}
+ ///
+ /// Unregisters the provided .
+ ///
+ /// The to unregister.
public void UnregisterUpdateTrigger(IUpdateTrigger updateTrigger)
{
if (_updateTriggers.Remove(updateTrigger))
diff --git a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
index 0769aeb..3ac5d46 100644
--- a/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/AbstractUpdateTrigger.cs
@@ -2,6 +2,9 @@
namespace RGB.NET.Core
{
+ ///
+ /// Represents a generic update trigger.
+ ///
public class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
{
#region Events
@@ -15,8 +18,16 @@ namespace RGB.NET.Core
#region Methods
+ ///
+ /// Invokes the -event.
+ ///
+ /// Optional custom-data passed to the subscribers of the .event.
protected virtual void OnStartup(CustomUpdateData updateData = null) => Starting?.Invoke(this, updateData);
+ ///
+ /// Invokes the -event.
+ ///
+ /// Optional custom-data passed to the subscribers of the .event.
protected virtual void OnUpdate(CustomUpdateData updateData = null) => Update?.Invoke(this, updateData);
///
diff --git a/RGB.NET.Core/Update/CustomUpdateData.cs b/RGB.NET.Core/Update/CustomUpdateData.cs
index a92a182..1e7091c 100644
--- a/RGB.NET.Core/Update/CustomUpdateData.cs
+++ b/RGB.NET.Core/Update/CustomUpdateData.cs
@@ -2,6 +2,9 @@
namespace RGB.NET.Core
{
+ ///
+ /// Represents a set of custom data, each indexed by a string-key.
+ ///
public class CustomUpdateData
{
#region Properties & Fields
@@ -12,6 +15,11 @@ namespace RGB.NET.Core
#region Indexer
+ ///
+ /// Gets or sets the value for a specific key.
+ ///
+ /// The key of the value.
+ /// The value represented by the given key.
public object this[string key]
{
get => _data.TryGetValue(key?.ToUpperInvariant(), out object data) ? data : default;
@@ -22,9 +30,16 @@ namespace RGB.NET.Core
#region Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
public CustomUpdateData()
{ }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// A params-list of tuples containing the key (string) and the value of a specific custom-data.
public CustomUpdateData(params (string key, object value)[] values)
{
foreach ((string key, object value) in values)
diff --git a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
index 453ba04..7230926 100644
--- a/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/Devices/DeviceUpdateTrigger.cs
@@ -1,18 +1,33 @@
-using System.Diagnostics;
+// ReSharper disable MemberCanBePrivate.Global
+
+using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace RGB.NET.Core
{
+ ///
+ /// Represents an update-trigger used to update devices with a maximum update-rate.
+ ///
public class DeviceUpdateTrigger : AbstractUpdateTrigger, IDeviceUpdateTrigger
{
#region Properties & Fields
+ ///
+ /// Gets or sets the timeout used by the blocking wait for data availability.
+ ///
public int Timeout { get; set; } = 100;
+ ///
+ /// Gets the update frequency used by the trigger if not limited by data shortage.
+ ///
public double UpdateFrequency { get; private set; }
private double _maxUpdateRate;
+ ///
+ /// Gets or sets the maximum update rate of this trigger (is overwriten if the is smaller).
+ /// <= 0 removes the limit.
+ ///
public double MaxUpdateRate
{
get => _maxUpdateRate;
@@ -24,6 +39,10 @@ namespace RGB.NET.Core
}
private double _updateRateHardLimit;
+ ///
+ /// Gets the hard limit of the update rate of this trigger. Updates will never perform faster then then this value if it's set.
+ /// <= 0 removes the limit.
+ ///
public double UpdateRateHardLimit
{
get => _updateRateHardLimit;
@@ -45,9 +64,16 @@ namespace RGB.NET.Core
#region Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
public DeviceUpdateTrigger()
{ }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The hard limit of the update rate of this trigger.
public DeviceUpdateTrigger(double updateRateHardLimit)
{
this._updateRateHardLimit = updateRateHardLimit;
@@ -57,6 +83,9 @@ namespace RGB.NET.Core
#region Methods
+ ///
+ /// Starts the trigger.
+ ///
public void Start()
{
if (_isRunning) return;
@@ -68,6 +97,9 @@ namespace RGB.NET.Core
_updateTask = Task.Factory.StartNew(UpdateLoop, (_updateToken = _updateTokenSource.Token), TaskCreationOptions.LongRunning, TaskScheduler.Default);
}
+ ///
+ /// Stops the trigger.
+ ///
public async void Stop()
{
if (!_isRunning) return;
diff --git a/RGB.NET.Core/Update/Devices/IDeviceUpdateTrigger.cs b/RGB.NET.Core/Update/Devices/IDeviceUpdateTrigger.cs
index 1ad117d..81303c1 100644
--- a/RGB.NET.Core/Update/Devices/IDeviceUpdateTrigger.cs
+++ b/RGB.NET.Core/Update/Devices/IDeviceUpdateTrigger.cs
@@ -1,7 +1,13 @@
namespace RGB.NET.Core
{
+ ///
+ /// Represents an update trigger used to trigger device-updates.
+ ///
public interface IDeviceUpdateTrigger : IUpdateTrigger
{
+ ///
+ /// Indicates that there's data available to process.
+ ///
void TriggerHasData();
}
}
diff --git a/RGB.NET.Core/Update/Devices/UpdateQueue.cs b/RGB.NET.Core/Update/Devices/UpdateQueue.cs
index c73eb0e..11660de 100644
--- a/RGB.NET.Core/Update/Devices/UpdateQueue.cs
+++ b/RGB.NET.Core/Update/Devices/UpdateQueue.cs
@@ -1,9 +1,13 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
namespace RGB.NET.Core
{
+ ///
+ /// Represents a generic update queue.
+ ///
+ /// The type of the key used to identify some data.
+ /// The type of the data.
public abstract class UpdateQueue
{
#region Properties & Fields
@@ -16,11 +20,15 @@ namespace RGB.NET.Core
#region Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The causing this queue to update.
public UpdateQueue(IDeviceUpdateTrigger updateTrigger)
{
this._updateTrigger = updateTrigger;
- _updateTrigger.Starting += (sender, args) => OnStartup();
+ _updateTrigger.Starting += OnStartup;
_updateTrigger.Update += OnUpdate;
}
@@ -28,6 +36,11 @@ namespace RGB.NET.Core
#region Methods
+ ///
+ /// Event handler for the -event.
+ ///
+ /// The causing this update.
+ /// provided by the trigger.
protected virtual void OnUpdate(object sender, CustomUpdateData customData)
{
Dictionary dataSet;
@@ -41,10 +54,24 @@ namespace RGB.NET.Core
Update(dataSet);
}
- protected virtual void OnStartup() { }
+ ///
+ /// Event handler for the -event.
+ ///
+ /// The starting .
+ /// provided by the trigger.
+ protected virtual void OnStartup(object sender, CustomUpdateData customData) { }
+ ///
+ /// Performs the update this queue is responsible for.
+ ///
+ /// The set of data that needs to be updated.
protected abstract void Update(Dictionary dataSet);
+ ///
+ /// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available.
+ ///
+ /// The set of data.
+ // ReSharper disable once MemberCanBeProtected.Global
public virtual void SetData(Dictionary dataSet)
{
if ((dataSet == null) || (dataSet.Count == 0)) return;
@@ -63,6 +90,9 @@ namespace RGB.NET.Core
_updateTrigger.TriggerHasData();
}
+ ///
+ /// Resets the current data set.
+ ///
public virtual void Reset()
{
lock (_dataLock)
@@ -72,6 +102,9 @@ namespace RGB.NET.Core
#endregion
}
+ ///
+ /// Represents a generic using an object as the key and a color as the value.
+ ///
public abstract class UpdateQueue : UpdateQueue
public override TDeviceInfo DeviceInfo { get; }
+ ///
+ /// Gets or sets the update queue performing updates for this device.
+ ///
+ // ReSharper disable once MemberCanBePrivate.Global
protected AsusUpdateQueue UpdateQueue { get; set; }
#endregion
diff --git a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
index cd4d505..e6d4a6a 100644
--- a/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
+++ b/RGB.NET.Devices.Asus/Generic/AsusUpdateQueue.cs
@@ -2,8 +2,12 @@
using System.Collections.Generic;
using RGB.NET.Core;
-namespace RGB.NET.Devices.Asus.Generic
+namespace RGB.NET.Devices.Asus
{
+ ///
+ ///
+ /// Represents the update-queue performing updates for asus devices.
+ ///
public class AsusUpdateQueue : UpdateQueue
{
#region Properties & Fields
@@ -11,6 +15,7 @@ namespace RGB.NET.Devices.Asus.Generic
///
/// Gets or sets the internal color-data cache.
///
+ // ReSharper disable once MemberCanBePrivate.Global
protected byte[] ColorData { get; private set; }
private Action _updateAction;
@@ -20,6 +25,10 @@ namespace RGB.NET.Devices.Asus.Generic
#region Constructors
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The update trigger used by this queue.
public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger)
: base(updateTrigger)
{ }
@@ -28,6 +37,12 @@ namespace RGB.NET.Devices.Asus.Generic
#region Methods
+ ///
+ /// Initializes the queue.
+ ///
+ /// The update-action called by the queue to perform updates.
+ /// The handle of the device this queue performs updates for.
+ /// The amount of leds of the device this queue performs updates for.
public void Initialize(Action updateAction, IntPtr handle, int ledCount)
{
_updateAction = updateAction;
@@ -36,6 +51,7 @@ namespace RGB.NET.Devices.Asus.Generic
ColorData = new byte[ledCount * 3];
}
+ ///
protected override void Update(Dictionary