1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 09:38:31 +00:00

Added dynamic lighting device provider (not working)

This commit is contained in:
Darth Affe 2024-03-25 21:06:58 +01:00
parent a4bd797912
commit 768b1fddd0
38 changed files with 1758 additions and 0 deletions

View File

@ -98,6 +98,26 @@ public enum RGBDeviceType
/// </summary>
GameController = 1 << 16,
/// <summary>
/// Represents a chassis
/// </summary>
Chassis = 1 << 17,
/// <summary>
/// Represents a furniture
/// </summary>
Furniture = 1 << 18,
/// <summary>
/// Represents a wearable
/// </summary>
Wearable = 1 << 19,
/// <summary>
/// Represents a piece of art
/// </summary>
Art = 1 << 20,
/// <summary>
/// Represents a device where the type is not known or not present in the list.
/// </summary>

View File

@ -0,0 +1,6 @@
namespace RGB.NET.Core;
/// <summary>
/// Represents a art-device
/// </summary>
public interface IArt : IRGBDevice;

View File

@ -0,0 +1,6 @@
namespace RGB.NET.Core;
/// <summary>
/// Represents a chassis-device
/// </summary>
public interface IChassis : IRGBDevice;

View File

@ -0,0 +1,6 @@
namespace RGB.NET.Core;
/// <summary>
/// Represents a furniture-device
/// </summary>
public interface IFurniture : IRGBDevice;

View File

@ -0,0 +1,6 @@
namespace RGB.NET.Core;
/// <summary>
/// Represents a art-device
/// </summary>
public interface IWearable : IRGBDevice;

View File

@ -6424,6 +6424,526 @@ public enum LedId
GameController127 = 0x00E0007F,
GameController128 = 0x00E00080,
/*### Chassis ###*/
Chassis1 = 0x00F00001,
Chassis2 = 0x00F00002,
Chassis3 = 0x00F00003,
Chassis4 = 0x00F00004,
Chassis5 = 0x00F00005,
Chassis6 = 0x00F00006,
Chassis7 = 0x00F00007,
Chassis8 = 0x00F00008,
Chassis9 = 0x00F00009,
Chassis10 = 0x00F0000A,
Chassis11 = 0x00F0000B,
Chassis12 = 0x00F0000C,
Chassis13 = 0x00F0000D,
Chassis14 = 0x00F0000E,
Chassis15 = 0x00F0000F,
Chassis16 = 0x00F00010,
Chassis17 = 0x00F00011,
Chassis18 = 0x00F00012,
Chassis19 = 0x00F00013,
Chassis20 = 0x00F00014,
Chassis21 = 0x00F00015,
Chassis22 = 0x00F00016,
Chassis23 = 0x00F00017,
Chassis24 = 0x00F00018,
Chassis25 = 0x00F00019,
Chassis26 = 0x00F0001A,
Chassis27 = 0x00F0001B,
Chassis28 = 0x00F0001C,
Chassis29 = 0x00F0001D,
Chassis30 = 0x00F0001E,
Chassis31 = 0x00F0001F,
Chassis32 = 0x00F00020,
Chassis33 = 0x00F00021,
Chassis34 = 0x00F00022,
Chassis35 = 0x00F00023,
Chassis36 = 0x00F00024,
Chassis37 = 0x00F00025,
Chassis38 = 0x00F00026,
Chassis39 = 0x00F00027,
Chassis40 = 0x00F00028,
Chassis41 = 0x00F00029,
Chassis42 = 0x00F0002A,
Chassis43 = 0x00F0002B,
Chassis44 = 0x00F0002C,
Chassis45 = 0x00F0002D,
Chassis46 = 0x00F0002E,
Chassis47 = 0x00F0002F,
Chassis48 = 0x00F00030,
Chassis49 = 0x00F00031,
Chassis50 = 0x00F00032,
Chassis51 = 0x00F00033,
Chassis52 = 0x00F00034,
Chassis53 = 0x00F00035,
Chassis54 = 0x00F00036,
Chassis55 = 0x00F00037,
Chassis56 = 0x00F00038,
Chassis57 = 0x00F00039,
Chassis58 = 0x00F0003A,
Chassis59 = 0x00F0003B,
Chassis60 = 0x00F0003C,
Chassis61 = 0x00F0003D,
Chassis62 = 0x00F0003E,
Chassis63 = 0x00F0003F,
Chassis64 = 0x00F00040,
Chassis65 = 0x00F00041,
Chassis66 = 0x00F00042,
Chassis67 = 0x00F00043,
Chassis68 = 0x00F00044,
Chassis69 = 0x00F00045,
Chassis70 = 0x00F00046,
Chassis71 = 0x00F00047,
Chassis72 = 0x00F00048,
Chassis73 = 0x00F00049,
Chassis74 = 0x00F0004A,
Chassis75 = 0x00F0004B,
Chassis76 = 0x00F0004C,
Chassis77 = 0x00F0004D,
Chassis78 = 0x00F0004E,
Chassis79 = 0x00F0004F,
Chassis80 = 0x00F00050,
Chassis81 = 0x00F00051,
Chassis82 = 0x00F00052,
Chassis83 = 0x00F00053,
Chassis84 = 0x00F00054,
Chassis85 = 0x00F00055,
Chassis86 = 0x00F00056,
Chassis87 = 0x00F00057,
Chassis88 = 0x00F00058,
Chassis89 = 0x00F00059,
Chassis90 = 0x00F0005A,
Chassis91 = 0x00F0005B,
Chassis92 = 0x00F0005C,
Chassis93 = 0x00F0005D,
Chassis94 = 0x00F0005E,
Chassis95 = 0x00F0005F,
Chassis96 = 0x00F00060,
Chassis97 = 0x00F00061,
Chassis98 = 0x00F00062,
Chassis99 = 0x00F00063,
Chassis100 = 0x00F00064,
Chassis101 = 0x00F00065,
Chassis102 = 0x00F00066,
Chassis103 = 0x00F00067,
Chassis104 = 0x00F00068,
Chassis105 = 0x00F00069,
Chassis106 = 0x00F0006A,
Chassis107 = 0x00F0006B,
Chassis108 = 0x00F0006C,
Chassis109 = 0x00F0006D,
Chassis110 = 0x00F0006E,
Chassis111 = 0x00F0006F,
Chassis112 = 0x00F00070,
Chassis113 = 0x00F00071,
Chassis114 = 0x00F00072,
Chassis115 = 0x00F00073,
Chassis116 = 0x00F00074,
Chassis117 = 0x00F00075,
Chassis118 = 0x00F00076,
Chassis119 = 0x00F00077,
Chassis120 = 0x00F00078,
Chassis121 = 0x00F00079,
Chassis122 = 0x00F0007A,
Chassis123 = 0x00F0007B,
Chassis124 = 0x00F0007C,
Chassis125 = 0x00F0007D,
Chassis126 = 0x00F0007E,
Chassis127 = 0x00F0007F,
Chassis128 = 0x00F00080,
/*### Furniture ###*/
Furniture1 = 0x01000001,
Furniture2 = 0x01000002,
Furniture3 = 0x01000003,
Furniture4 = 0x01000004,
Furniture5 = 0x01000005,
Furniture6 = 0x01000006,
Furniture7 = 0x01000007,
Furniture8 = 0x01000008,
Furniture9 = 0x01000009,
Furniture10 = 0x0100000A,
Furniture11 = 0x0100000B,
Furniture12 = 0x0100000C,
Furniture13 = 0x0100000D,
Furniture14 = 0x0100000E,
Furniture15 = 0x0100000F,
Furniture16 = 0x01000010,
Furniture17 = 0x01000011,
Furniture18 = 0x01000012,
Furniture19 = 0x01000013,
Furniture20 = 0x01000014,
Furniture21 = 0x01000015,
Furniture22 = 0x01000016,
Furniture23 = 0x01000017,
Furniture24 = 0x01000018,
Furniture25 = 0x01000019,
Furniture26 = 0x0100001A,
Furniture27 = 0x0100001B,
Furniture28 = 0x0100001C,
Furniture29 = 0x0100001D,
Furniture30 = 0x0100001E,
Furniture31 = 0x0100001F,
Furniture32 = 0x01000020,
Furniture33 = 0x01000021,
Furniture34 = 0x01000022,
Furniture35 = 0x01000023,
Furniture36 = 0x01000024,
Furniture37 = 0x01000025,
Furniture38 = 0x01000026,
Furniture39 = 0x01000027,
Furniture40 = 0x01000028,
Furniture41 = 0x01000029,
Furniture42 = 0x0100002A,
Furniture43 = 0x0100002B,
Furniture44 = 0x0100002C,
Furniture45 = 0x0100002D,
Furniture46 = 0x0100002E,
Furniture47 = 0x0100002F,
Furniture48 = 0x01000030,
Furniture49 = 0x01000031,
Furniture50 = 0x01000032,
Furniture51 = 0x01000033,
Furniture52 = 0x01000034,
Furniture53 = 0x01000035,
Furniture54 = 0x01000036,
Furniture55 = 0x01000037,
Furniture56 = 0x01000038,
Furniture57 = 0x01000039,
Furniture58 = 0x0100003A,
Furniture59 = 0x0100003B,
Furniture60 = 0x0100003C,
Furniture61 = 0x0100003D,
Furniture62 = 0x0100003E,
Furniture63 = 0x0100003F,
Furniture64 = 0x01000040,
Furniture65 = 0x01000041,
Furniture66 = 0x01000042,
Furniture67 = 0x01000043,
Furniture68 = 0x01000044,
Furniture69 = 0x01000045,
Furniture70 = 0x01000046,
Furniture71 = 0x01000047,
Furniture72 = 0x01000048,
Furniture73 = 0x01000049,
Furniture74 = 0x0100004A,
Furniture75 = 0x0100004B,
Furniture76 = 0x0100004C,
Furniture77 = 0x0100004D,
Furniture78 = 0x0100004E,
Furniture79 = 0x0100004F,
Furniture80 = 0x01000050,
Furniture81 = 0x01000051,
Furniture82 = 0x01000052,
Furniture83 = 0x01000053,
Furniture84 = 0x01000054,
Furniture85 = 0x01000055,
Furniture86 = 0x01000056,
Furniture87 = 0x01000057,
Furniture88 = 0x01000058,
Furniture89 = 0x01000059,
Furniture90 = 0x0100005A,
Furniture91 = 0x0100005B,
Furniture92 = 0x0100005C,
Furniture93 = 0x0100005D,
Furniture94 = 0x0100005E,
Furniture95 = 0x0100005F,
Furniture96 = 0x01000060,
Furniture97 = 0x01000061,
Furniture98 = 0x01000062,
Furniture99 = 0x01000063,
Furniture100 = 0x01000064,
Furniture101 = 0x01000065,
Furniture102 = 0x01000066,
Furniture103 = 0x01000067,
Furniture104 = 0x01000068,
Furniture105 = 0x01000069,
Furniture106 = 0x0100006A,
Furniture107 = 0x0100006B,
Furniture108 = 0x0100006C,
Furniture109 = 0x0100006D,
Furniture110 = 0x0100006E,
Furniture111 = 0x0100006F,
Furniture112 = 0x01000070,
Furniture113 = 0x01000071,
Furniture114 = 0x01000072,
Furniture115 = 0x01000073,
Furniture116 = 0x01000074,
Furniture117 = 0x01000075,
Furniture118 = 0x01000076,
Furniture119 = 0x01000077,
Furniture120 = 0x01000078,
Furniture121 = 0x01000079,
Furniture122 = 0x0100007A,
Furniture123 = 0x0100007B,
Furniture124 = 0x0100007C,
Furniture125 = 0x0100007D,
Furniture126 = 0x0100007E,
Furniture127 = 0x0100007F,
Furniture128 = 0x01000080,
/*### Wearable ###*/
Wearable1 = 0x01100001,
Wearable2 = 0x01100002,
Wearable3 = 0x01100003,
Wearable4 = 0x01100004,
Wearable5 = 0x01100005,
Wearable6 = 0x01100006,
Wearable7 = 0x01100007,
Wearable8 = 0x01100008,
Wearable9 = 0x01100009,
Wearable10 = 0x0110000A,
Wearable11 = 0x0110000B,
Wearable12 = 0x0110000C,
Wearable13 = 0x0110000D,
Wearable14 = 0x0110000E,
Wearable15 = 0x0110000F,
Wearable16 = 0x01100010,
Wearable17 = 0x01100011,
Wearable18 = 0x01100012,
Wearable19 = 0x01100013,
Wearable20 = 0x01100014,
Wearable21 = 0x01100015,
Wearable22 = 0x01100016,
Wearable23 = 0x01100017,
Wearable24 = 0x01100018,
Wearable25 = 0x01100019,
Wearable26 = 0x0110001A,
Wearable27 = 0x0110001B,
Wearable28 = 0x0110001C,
Wearable29 = 0x0110001D,
Wearable30 = 0x0110001E,
Wearable31 = 0x0110001F,
Wearable32 = 0x01100020,
Wearable33 = 0x01100021,
Wearable34 = 0x01100022,
Wearable35 = 0x01100023,
Wearable36 = 0x01100024,
Wearable37 = 0x01100025,
Wearable38 = 0x01100026,
Wearable39 = 0x01100027,
Wearable40 = 0x01100028,
Wearable41 = 0x01100029,
Wearable42 = 0x0110002A,
Wearable43 = 0x0110002B,
Wearable44 = 0x0110002C,
Wearable45 = 0x0110002D,
Wearable46 = 0x0110002E,
Wearable47 = 0x0110002F,
Wearable48 = 0x01100030,
Wearable49 = 0x01100031,
Wearable50 = 0x01100032,
Wearable51 = 0x01100033,
Wearable52 = 0x01100034,
Wearable53 = 0x01100035,
Wearable54 = 0x01100036,
Wearable55 = 0x01100037,
Wearable56 = 0x01100038,
Wearable57 = 0x01100039,
Wearable58 = 0x0110003A,
Wearable59 = 0x0110003B,
Wearable60 = 0x0110003C,
Wearable61 = 0x0110003D,
Wearable62 = 0x0110003E,
Wearable63 = 0x0110003F,
Wearable64 = 0x01100040,
Wearable65 = 0x01100041,
Wearable66 = 0x01100042,
Wearable67 = 0x01100043,
Wearable68 = 0x01100044,
Wearable69 = 0x01100045,
Wearable70 = 0x01100046,
Wearable71 = 0x01100047,
Wearable72 = 0x01100048,
Wearable73 = 0x01100049,
Wearable74 = 0x0110004A,
Wearable75 = 0x0110004B,
Wearable76 = 0x0110004C,
Wearable77 = 0x0110004D,
Wearable78 = 0x0110004E,
Wearable79 = 0x0110004F,
Wearable80 = 0x01100050,
Wearable81 = 0x01100051,
Wearable82 = 0x01100052,
Wearable83 = 0x01100053,
Wearable84 = 0x01100054,
Wearable85 = 0x01100055,
Wearable86 = 0x01100056,
Wearable87 = 0x01100057,
Wearable88 = 0x01100058,
Wearable89 = 0x01100059,
Wearable90 = 0x0110005A,
Wearable91 = 0x0110005B,
Wearable92 = 0x0110005C,
Wearable93 = 0x0110005D,
Wearable94 = 0x0110005E,
Wearable95 = 0x0110005F,
Wearable96 = 0x01100060,
Wearable97 = 0x01100061,
Wearable98 = 0x01100062,
Wearable99 = 0x01100063,
Wearable100 = 0x01100064,
Wearable101 = 0x01100065,
Wearable102 = 0x01100066,
Wearable103 = 0x01100067,
Wearable104 = 0x01100068,
Wearable105 = 0x01100069,
Wearable106 = 0x0110006A,
Wearable107 = 0x0110006B,
Wearable108 = 0x0110006C,
Wearable109 = 0x0110006D,
Wearable110 = 0x0110006E,
Wearable111 = 0x0110006F,
Wearable112 = 0x01100070,
Wearable113 = 0x01100071,
Wearable114 = 0x01100072,
Wearable115 = 0x01100073,
Wearable116 = 0x01100074,
Wearable117 = 0x01100075,
Wearable118 = 0x01100076,
Wearable119 = 0x01100077,
Wearable120 = 0x01100078,
Wearable121 = 0x01100079,
Wearable122 = 0x0110007A,
Wearable123 = 0x0110007B,
Wearable124 = 0x0110007C,
Wearable125 = 0x0110007D,
Wearable126 = 0x0110007E,
Wearable127 = 0x0110007F,
Wearable128 = 0x01100080,
/*### Wearable ###*/
Art1 = 0x01200001,
Art2 = 0x01200002,
Art3 = 0x01200003,
Art4 = 0x01200004,
Art5 = 0x01200005,
Art6 = 0x01200006,
Art7 = 0x01200007,
Art8 = 0x01200008,
Art9 = 0x01200009,
Art10 = 0x0120000A,
Art11 = 0x0120000B,
Art12 = 0x0120000C,
Art13 = 0x0120000D,
Art14 = 0x0120000E,
Art15 = 0x0120000F,
Art16 = 0x01200010,
Art17 = 0x01200011,
Art18 = 0x01200012,
Art19 = 0x01200013,
Art20 = 0x01200014,
Art21 = 0x01200015,
Art22 = 0x01200016,
Art23 = 0x01200017,
Art24 = 0x01200018,
Art25 = 0x01200019,
Art26 = 0x0120001A,
Art27 = 0x0120001B,
Art28 = 0x0120001C,
Art29 = 0x0120001D,
Art30 = 0x0120001E,
Art31 = 0x0120001F,
Art32 = 0x01200020,
Art33 = 0x01200021,
Art34 = 0x01200022,
Art35 = 0x01200023,
Art36 = 0x01200024,
Art37 = 0x01200025,
Art38 = 0x01200026,
Art39 = 0x01200027,
Art40 = 0x01200028,
Art41 = 0x01200029,
Art42 = 0x0120002A,
Art43 = 0x0120002B,
Art44 = 0x0120002C,
Art45 = 0x0120002D,
Art46 = 0x0120002E,
Art47 = 0x0120002F,
Art48 = 0x01200030,
Art49 = 0x01200031,
Art50 = 0x01200032,
Art51 = 0x01200033,
Art52 = 0x01200034,
Art53 = 0x01200035,
Art54 = 0x01200036,
Art55 = 0x01200037,
Art56 = 0x01200038,
Art57 = 0x01200039,
Art58 = 0x0120003A,
Art59 = 0x0120003B,
Art60 = 0x0120003C,
Art61 = 0x0120003D,
Art62 = 0x0120003E,
Art63 = 0x0120003F,
Art64 = 0x01200040,
Art65 = 0x01200041,
Art66 = 0x01200042,
Art67 = 0x01200043,
Art68 = 0x01200044,
Art69 = 0x01200045,
Art70 = 0x01200046,
Art71 = 0x01200047,
Art72 = 0x01200048,
Art73 = 0x01200049,
Art74 = 0x0120004A,
Art75 = 0x0120004B,
Art76 = 0x0120004C,
Art77 = 0x0120004D,
Art78 = 0x0120004E,
Art79 = 0x0120004F,
Art80 = 0x01200050,
Art81 = 0x01200051,
Art82 = 0x01200052,
Art83 = 0x01200053,
Art84 = 0x01200054,
Art85 = 0x01200055,
Art86 = 0x01200056,
Art87 = 0x01200057,
Art88 = 0x01200058,
Art89 = 0x01200059,
Art90 = 0x0120005A,
Art91 = 0x0120005B,
Art92 = 0x0120005C,
Art93 = 0x0120005D,
Art94 = 0x0120005E,
Art95 = 0x0120005F,
Art96 = 0x01200060,
Art97 = 0x01200061,
Art98 = 0x01200062,
Art99 = 0x01200063,
Art100 = 0x01200064,
Art101 = 0x01200065,
Art102 = 0x01200066,
Art103 = 0x01200067,
Art104 = 0x01200068,
Art105 = 0x01200069,
Art106 = 0x0120006A,
Art107 = 0x0120006B,
Art108 = 0x0120006C,
Art109 = 0x0120006D,
Art110 = 0x0120006E,
Art111 = 0x0120006F,
Art112 = 0x01200070,
Art113 = 0x01200071,
Art114 = 0x01200072,
Art115 = 0x01200073,
Art116 = 0x01200074,
Art117 = 0x01200075,
Art118 = 0x01200076,
Art119 = 0x01200077,
Art120 = 0x01200078,
Art121 = 0x01200079,
Art122 = 0x0120007A,
Art123 = 0x0120007B,
Art124 = 0x0120007C,
Art125 = 0x0120007D,
Art126 = 0x0120007E,
Art127 = 0x0120007F,
Art128 = 0x01200080,
/*### Custom ###*/
Custom1 = 0x0FE00001,
Custom2 = 0x0FE00002,

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Art-device.
/// </summary>
public sealed class DynamicLightingArtRGBDevice : DynamicLightingRGBDevice<DynamicLightingArtRGBDeviceInfo>, IArt
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Art1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingArtRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingArtRGBDevice(DynamicLightingArtRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingArtRGBDevice" />.
/// </summary>
public sealed class DynamicLightingArtRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingArtRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Art, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Chassis-device.
/// </summary>
public sealed class DynamicLightingChassisRGBDevice : DynamicLightingRGBDevice<DynamicLightingChassisRGBDeviceInfo>, IChassis
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Chassis1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingChassisRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingChassisRGBDevice(DynamicLightingChassisRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingChassisRGBDevice" />.
/// </summary>
public sealed class DynamicLightingChassisRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingChassisRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Chassis, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,136 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System;
using System.Collections.Generic;
using System.Threading;
using RGB.NET.Core;
using Windows.Devices.Enumeration;
using Windows.Devices.Lights;
namespace RGB.NET.Devices.DynamicLighting;
internal record LampArrayInfo(string Id, string DisplayName, LampArray LampArray);
/// <inheritdoc />
/// <summary>
/// Represents a device provider responsible for Microsoft Dynamic Lighting devices.
/// </summary>
public sealed class DynamicLightingDeviceProvider : AbstractRGBDeviceProvider
{
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static DynamicLightingDeviceProvider? _instance;
/// <summary>
/// Gets the singleton <see cref="DynamicLightingDeviceProvider"/> instance.
/// </summary>
public static DynamicLightingDeviceProvider Instance
{
get
{
lock (_lock)
return _instance ?? new DynamicLightingDeviceProvider();
}
}
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="DynamicLightingDeviceProvider"/> class.
/// </summary>
/// <exception cref="InvalidOperationException">Thrown if this constructor is called even if there is already an instance of this class.</exception>
public DynamicLightingDeviceProvider()
{
lock (_lock)
{
if (_instance != null) throw new InvalidOperationException($"There can be only one instance of type {nameof(DynamicLightingDeviceProvider)}");
_instance = this;
}
}
#endregion
#region Methods
/// <inheritdoc />
protected override void InitializeSDK() { }
/// <inheritdoc />
protected override IEnumerable<IRGBDevice> LoadDevices()
{
ManualResetEventSlim waitEvent = new(false);
List<LampArrayInfo> lampArrays = [];
DeviceWatcher? watcher = DeviceInformation.CreateWatcher(LampArray.GetDeviceSelector());
watcher.EnumerationCompleted += OnEnumerationCompleted;
watcher.Added += OnDeviceAdded;
watcher.Start();
waitEvent.Wait();
watcher.Stop();
watcher.EnumerationCompleted -= OnEnumerationCompleted;
watcher.Added -= OnDeviceAdded;
int updateTriggerId = 0;
foreach (LampArrayInfo lampArrayInfo in lampArrays)
{
IDynamicLightingRGBDevice? device = null;
try
{
device = CreateDevice(lampArrayInfo);
device.Initialize();
}
catch (Exception ex) { Throw(ex); }
if (device != null)
yield return device;
}
yield break;
IDynamicLightingRGBDevice CreateDevice(LampArrayInfo lampArrayInfo)
=> lampArrayInfo.LampArray.LampArrayKind switch
{
LampArrayKind.Undefined => new DynamicLightingUndefinedRGBDevice(new DynamicLightingUndefinedRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Keyboard => new DynamicLightingKeyboardRGBDevice(new DynamicLightingKeyboardRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Mouse => new DynamicLightingMouseRGBDevice(new DynamicLightingMouseRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.GameController => new DynamicLightingGameControllerRGBDevice(new DynamicLightingGameControllerRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Peripheral => new DynamicLightingPeripheralRGBDevice(new DynamicLightingPeripheralRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Scene => new DynamicLightingSceneRGBDevice(new DynamicLightingSceneRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Notification => new DynamicLightingNotificationRGBDevice(new DynamicLightingNotificationRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Chassis => new DynamicLightingChassisRGBDevice(new DynamicLightingChassisRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Wearable => new DynamicLightingWearableRGBDevice(new DynamicLightingWearableRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Furniture => new DynamicLightingFurnitureRGBDevice(new DynamicLightingFurnitureRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
LampArrayKind.Art => new DynamicLightingArtRGBDevice(new DynamicLightingArtRGBDeviceInfo(lampArrayInfo), new DynamicLightingDeviceUpdateQueue(GetUpdateTrigger(updateTriggerId++, lampArrayInfo.LampArray.MinUpdateInterval.TotalSeconds), lampArrayInfo.LampArray)),
_ => throw new ArgumentOutOfRangeException()
};
void OnEnumerationCompleted(DeviceWatcher sender, object o) => waitEvent.Set();
void OnDeviceAdded(DeviceWatcher sender, DeviceInformation args)
{
try { lampArrays.Add(new LampArrayInfo(args.Id, args.Name, LampArray.FromIdAsync(args.Id).GetAwaiter().GetResult())); }
catch (Exception ex) { Throw(ex); }
}
}
/// <inheritdoc />
protected override void Dispose(bool disposing)
{
lock (_lock)
{
base.Dispose(disposing);
_instance = null;
}
}
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Furniture-device.
/// </summary>
public sealed class DynamicLightingFurnitureRGBDevice : DynamicLightingRGBDevice<DynamicLightingFurnitureRGBDeviceInfo>, IFurniture
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Furniture1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingFurnitureRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingFurnitureRGBDevice(DynamicLightingFurnitureRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingFurnitureRGBDevice" />.
/// </summary>
public sealed class DynamicLightingFurnitureRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingFurnitureRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Furniture, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting GameController-device.
/// </summary>
public sealed class DynamicLightingGameControllerRGBDevice : DynamicLightingRGBDevice<DynamicLightingGameControllerRGBDeviceInfo>, IGameController
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.GameController1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingGameControllerRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingGameControllerRGBDevice(DynamicLightingGameControllerRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingGameControllerRGBDevice" />.
/// </summary>
public sealed class DynamicLightingGameControllerRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingGameControllerRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.GameController, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,81 @@
using System;
using Windows.Devices.Lights;
using RGB.NET.Core;
using System.Linq;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents the update-queue performing updates for dynamic lightning devices.
/// </summary>
public sealed class DynamicLightingDeviceUpdateQueue : UpdateQueue
{
#region Properties & Fields
private bool _isDisposed = false;
private readonly LampArray _lampArray;
private readonly int[] _indices;
private readonly Windows.UI.Color[] _colors;
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="DynamicLightingDeviceUpdateQueue"/> class.
/// </summary>
/// <param name="updateTrigger">The update trigger used by this queue.</param>
/// <param name="lampArray">The lamp array to update.</param>
internal DynamicLightingDeviceUpdateQueue(IDeviceUpdateTrigger updateTrigger, LampArray lampArray)
: base(updateTrigger)
{
this._lampArray = lampArray;
_colors = new Windows.UI.Color[lampArray.LampCount];
_indices = Enumerable.Range(0, lampArray.LampCount).ToArray();
}
#endregion
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{
if (_isDisposed) throw new ObjectDisposedException(nameof(DynamicLightingDeviceUpdateQueue));
if (!_lampArray.IsConnected) return false;
// ReSharper disable once ForCanBeConvertedToForeach - Prevent a possible allocation of an enumerator
for (int i = 0; i < dataSet.Length; i++)
{
(object key, Color color) = dataSet[i];
(byte a, byte r, byte g, byte b) = color.GetRGBBytes();
_colors[(int)key] = Windows.UI.Color.FromArgb(a, r, g, b);
}
_lampArray.SetColorsForIndices(_colors, _indices);
return true;
}
catch (Exception ex)
{
DynamicLightingDeviceProvider.Instance.Throw(ex);
}
return false;
}
/// <inheritdoc />
public override void Dispose()
{
base.Dispose();
_isDisposed = true;
}
#endregion
}

View File

@ -0,0 +1,79 @@
using Windows.Devices.Lights;
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="AbstractRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a generic Dynamic Lighting-device.
/// </summary>
public abstract class DynamicLightingRGBDevice<TDeviceInfo> : AbstractRGBDevice<TDeviceInfo>, IDynamicLightingRGBDevice
where TDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Properties & Fields
/// <summary>
/// Gets the mapping of <see cref="LedId"/> to the index of the led used to update the LEDs of this device.
/// </summary>
protected LedMapping<int> Mapping { get; private set; } = [];
/// <summary>
/// Gets the reference led id.
/// </summary>
protected abstract LedId ReferenceLedId { get; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="DynamicLightingRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
protected DynamicLightingRGBDevice(TDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue) { }
#endregion
#region Methods
void IDynamicLightingRGBDevice.Initialize()
{
Mapping = CreateMapping();
InitializeLayout();
}
/// <summary>
/// Initializes the LEDs of the device based on the data provided by the SDK.
/// </summary>
protected virtual void InitializeLayout()
{
for (int i = 0; i < DeviceInfo.LedCount; i++)
{
LampInfo lampInfo = DeviceInfo.LampArray.GetLampInfo(i);
LedId ledId = Mapping.TryGetValue(i, out LedId id) ? id : LedId.Invalid;
Rectangle rectangle = new(new Point(lampInfo.Position.X, lampInfo.Position.Y), new Size(10, 10));
AddLed(ledId, rectangle.Location, rectangle.Size);
}
}
/// <summary>
/// Creates a mapping for this device.
/// </summary>
/// <returns>The mapping.</returns>
protected virtual LedMapping<int> CreateMapping()
{
LedMapping<int> mapping = [];
for (int i = 0; i < DeviceInfo.LedCount; i++)
mapping.Add(ReferenceLedId + i, i);
return mapping;
}
/// <inheritdoc />
protected override object GetLedCustomData(LedId ledId) => Mapping.TryGetValue(ledId, out int index) ? index : 0;
#endregion
}

View File

@ -0,0 +1,63 @@
using Windows.Devices.Lights;
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a DynamicLighting-<see cref="T:RGB.NET.Core.IRGBDevice" />.
/// </summary>
public class DynamicLightingRGBDeviceInfo : IRGBDeviceInfo
{
#region Properties & Fields
/// <inheritdoc />
public RGBDeviceType DeviceType { get; }
/// <inheritdoc />
public string DeviceName { get; }
/// <inheritdoc />
public string Manufacturer => "Dynamic Lighting";
/// <inheritdoc />
public string Model { get; }
/// <summary>
/// Returns the unique ID of the device
/// </summary>
public string DeviceId { get; }
/// <inheritdoc />
public object? LayoutMetadata { get; set; }
/// <summary>
/// Gets the amount of LEDs this device contains.
/// </summary>
public int LedCount { get; }
internal LampArray LampArray { get; }
#endregion
#region Constructors
/// <summary>
/// Internal constructor of managed <see cref="DynamicLightingRGBDeviceInfo"/>.
/// </summary>
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="lampArrayInfo">The low level information for this device.</param>
internal DynamicLightingRGBDeviceInfo(RGBDeviceType deviceType, LampArrayInfo lampArrayInfo)
{
this.DeviceType = deviceType;
LampArray = lampArrayInfo.LampArray;
DeviceId = lampArrayInfo.Id;
Model = lampArrayInfo.DisplayName;
LedCount = lampArrayInfo.LampArray.LampCount;
DeviceName = DeviceHelper.CreateDeviceName(Manufacturer, Model);
}
#endregion
}

View File

@ -0,0 +1,11 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <summary>
/// Represents a DynamicLighting RGB-device.
/// </summary>
public interface IDynamicLightingRGBDevice : IRGBDevice
{
internal void Initialize();
}

View File

@ -0,0 +1,102 @@
using System.Collections.Generic;
using Windows.System;
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
internal static class LedMappings
{
public static Dictionary<VirtualKey, LedId> KeyboardMapping = new()
{
[VirtualKey.Back] = LedId.Keyboard_Backspace,
[VirtualKey.Tab] = LedId.Keyboard_Tab,
[VirtualKey.Enter] = LedId.Keyboard_Enter,
[VirtualKey.Pause] = LedId.Keyboard_PauseBreak,
[VirtualKey.CapitalLock] = LedId.Keyboard_CapsLock,
[VirtualKey.Escape] = LedId.Keyboard_Escape,
[VirtualKey.Space] = LedId.Keyboard_Space,
[VirtualKey.PageUp] = LedId.Keyboard_PageUp,
[VirtualKey.PageDown] = LedId.Keyboard_PageDown,
[VirtualKey.End] = LedId.Keyboard_End,
[VirtualKey.Home] = LedId.Keyboard_Home,
[VirtualKey.Left] = LedId.Keyboard_ArrowLeft,
[VirtualKey.Up] = LedId.Keyboard_ArrowUp,
[VirtualKey.Right] = LedId.Keyboard_ArrowRight,
[VirtualKey.Down] = LedId.Keyboard_ArrowDown,
[VirtualKey.Print] = LedId.Keyboard_PrintScreen,
[VirtualKey.Insert] = LedId.Keyboard_Insert,
[VirtualKey.Delete] = LedId.Keyboard_Delete,
[VirtualKey.Number0] = LedId.Keyboard_0,
[VirtualKey.Number1] = LedId.Keyboard_1,
[VirtualKey.Number2] = LedId.Keyboard_2,
[VirtualKey.Number3] = LedId.Keyboard_3,
[VirtualKey.Number4] = LedId.Keyboard_4,
[VirtualKey.Number5] = LedId.Keyboard_5,
[VirtualKey.Number6] = LedId.Keyboard_6,
[VirtualKey.Number7] = LedId.Keyboard_7,
[VirtualKey.Number8] = LedId.Keyboard_8,
[VirtualKey.Number9] = LedId.Keyboard_9,
[VirtualKey.A] = LedId.Keyboard_A,
[VirtualKey.B] = LedId.Keyboard_B,
[VirtualKey.C] = LedId.Keyboard_C,
[VirtualKey.D] = LedId.Keyboard_D,
[VirtualKey.E] = LedId.Keyboard_E,
[VirtualKey.F] = LedId.Keyboard_F,
[VirtualKey.G] = LedId.Keyboard_G,
[VirtualKey.H] = LedId.Keyboard_H,
[VirtualKey.I] = LedId.Keyboard_I,
[VirtualKey.J] = LedId.Keyboard_J,
[VirtualKey.K] = LedId.Keyboard_K,
[VirtualKey.L] = LedId.Keyboard_L,
[VirtualKey.M] = LedId.Keyboard_M,
[VirtualKey.N] = LedId.Keyboard_N,
[VirtualKey.O] = LedId.Keyboard_O,
[VirtualKey.P] = LedId.Keyboard_P,
[VirtualKey.Q] = LedId.Keyboard_Q,
[VirtualKey.R] = LedId.Keyboard_R,
[VirtualKey.S] = LedId.Keyboard_S,
[VirtualKey.T] = LedId.Keyboard_T,
[VirtualKey.U] = LedId.Keyboard_U,
[VirtualKey.V] = LedId.Keyboard_V,
[VirtualKey.W] = LedId.Keyboard_W,
[VirtualKey.X] = LedId.Keyboard_X,
[VirtualKey.Y] = LedId.Keyboard_Y,
[VirtualKey.Z] = LedId.Keyboard_Z,
[VirtualKey.LeftWindows] = LedId.Keyboard_LeftGui,
[VirtualKey.RightWindows] = LedId.Keyboard_RightGui,
[VirtualKey.Application] = LedId.Keyboard_Application,
[VirtualKey.NumberPad0] = LedId.Keyboard_Num0,
[VirtualKey.NumberPad1] = LedId.Keyboard_Num1,
[VirtualKey.NumberPad2] = LedId.Keyboard_Num2,
[VirtualKey.NumberPad3] = LedId.Keyboard_Num3,
[VirtualKey.NumberPad4] = LedId.Keyboard_Num4,
[VirtualKey.NumberPad5] = LedId.Keyboard_Num5,
[VirtualKey.NumberPad6] = LedId.Keyboard_Num6,
[VirtualKey.NumberPad7] = LedId.Keyboard_Num7,
[VirtualKey.NumberPad8] = LedId.Keyboard_Num8,
[VirtualKey.NumberPad9] = LedId.Keyboard_Num9,
[VirtualKey.Multiply] = LedId.Keyboard_NumAsterisk,
[VirtualKey.Add] = LedId.Keyboard_NumPlus,
[VirtualKey.Subtract] = LedId.Keyboard_NumMinus,
[VirtualKey.Decimal] = LedId.Keyboard_NumComma,
[VirtualKey.Divide] = LedId.Keyboard_NumSlash,
[VirtualKey.F1] = LedId.Keyboard_F1,
[VirtualKey.F2] = LedId.Keyboard_F2,
[VirtualKey.F3] = LedId.Keyboard_F3,
[VirtualKey.F4] = LedId.Keyboard_F4,
[VirtualKey.F5] = LedId.Keyboard_F5,
[VirtualKey.F6] = LedId.Keyboard_F6,
[VirtualKey.F7] = LedId.Keyboard_F7,
[VirtualKey.F8] = LedId.Keyboard_F8,
[VirtualKey.F9] = LedId.Keyboard_F9,
[VirtualKey.F10] = LedId.Keyboard_F10,
[VirtualKey.F11] = LedId.Keyboard_F11,
[VirtualKey.F12] = LedId.Keyboard_F12,
[VirtualKey.NumberKeyLock] = LedId.Keyboard_NumLock,
[VirtualKey.Scroll] = LedId.Keyboard_ScrollLock,
[VirtualKey.LeftShift] = LedId.Keyboard_LeftShift,
[VirtualKey.RightShift] = LedId.Keyboard_RightShift,
[VirtualKey.LeftControl] = LedId.Keyboard_LeftCtrl,
[VirtualKey.RightControl] = LedId.Keyboard_RightCtrl,
};
}

View File

@ -0,0 +1,73 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System.Collections.Generic;
using System.Linq;
using Windows.System;
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Keyboard-device.
/// </summary>
public sealed class DynamicLightingKeyboardRGBDevice : DynamicLightingRGBDevice<DynamicLightingKeyboardRGBDeviceInfo>, IKeyboard
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Keyboard_Programmable1;
IKeyboardDeviceInfo IKeyboard.DeviceInfo => DeviceInfo;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingKeyboardRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingKeyboardRGBDevice(DynamicLightingKeyboardRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
#region Methods
/// <inheritdoc/>
protected override LedMapping<int> CreateMapping()
{
LedMapping<int> ledMapping = [];
HashSet<int> indices = Enumerable.Range(0, DeviceInfo.LedCount).ToHashSet();
if (DeviceInfo.LampArray.SupportsVirtualKeys)
{
foreach ((VirtualKey virtualKey, LedId ledId) in LedMappings.KeyboardMapping)
{
int[] virtualKeyIndices = DeviceInfo.LampArray.GetIndicesForKey(virtualKey);
if (virtualKeyIndices.Length > 0)
{
int? index = virtualKeyIndices.FirstOrDefault(indices.Contains);
if (index != null)
{
ledMapping.Add(ledId, index.Value);
indices.Remove(index.Value);
}
}
}
}
LedId referenceLed = LedId.Keyboard_Custom1;
foreach (int index in indices.OrderBy(x => x))
ledMapping.Add(referenceLed++, index);
return ledMapping;
}
#endregion
}

View File

@ -0,0 +1,26 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDeviceInfo" />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingKeyboardRGBDevice" />.
/// </summary>
public sealed class DynamicLightingKeyboardRGBDeviceInfo : DynamicLightingRGBDeviceInfo, IKeyboardDeviceInfo
{
#region Properties & Fields
/// <inheritdoc/>
public KeyboardLayoutType Layout => KeyboardLayoutType.Unknown;
#endregion
#region Constructors
/// <inheritdoc />
internal DynamicLightingKeyboardRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Keyboard, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Mouse-device.
/// </summary>
public sealed class DynamicLightingMouseRGBDevice : DynamicLightingRGBDevice<DynamicLightingMouseRGBDeviceInfo>, IMouse
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Mouse1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingMouseRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingMouseRGBDevice(DynamicLightingMouseRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingMouseRGBDevice" />.
/// </summary>
public sealed class DynamicLightingMouseRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingMouseRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Mouse, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Notification-device.
/// </summary>
public sealed class DynamicLightingNotificationRGBDevice : DynamicLightingRGBDevice<DynamicLightingNotificationRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Unknown1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingNotificationRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingNotificationRGBDevice(DynamicLightingNotificationRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingNotificationRGBDevice" />.
/// </summary>
public sealed class DynamicLightingNotificationRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingNotificationRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Unknown, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Peripheral-device.
/// </summary>
public sealed class DynamicLightingPeripheralRGBDevice : DynamicLightingRGBDevice<DynamicLightingPeripheralRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Unknown1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingPeripheralRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingPeripheralRGBDevice(DynamicLightingPeripheralRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingPeripheralRGBDevice" />.
/// </summary>
public sealed class DynamicLightingPeripheralRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingPeripheralRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Unknown, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,9 @@
[RGB.NET](https://github.com/DarthAffe/RGB.NET) Device-Provider-Package for Microsoft Dynamic Lighting-Devices.
## Usage
This provider follows the default pattern and does not require additional setup.
```csharp
surface.Load(DynamicLightingDeviceProvider.Instance);
```

View File

@ -0,0 +1,64 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows10.0.17763.0;net7.0-windows10.0.17763.0</TargetFrameworks>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Authors>Darth Affe</Authors>
<Company>Wyrez</Company>
<Language>en-US</Language>
<NeutralLanguage>en-US</NeutralLanguage>
<Title>RGB.NET.Devices.DynamicLighting</Title>
<AssemblyName>RGB.NET.Devices.DynamicLighting</AssemblyName>
<AssemblyTitle>RGB.NET.Devices.DynamicLighting</AssemblyTitle>
<PackageId>RGB.NET.Devices.DynamicLighting</PackageId>
<RootNamespace>RGB.NET.Devices.DynamicLighting</RootNamespace>
<Description>Microsoft Dynamic Lighting-Device-Implementations of RGB.NET</Description>
<Summary>Microsoft Dynamic Lighting-Device-Implementations of RGB.NET, a C# (.NET) library for accessing various RGB-peripherals</Summary>
<Copyright>Copyright © Darth Affe 2024</Copyright>
<PackageCopyright>Copyright © Darth Affe 2024</PackageCopyright>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/DarthAffe/RGB.NET</PackageProjectUrl>
<PackageLicenseExpression>LGPL-2.1-only</PackageLicenseExpression>
<RepositoryType>Github</RepositoryType>
<RepositoryUrl>https://github.com/DarthAffe/RGB.NET</RepositoryUrl>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes></PackageReleaseNotes>
<Version>0.0.1</Version>
<AssemblyVersion>0.0.1</AssemblyVersion>
<FileVersion>0.0.1</FileVersion>
<OutputPath>..\bin\</OutputPath>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSource>True</IncludeSource>
<IncludeSymbols>True</IncludeSymbols>
<DebugType>portable</DebugType>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize>true</Optimize>
<NoWarn>$(NoWarn);CS1591;CS1572;CS1573</NoWarn>
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RGB.NET.Core\RGB.NET.Core.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=chassis/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=furniture/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gamecontroller/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=keyboard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=mouse/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=notification/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=peripheral/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=scene/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=undefined/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=wearable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=art/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Scene-device.
/// </summary>
public sealed class DynamicLightingSceneRGBDevice : DynamicLightingRGBDevice<DynamicLightingSceneRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Unknown1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingSceneRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingSceneRGBDevice(DynamicLightingSceneRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingSceneRGBDevice" />.
/// </summary>
public sealed class DynamicLightingSceneRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingSceneRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Unknown, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Undefined-device.
/// </summary>
public sealed class DynamicLightingUndefinedRGBDevice : DynamicLightingRGBDevice<DynamicLightingUndefinedRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Unknown1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingUndefinedRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingUndefinedRGBDevice(DynamicLightingUndefinedRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingUndefinedRGBDevice" />.
/// </summary>
public sealed class DynamicLightingUndefinedRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingUndefinedRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Unknown, lampArrayInfo)
{ }
#endregion
}

View File

@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc cref="DynamicLightingRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a Dynamic Lighting Wearable-device.
/// </summary>
public sealed class DynamicLightingWearableRGBDevice : DynamicLightingRGBDevice<DynamicLightingWearableRGBDeviceInfo>, IWearable
{
#region Properties & Fields
/// <inheritdoc/>
protected override LedId ReferenceLedId => LedId.Wearable1;
#endregion
#region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingWearableRGBDevice" /> class.
/// </summary>
/// <param name="info">The meta data for this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal DynamicLightingWearableRGBDevice(DynamicLightingWearableRGBDeviceInfo info, DynamicLightingDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }
#endregion
}

View File

@ -0,0 +1,19 @@
using RGB.NET.Core;
namespace RGB.NET.Devices.DynamicLighting;
/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.DynamicLighting.DynamicLightingWearableRGBDevice" />.
/// </summary>
public sealed class DynamicLightingWearableRGBDeviceInfo : DynamicLightingRGBDeviceInfo
{
#region Constructors
/// <inheritdoc />
internal DynamicLightingWearableRGBDeviceInfo(LampArrayInfo lampArrayInfo)
: base(RGBDeviceType.Wearable, lampArrayInfo)
{ }
#endregion
}

View File

@ -51,6 +51,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.Corsair_Leg
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.WLED", "RGB.NET.Devices.WLED\RGB.NET.Devices.WLED.csproj", "{C533C5EA-66A8-4826-A814-80791E7593ED}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RGB.NET.Devices.DynamicLighting", "RGB.NET.Devices.DynamicLighting\RGB.NET.Devices.DynamicLighting.csproj", "{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -145,6 +147,10 @@ Global
{C533C5EA-66A8-4826-A814-80791E7593ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C533C5EA-66A8-4826-A814-80791E7593ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C533C5EA-66A8-4826-A814-80791E7593ED}.Release|Any CPU.Build.0 = Release|Any CPU
{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -168,6 +174,7 @@ Global
{F29A96E5-CDD0-469F-A871-A35A7519BC49} = {D13032C6-432E-4F43-8A32-071133C22B16}
{66AF690C-27A1-4097-AC53-57C0ED89E286} = {D13032C6-432E-4F43-8A32-071133C22B16}
{C533C5EA-66A8-4826-A814-80791E7593ED} = {D13032C6-432E-4F43-8A32-071133C22B16}
{FF762C52-D84E-48C0-BEE7-2EA3B2C28F02} = {D13032C6-432E-4F43-8A32-071133C22B16}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7F222AD4-1F9E-4AAB-9D69-D62372D4C1BA}