using System; using RGB.NET.Core; namespace RGB.NET.Devices.Novation; /// /// /// Represents a generic Novation-device. (launchpad). /// public abstract class NovationRGBDevice : AbstractRGBDevice, INovationRGBDevice where TDeviceInfo : NovationRGBDeviceInfo { #region Constructors /// /// Initializes a new instance of the class. /// /// The generic information provided by Novation for the device. /// The update trigger used to update this device. protected NovationRGBDevice(TDeviceInfo info, IDeviceUpdateTrigger updateTrigger) : base(info, GetUpdateQueue(updateTrigger, info)) { } #endregion #region Methods private static UpdateQueue GetUpdateQueue(IDeviceUpdateTrigger updateTrigger, TDeviceInfo info) => info.ColorCapabilities switch { NovationColorCapabilities.LimitedRG => new LimitedColorUpdateQueue(updateTrigger, info.DeviceId), NovationColorCapabilities.RGB => new RGBColorUpdateQueue(updateTrigger, info.DeviceId), _ => throw new ArgumentOutOfRangeException() }; /// /// Resets the back to default. /// public virtual void Reset() => UpdateQueue.Reset(); /// /// public override void Dispose() { Reset(); base.Dispose(); GC.SuppressFinalize(this); } #endregion }