Class HIDLoader<TLed, TData>
Represents a loaded for HID-devices based on the specified definitions.
Inherited Members
Namespace: RGB.NET.HID
Assembly: RGB.NET.HID.dll
Syntax
public sealed class HIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefinition<TLed, TData>>, IEnumerable where TLed : notnull
Type Parameters
Name | Description |
---|---|
TLed | The type of the identifier leds are mapped to. |
TData | The type of the custom data added to the HID-device. |
Constructors
| Edit this page View SourceHIDLoader(int)
Initializes a new instance of the HIDLoader<TLed, TData> class.
Declaration
public HIDLoader(int vendorId)
Parameters
Type | Name | Description |
---|---|---|
int | vendorId | The vendor id used for this loader. |
Properties
| Edit this page View SourceLoadFilter
Gets or sets the filter used to determine which devices should be loaded.
Declaration
public RGBDeviceType LoadFilter { get; set; }
Property Value
Type | Description |
---|---|
RGBDeviceType |
VendorId
Gets the vendor id used for this loader.
Declaration
public int VendorId { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceAdd(int, RGBDeviceType, string, LedMapping<TLed>, TData)
Adds a new HIDDeviceDefinition<TLed, TData> to this loader.
Declaration
public void Add(int productId, RGBDeviceType deviceType, string name, LedMapping<TLed> ledMapping, TData customData)
Parameters
Type | Name | Description |
---|---|---|
int | productId | The product id of the HID-device. |
RGBDeviceType | deviceType | The type of the device. |
string | name | The name of the device. |
LedMapping<TLed> | ledMapping | The mapping of the leds of the device. |
TData | customData | Some custom data to attach to the device. |
GetConnectedDevices()
Gets a enumerable containing all devices from the definition-list that are connected and match the LoadFilter.
Declaration
public IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> GetConnectedDevices()
Returns
Type | Description |
---|---|
IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> | The enumerable containing the connected devices. |
GetConnectedDevices<TKey>(Func<HIDDeviceDefinition<TLed, TData>, TKey>)
Gets a enumerable containing all the first device of each group of devices from the definition-list that are connected and match the LoadFilter. The grouping is done by the specified function.
Declaration
public IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> GetConnectedDevices<TKey>(Func<HIDDeviceDefinition<TLed, TData>, TKey> groupBy)
Parameters
Type | Name | Description |
---|---|---|
Func<HIDDeviceDefinition<TLed, TData>, TKey> | groupBy | The function grouping the devices. |
Returns
Type | Description |
---|---|
IEnumerable<(HIDDeviceDefinition<TLed, TData> definition, HidDevice device)> | The enumerable containing the selected devices. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key used to group the devices. |
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<HIDDeviceDefinition<TLed, TData>> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<HIDDeviceDefinition<TLed, TData>> | An enumerator that can be used to iterate through the collection. |