mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Added missing code documentation
This commit is contained in:
parent
bbbae7d75f
commit
b471c0e192
@ -14,7 +14,7 @@ namespace RGB.NET.Core
|
||||
/// <inheritdoc cref="AbstractBindable" />
|
||||
/// <inheritdoc cref="IRGBDevice{TDeviceInfo}" />
|
||||
/// <summary>
|
||||
/// Represents a generic RGB-device
|
||||
/// Represents a generic RGB-device.
|
||||
/// </summary>
|
||||
public abstract class AbstractRGBDevice<TDeviceInfo> : AbstractBindable, IRGBDevice<TDeviceInfo>
|
||||
where TDeviceInfo : class, IRGBDeviceInfo
|
||||
|
||||
@ -18,8 +18,14 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public double DeltaTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the trigger causing this update.
|
||||
/// </summary>
|
||||
public IUpdateTrigger Trigger { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the custom-data provided by the trigger for this update.
|
||||
/// </summary>
|
||||
public CustomUpdateData CustomData { get; }
|
||||
|
||||
#endregion
|
||||
@ -31,6 +37,8 @@ namespace RGB.NET.Core
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Core.UpdatingEventArgs" /> class.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">The elapsed time (in seconds) since the last update.</param>
|
||||
/// <param name="trigger">The trigger causing this update.</param>
|
||||
/// <param name="customData">The custom-data provided by the trigger for this update.</param>
|
||||
public UpdatingEventArgs(double deltaTime, IUpdateTrigger trigger, CustomUpdateData customData)
|
||||
{
|
||||
this.DeltaTime = deltaTime;
|
||||
|
||||
@ -42,6 +42,9 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
public IEnumerable<IRGBDevice> Devices => new ReadOnlyCollection<IRGBDevice>(_devices);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a readonly list containing all registered <see cref="IUpdateTrigger"/>.
|
||||
/// </summary>
|
||||
public IEnumerable<IUpdateTrigger> UpdateTriggers => new ReadOnlyCollection<IUpdateTrigger>(_updateTriggers);
|
||||
|
||||
/// <summary>
|
||||
@ -249,6 +252,10 @@ namespace RGB.NET.Core
|
||||
public IList<IRGBDevice> GetDevices(RGBDeviceType deviceType)
|
||||
=> new ReadOnlyCollection<IRGBDevice>(_devices.Where(x => x.DeviceInfo.DeviceType == deviceType).ToList());
|
||||
|
||||
/// <summary>
|
||||
/// Registers the provided <see cref="IUpdateTrigger"/>.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The <see cref="IUpdateTrigger"/> to register.</param>
|
||||
public void RegisterUpdateTrigger(IUpdateTrigger updateTrigger)
|
||||
{
|
||||
if (!_updateTriggers.Contains(updateTrigger))
|
||||
@ -258,6 +265,10 @@ namespace RGB.NET.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters the provided <see cref="IUpdateTrigger"/>.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The <see cref="IUpdateTrigger"/> to unregister.</param>
|
||||
public void UnregisterUpdateTrigger(IUpdateTrigger updateTrigger)
|
||||
{
|
||||
if (_updateTriggers.Remove(updateTrigger))
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic update trigger.
|
||||
/// </summary>
|
||||
public class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
|
||||
{
|
||||
#region Events
|
||||
@ -15,8 +18,16 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Starting"/>-event.
|
||||
/// </summary>
|
||||
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Starting"/>.event.</param>
|
||||
protected virtual void OnStartup(CustomUpdateData updateData = null) => Starting?.Invoke(this, updateData);
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="Update"/>-event.
|
||||
/// </summary>
|
||||
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Update"/>.event.</param>
|
||||
protected virtual void OnUpdate(CustomUpdateData updateData = null) => Update?.Invoke(this, updateData);
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a set of custom data, each indexed by a string-key.
|
||||
/// </summary>
|
||||
public class CustomUpdateData
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -12,6 +15,11 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Indexer
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value for a specific key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key of the value.</param>
|
||||
/// <returns>The value represented by the given key.</returns>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomUpdateData"/> class.
|
||||
/// </summary>
|
||||
public CustomUpdateData()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CustomUpdateData"/> class.
|
||||
/// </summary>
|
||||
/// <param name="values">A params-list of tuples containing the key (string) and the value of a specific custom-data.</param>
|
||||
public CustomUpdateData(params (string key, object value)[] values)
|
||||
{
|
||||
foreach ((string key, object value) in values)
|
||||
|
||||
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an update-trigger used to update devices with a maximum update-rate.
|
||||
/// </summary>
|
||||
public class DeviceUpdateTrigger : AbstractUpdateTrigger, IDeviceUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timeout used by the blocking wait for data availability.
|
||||
/// </summary>
|
||||
public int Timeout { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the update frequency used by the trigger if not limited by data shortage.
|
||||
/// </summary>
|
||||
public double UpdateFrequency { get; private set; }
|
||||
|
||||
private double _maxUpdateRate;
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum update rate of this trigger (is overwriten if the <see cref="UpdateRateHardLimit"/> is smaller).
|
||||
/// <= 0 removes the limit.
|
||||
/// </summary>
|
||||
public double MaxUpdateRate
|
||||
{
|
||||
get => _maxUpdateRate;
|
||||
@ -24,6 +39,10 @@ namespace RGB.NET.Core
|
||||
}
|
||||
|
||||
private double _updateRateHardLimit;
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public double UpdateRateHardLimit
|
||||
{
|
||||
get => _updateRateHardLimit;
|
||||
@ -45,9 +64,16 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceUpdateTrigger"/> class.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceUpdateTrigger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateRateHardLimit">The hard limit of the update rate of this trigger.</param>
|
||||
public DeviceUpdateTrigger(double updateRateHardLimit)
|
||||
{
|
||||
this._updateRateHardLimit = updateRateHardLimit;
|
||||
@ -57,6 +83,9 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Starts the trigger.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the trigger.
|
||||
/// </summary>
|
||||
public async void Stop()
|
||||
{
|
||||
if (!_isRunning) return;
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an update trigger used to trigger device-updates.
|
||||
/// </summary>
|
||||
public interface IDeviceUpdateTrigger : IUpdateTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that there's data available to process.
|
||||
/// </summary>
|
||||
void TriggerHasData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic update queue.
|
||||
/// </summary>
|
||||
/// <typeparam name="TIdentifier">The type of the key used to identify some data.</typeparam>
|
||||
/// <typeparam name="TData">The type of the data.</typeparam>
|
||||
public abstract class UpdateQueue<TIdentifier, TData>
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -16,11 +20,15 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdateQueue{TIdentifier,TData}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The <see cref="IDeviceUpdateTrigger"/> causing this queue to update.</param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for the <see cref="IUpdateTrigger.Update"/>-event.
|
||||
/// </summary>
|
||||
/// <param name="sender">The <see cref="IUpdateTrigger"/> causing this update.</param>
|
||||
/// <param name="customData"><see cref="CustomUpdateData"/> provided by the trigger.</param>
|
||||
protected virtual void OnUpdate(object sender, CustomUpdateData customData)
|
||||
{
|
||||
Dictionary<TIdentifier, TData> dataSet;
|
||||
@ -41,10 +54,24 @@ namespace RGB.NET.Core
|
||||
Update(dataSet);
|
||||
}
|
||||
|
||||
protected virtual void OnStartup() { }
|
||||
/// <summary>
|
||||
/// Event handler for the <see cref="IUpdateTrigger.Starting"/>-event.
|
||||
/// </summary>
|
||||
/// <param name="sender">The starting <see cref="IUpdateTrigger"/>.</param>
|
||||
/// <param name="customData"><see cref="CustomUpdateData"/> provided by the trigger.</param>
|
||||
protected virtual void OnStartup(object sender, CustomUpdateData customData) { }
|
||||
|
||||
/// <summary>
|
||||
/// Performs the update this queue is responsible for.
|
||||
/// </summary>
|
||||
/// <param name="dataSet">The set of data that needs to be updated.</param>
|
||||
protected abstract void Update(Dictionary<TIdentifier, TData> dataSet);
|
||||
|
||||
/// <summary>
|
||||
/// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available.
|
||||
/// </summary>
|
||||
/// <param name="dataSet">The set of data.</param>
|
||||
// ReSharper disable once MemberCanBeProtected.Global
|
||||
public virtual void SetData(Dictionary<TIdentifier, TData> dataSet)
|
||||
{
|
||||
if ((dataSet == null) || (dataSet.Count == 0)) return;
|
||||
@ -63,6 +90,9 @@ namespace RGB.NET.Core
|
||||
_updateTrigger.TriggerHasData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the current data set.
|
||||
/// </summary>
|
||||
public virtual void Reset()
|
||||
{
|
||||
lock (_dataLock)
|
||||
@ -72,6 +102,9 @@ namespace RGB.NET.Core
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a generic <see cref="UpdateQueue{TIdentifier,TData}"/> using an object as the key and a color as the value.
|
||||
/// </summary>
|
||||
public abstract class UpdateQueue : UpdateQueue<object, Color>
|
||||
{
|
||||
#region Constructors
|
||||
@ -85,6 +118,10 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calls <see cref="UpdateQueue{TIdentifier,TData}.SetData"/> for a data set created out of the provided list of <see cref="Led"/>.
|
||||
/// </summary>
|
||||
/// <param name="leds"></param>
|
||||
public void SetData(IEnumerable<Led> leds) => SetData(leds?.ToDictionary(x => x.CustomData ?? x.Id, x => x.Color));
|
||||
|
||||
#endregion
|
||||
|
||||
@ -2,9 +2,19 @@
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a trigger causing an update.
|
||||
/// </summary>
|
||||
public interface IUpdateTrigger : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when the trigger is starting up.
|
||||
/// </summary>
|
||||
event EventHandler<CustomUpdateData> Starting;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the trigger wants to cause an update.
|
||||
/// </summary>
|
||||
event EventHandler<CustomUpdateData> Update;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,15 @@
|
||||
using System.Diagnostics;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RGB.NET.Core
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents an <see cref="T:RGB.NET.Core.IUpdateTrigger" />
|
||||
/// </summary>
|
||||
public class TimerUpdateTrigger : AbstractUpdateTrigger
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -12,7 +18,7 @@ namespace RGB.NET.Core
|
||||
private CancellationToken _updateToken;
|
||||
private Task _updateTask;
|
||||
private Stopwatch _sleepCounter;
|
||||
|
||||
|
||||
private double _updateFrequency = 1.0 / 30.0;
|
||||
/// <summary>
|
||||
/// Gets or sets the update-frequency in seconds. (Calculate by using '1.0 / updates per second')
|
||||
@ -27,11 +33,15 @@ namespace RGB.NET.Core
|
||||
/// Gets the time it took the last update-loop cycle to run.
|
||||
/// </summary>
|
||||
public double LastUpdateTime { get; private set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TimerUpdateTrigger"/> class.
|
||||
/// </summary>
|
||||
/// <param name="autostart">A value indicating if the trigger should automatically <see cref="Start"/> right after construction.</param>
|
||||
public TimerUpdateTrigger(bool autostart = true)
|
||||
{
|
||||
_sleepCounter = new Stopwatch();
|
||||
@ -44,6 +54,9 @@ namespace RGB.NET.Core
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Starts the trigger if needed, causing it to performing updates.
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
if (_updateTask == null)
|
||||
@ -54,6 +67,9 @@ namespace RGB.NET.Core
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the trigger if running, causing it to stop performing updates.
|
||||
/// </summary>
|
||||
public async void Stop()
|
||||
{
|
||||
if (_updateTask != null)
|
||||
|
||||
@ -63,6 +63,9 @@ namespace RGB.NET.Devices.Asus
|
||||
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
|
||||
public Func<CultureInfo> GetCulture { get; set; } = CultureHelper.GetCurrentCulture;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for asus devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Asus.Generic;
|
||||
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
@ -23,6 +22,10 @@ namespace RGB.NET.Devices.Asus
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected AsusUpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -2,8 +2,12 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Asus.Generic
|
||||
namespace RGB.NET.Devices.Asus
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for asus devices.
|
||||
/// </summary>
|
||||
public class AsusUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -11,6 +15,7 @@ namespace RGB.NET.Devices.Asus.Generic
|
||||
/// <summary>
|
||||
/// Gets or sets the internal color-data cache.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected byte[] ColorData { get; private set; }
|
||||
|
||||
private Action<IntPtr, byte[]> _updateAction;
|
||||
@ -20,6 +25,10 @@ namespace RGB.NET.Devices.Asus.Generic
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AsusUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public AsusUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
@ -28,6 +37,12 @@ namespace RGB.NET.Devices.Asus.Generic
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the queue.
|
||||
/// </summary>
|
||||
/// <param name="updateAction">The update-action called by the queue to perform updates.</param>
|
||||
/// <param name="handle">The handle of the device this queue performs updates for.</param>
|
||||
/// <param name="ledCount">The amount of leds of the device this queue performs updates for.</param>
|
||||
public void Initialize(Action<IntPtr, byte[]> updateAction, IntPtr handle, int ledCount)
|
||||
{
|
||||
_updateAction = updateAction;
|
||||
@ -36,6 +51,7 @@ namespace RGB.NET.Devices.Asus.Generic
|
||||
ColorData = new byte[ledCount * 3];
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(Dictionary<object, Color> dataSet)
|
||||
{
|
||||
foreach (KeyValuePair<object, Color> data in dataSet)
|
||||
|
||||
@ -63,6 +63,9 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
|
||||
public Func<CultureInfo> GetCulture { get; set; } = CultureHelper.GetCurrentCulture;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for cooler master devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -22,6 +22,10 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected CoolerMasterUpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -4,6 +4,10 @@ using RGB.NET.Devices.CoolerMaster.Native;
|
||||
|
||||
namespace RGB.NET.Devices.CoolerMaster
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for cooler master devices.
|
||||
/// </summary>
|
||||
public class CoolerMasterUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -14,6 +18,11 @@ namespace RGB.NET.Devices.CoolerMaster
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CoolerMasterUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceIndex">The <see cref="CoolerMasterDevicesIndexes"/> of the device this queue performs updates for.</param>
|
||||
public CoolerMasterUpdateQueue(IDeviceUpdateTrigger updateTrigger, CoolerMasterDevicesIndexes deviceIndex)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
|
||||
@ -7,9 +7,13 @@ namespace RGB.NET.Devices.CoolerMaster.Native
|
||||
{
|
||||
#region Constants
|
||||
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
internal const int ROWS = 6;
|
||||
internal const int COLUMNS = 22;
|
||||
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
@ -66,6 +66,9 @@ namespace RGB.NET.Devices.Corsair
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IRGBDevice> Devices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for corsair devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
private CorsairUpdateQueue _updateQueue;
|
||||
|
||||
|
||||
@ -29,6 +29,10 @@ namespace RGB.NET.Devices.Corsair
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected Dictionary<CorsairLedId, Led> InternalLedMapping { get; } = new Dictionary<CorsairLedId, Led>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected CorsairUpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Corsair.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for corsair devices.
|
||||
/// </summary>
|
||||
public class CorsairUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public CorsairUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
@ -37,6 +37,9 @@ namespace RGB.NET.Devices.DMX
|
||||
/// </summary>
|
||||
public List<IDMXDeviceDefinition> DeviceDefinitions { get; } = new List<IDMXDeviceDefinition>();
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for dmx devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -5,6 +5,10 @@ using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.DMX.E131
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for E131-DMX devices.
|
||||
/// </summary>
|
||||
public class E131UpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -29,6 +33,13 @@ namespace RGB.NET.Devices.DMX.E131
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DMX.E131.E131UpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="hostname">The hostname of the device this queue is performing updates for.</param>
|
||||
/// <param name="port">The port to connect to the device this queue is performing updates for.</param>
|
||||
public E131UpdateQueue(IDeviceUpdateTrigger updateTrigger, string hostname, int port)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
@ -40,6 +51,7 @@ namespace RGB.NET.Devices.DMX.E131
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Update(Dictionary<object, Color> dataSet)
|
||||
{
|
||||
DataPacket.SetSequenceNumber(GetNextSequenceNumber());
|
||||
|
||||
@ -18,7 +18,11 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// Gets information about the <see cref="T:RGB.NET.Devices.Logitech.LogitechRGBDevice" />.
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected UpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -66,7 +66,6 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
|
||||
/// <param name="model">The represented device model.</param>
|
||||
/// <param name="deviceCaps">The lighting-capabilities of the device.</param>
|
||||
/// <param name="imageBasePath">The base of the image path used to load device-images.</param>
|
||||
/// <param name="imageLayout">The layout used to decide which images to load.</param>
|
||||
/// <param name="layoutPath">The path/name of the layout-file.</param>
|
||||
internal LogitechRGBDeviceInfo(RGBDeviceType deviceType, string model, LogitechDeviceCaps deviceCaps,
|
||||
|
||||
@ -56,6 +56,9 @@ namespace RGB.NET.Devices.Logitech
|
||||
/// </summary>
|
||||
public Func<CultureInfo> GetCulture { get; set; } = CultureHelper.GetCurrentCulture;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for logitech devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
private LogitechPerDeviceUpdateQueue _perDeviceUpdateQueue;
|
||||
private LogitechPerKeyUpdateQueue _perKeyUpdateQueue;
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Logitech.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for logitech per-device devices.
|
||||
/// </summary>
|
||||
public class LogitechPerDeviceUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LogitechPerDeviceUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public LogitechPerDeviceUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{ }
|
||||
|
||||
@ -5,6 +5,9 @@ using RGB.NET.Devices.Logitech.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Logitech
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for logitech per-key devices.
|
||||
/// </summary>
|
||||
public class LogitechPerKeyUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -15,6 +18,10 @@ namespace RGB.NET.Devices.Logitech
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LogitechPerKeyUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
public LogitechPerKeyUpdateQueue(IDeviceUpdateTrigger updateTrigger)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
|
||||
@ -5,10 +5,18 @@ using Sanford.Multimedia.Midi;
|
||||
|
||||
namespace RGB.NET.Devices.Novation
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for a limited-color novation device.
|
||||
/// </summary>
|
||||
public class LimitedColorUpdateQueue : MidiUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LimitedColorUpdateQueue"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceId">The device-id of the device this queue is performing updates for.</param>
|
||||
public LimitedColorUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -5,6 +5,11 @@ using Sanford.Multimedia.Midi;
|
||||
|
||||
namespace RGB.NET.Devices.Novation
|
||||
{
|
||||
/// <inheritdoc cref="UpdateQueue" />
|
||||
/// <inheritdoc cref="IDisposable" />
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for midi devices.
|
||||
/// </summary>
|
||||
public abstract class MidiUpdateQueue : UpdateQueue, IDisposable
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -15,7 +20,13 @@ namespace RGB.NET.Devices.Novation
|
||||
|
||||
#region Constructors
|
||||
|
||||
public MidiUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceId)
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Novation.MidiUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used by this queue.</param>
|
||||
/// <param name="deviceId">The id of the device this queue is performing updates for.</param>
|
||||
protected MidiUpdateQueue(IDeviceUpdateTrigger updateTrigger, int deviceId)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
_outputDevice = new OutputDevice(deviceId);
|
||||
@ -32,14 +43,21 @@ namespace RGB.NET.Devices.Novation
|
||||
SendMessage(CreateMessage(data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the specified message to the device this queue is performing updates for.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to send.</param>
|
||||
protected virtual void SendMessage(ShortMessage message) => _outputDevice.SendShort(message.Message);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a update-message out of a given data set.
|
||||
/// </summary>
|
||||
/// <param name="data">The data set to create the message from.</param>
|
||||
/// <returns>The message created out of the data set.</returns>
|
||||
protected abstract ShortMessage CreateMessage(KeyValuePair<object, Color> data);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_outputDevice.Dispose();
|
||||
}
|
||||
/// <inheritdoc />
|
||||
public void Dispose() => _outputDevice.Dispose();
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -21,6 +21,10 @@ namespace RGB.NET.Devices.Novation
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="MidiUpdateQueue"/> used to update this <see cref="NovationRGBDevice{TDeviceInfo}"/>.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected MidiUpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -39,6 +39,9 @@ namespace RGB.NET.Devices.Novation
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<IRGBDevice> Devices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for novation devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer chroma-link devices.
|
||||
/// </summary>
|
||||
public class RazerChromaLinkUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerChromaLinkUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerChromaLinkUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -20,6 +20,10 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
public override TDeviceInfo DeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update queue performing updates for this device.
|
||||
/// </summary>
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
protected RazerUpdateQueue UpdateQueue { get; set; }
|
||||
|
||||
#endregion
|
||||
@ -57,6 +61,11 @@ namespace RGB.NET.Devices.Razer
|
||||
UpdateQueue = CreateUpdateQueue(updateTrigger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a specific <see cref="RazerUpdateQueue"/> for this device.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The trigger used to update the queue.</param>
|
||||
/// <returns>The <see cref="RazerUpdateQueue"/> for this device.</returns>
|
||||
protected abstract RazerUpdateQueue CreateUpdateQueue(IDeviceUpdateTrigger updateTrigger);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -5,6 +5,9 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a basic update-queue performing updates for razer devices.
|
||||
/// </summary>
|
||||
public abstract class RazerUpdateQueue : UpdateQueue
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -16,6 +19,11 @@ namespace RGB.NET.Devices.Razer
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
protected RazerUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger)
|
||||
{
|
||||
@ -41,6 +49,11 @@ namespace RGB.NET.Devices.Razer
|
||||
_lastEffect = effectId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the effect used to update this device.
|
||||
/// </summary>
|
||||
/// <param name="effectParams">The parameters of the effect.</param>
|
||||
/// <param name="effectId">The id this effect is created with.</param>
|
||||
protected virtual void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateEffect(_deviceId, _Defines.EFFECT_ID, effectParams, ref effectId);
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer headset devices.
|
||||
/// </summary>
|
||||
public class RazerHeadsetUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerHeadsetUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerHeadsetUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer keyboard devices.
|
||||
/// </summary>
|
||||
public class RazerKeyboardUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerKeyboardUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerKeyboardUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer keypad devices.
|
||||
/// </summary>
|
||||
public class RazerKeypadUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerKeypadUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerKeypadUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer mouse devices.
|
||||
/// </summary>
|
||||
public class RazerMouseUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerMouseUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerMouseUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -6,10 +6,18 @@ using RGB.NET.Devices.Razer.Native;
|
||||
|
||||
namespace RGB.NET.Devices.Razer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the update-queue performing updates for razer mousepad devices.
|
||||
/// </summary>
|
||||
public class RazerMousepadUpdateQueue : RazerUpdateQueue
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RazerMousepadUpdateQueue" /> class.
|
||||
/// </summary>
|
||||
/// <param name="updateTrigger">The update trigger used to update this queue.</param>
|
||||
/// <param name="deviceId">The id of the device updated by this queue.</param>
|
||||
public RazerMousepadUpdateQueue(IDeviceUpdateTrigger updateTrigger, Guid deviceId)
|
||||
: base(updateTrigger, deviceId)
|
||||
{ }
|
||||
|
||||
@ -68,6 +68,9 @@ namespace RGB.NET.Devices.Razer
|
||||
/// </summary>
|
||||
public bool LoadEmulatorDevices { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DeviceUpdateTrigger"/> used to trigger the updates for razer devices.
|
||||
/// </summary>
|
||||
public DeviceUpdateTrigger UpdateTrigger { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user