Show / Hide Table of Contents

Class AbstractRGBDeviceProvider

Represents the abstract base implementation for a IRGBDeviceProvider.

Inheritance
object
AbstractRGBDeviceProvider
AsusDeviceProvider
CoolerMasterDeviceProvider
CorsairDeviceProvider
CorsairLegacyDeviceProvider
DMXDeviceProvider
DebugDeviceProvider
LogitechDeviceProvider
MsiDeviceProvider
NovationDeviceProvider
OpenRGBDeviceProvider
PicoPiDeviceProvider
RazerDeviceProvider
SteelSeriesDeviceProvider
WS281XDeviceProvider
WootingDeviceProvider
Implements
IRGBDeviceProvider
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public abstract class AbstractRGBDeviceProvider : IRGBDeviceProvider, IDisposable

Constructors

| Edit this page View Source

AbstractRGBDeviceProvider(double)

Initializes a new instance of the AbstractRGBDeviceProvider class.

Declaration
protected AbstractRGBDeviceProvider(double defaultUpdateRateHardLimit = 0)
Parameters
Type Name Description
double defaultUpdateRateHardLimit

The update rate hard limit all update triggers for this device provider are initialized with.

Properties

| Edit this page View Source

Devices

Gets a collection of IRGBDevice loaded by this IRGBDeviceProvider.

Declaration
public virtual IReadOnlyList<IRGBDevice> Devices { get; }
Property Value
Type Description
IReadOnlyList<IRGBDevice>
| Edit this page View Source

InternalDevices

The list of devices managed by this device-provider.

Declaration
protected List<IRGBDevice> InternalDevices { get; }
Property Value
Type Description
List<IRGBDevice>
| Edit this page View Source

IsInitialized

Indicates if the used SDK is initialized and ready to use.

Declaration
public bool IsInitialized { get; protected set; }
Property Value
Type Description
bool
| Edit this page View Source

ThrowsExceptions

Indicates if exceptions in the device provider are thrown or silently ignored.

Declaration
public bool ThrowsExceptions { get; protected set; }
Property Value
Type Description
bool
Remarks

This should only be set to true for debugging/development purposes. Production code should use the Exception-Event to handle exceptions.

| Edit this page View Source

UpdateTriggerMapping

Gets the dictionary containing the registered update triggers. Normally UpdateTriggers should be used to access them.

Declaration
protected Dictionary<int, IDeviceUpdateTrigger> UpdateTriggerMapping { get; }
Property Value
Type Description
Dictionary<int, IDeviceUpdateTrigger>
| Edit this page View Source

UpdateTriggers

Gets a collection IDeviceUpdateTrigger registered to this device provider.

Declaration
public IReadOnlyList<(int id, IDeviceUpdateTrigger trigger)> UpdateTriggers { get; }
Property Value
Type Description
IReadOnlyList<(int id, IDeviceUpdateTrigger trigger)>

Methods

| Edit this page View Source

AddDevice(IRGBDevice)

Adds the provided device to the list of managed devices.

Declaration
protected virtual bool AddDevice(IRGBDevice device)
Parameters
Type Name Description
IRGBDevice device

The device to add.

Returns
Type Description
bool

true if the device was added successfully; otherwise false.

| Edit this page View Source

CreateUpdateTrigger(int, double)

Creates a update trigger with the specified id and the specified update rate hard limit.

Declaration
protected virtual IDeviceUpdateTrigger CreateUpdateTrigger(int id, double updateRateHardLimit)
Parameters
Type Name Description
int id

The id of the update trigger.

double updateRateHardLimit

The update rate hard limit tobe set in the update trigger.

Returns
Type Description
IDeviceUpdateTrigger

The newly created update trigger.

| Edit this page View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
| Edit this page View Source

Dispose(bool)

Disposes the object and frees all resources.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
bool disposing

true if explicitely called through the Dispose-Method, false if called by the destructor.

| Edit this page View Source

~AbstractRGBDeviceProvider()

Declaration
protected ~AbstractRGBDeviceProvider()
| Edit this page View Source

GetLoadedDevices(RGBDeviceType)

Loads devices and returns a filtered list of them.

Declaration
protected virtual IEnumerable<IRGBDevice> GetLoadedDevices(RGBDeviceType loadFilter)
Parameters
Type Name Description
RGBDeviceType loadFilter

RGBDeviceType-flags to filter the device with.

Returns
Type Description
IEnumerable<IRGBDevice>

The filtered collection of loaded devices.

Remarks

The underlying loading of the devices happens in LoadDevices().

| Edit this page View Source

GetUpdateTrigger(int, double?)

Gets the IDeviceUpdateTrigger mapped to the specified id or a new one if the id wasn't requested before.

Declaration
protected virtual IDeviceUpdateTrigger GetUpdateTrigger(int id = -1, double? updateRateHardLimit = null)
Parameters
Type Name Description
int id

The id of the update trigger.

double? updateRateHardLimit

The update rate hard limit to be set in the update trigger.

Returns
Type Description
IDeviceUpdateTrigger

The update trigger mapped to the specified id.

Remarks

The creation of the update trigger happens in CreateUpdateTrigger(int, double).

| Edit this page View Source

Initialize(RGBDeviceType, bool)

Initializes the device provider and loads available devices.

Declaration
public bool Initialize(RGBDeviceType loadFilter = (RGBDeviceType)-1, bool throwExceptions = false)
Parameters
Type Name Description
RGBDeviceType loadFilter

RGBDeviceType-flags to filter the devices to load.

bool throwExceptions

Specifies if exceptions should be thrown or silently be ignored.

Returns
Type Description
bool

true if the initialization was successful; false otherwise.

| Edit this page View Source

InitializeSDK()

Initializes the underlying SDK.

Declaration
protected abstract void InitializeSDK()
| Edit this page View Source

LoadDevices()

Loads all devices this device provider is capable of loading.

Declaration
protected abstract IEnumerable<IRGBDevice> LoadDevices()
Returns
Type Description
IEnumerable<IRGBDevice>

A collection of loaded devices.

Remarks

Filtering happens in GetLoadedDevices(RGBDeviceType).

| Edit this page View Source

OnDevicesChanged(DevicesChangedEventArgs)

Throws the DevicesChanged-event.

Declaration
protected virtual void OnDevicesChanged(DevicesChangedEventArgs args)
Parameters
Type Name Description
DevicesChangedEventArgs args

The parameters passed to the event.

| Edit this page View Source

OnException(ExceptionEventArgs)

Throws the Exception.event.

Declaration
protected virtual void OnException(ExceptionEventArgs args)
Parameters
Type Name Description
ExceptionEventArgs args

The parameters passed to the event.

| Edit this page View Source

RemoveDevice(IRGBDevice)

Removes the provided device from the list of managed devices.

Declaration
protected virtual bool RemoveDevice(IRGBDevice device)
Parameters
Type Name Description
IRGBDevice device

The device to remove.

Returns
Type Description
bool

true if the device was removed successfully; otherwise false.

| Edit this page View Source

Reset()

Resets the device provider and disposes all devices and update triggers.

Declaration
protected virtual void Reset()
| Edit this page View Source

Throw(Exception, bool)

Triggers the Exception-event and throws the specified exception if ThrowsExceptions is true and it is not overriden in the event.

Declaration
public virtual void Throw(Exception ex, bool isCritical = false)
Parameters
Type Name Description
Exception ex

The exception to throw.

bool isCritical

Indicates if the exception is critical for device provider to work correctly.

Events

| Edit this page View Source

DevicesChanged

Occures when the devices provided by this device provider changed.

Declaration
public event EventHandler<DevicesChangedEventArgs>? DevicesChanged
Event Type
Type Description
EventHandler<DevicesChangedEventArgs>
| Edit this page View Source

Exception

Occurs when an exception is thrown in the device provider.

Declaration
public event EventHandler<ExceptionEventArgs>? Exception
Event Type
Type Description
EventHandler<ExceptionEventArgs>

Implements

IRGBDeviceProvider
IDisposable
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX