diff --git a/CUE.NET.csproj b/CUE.NET.csproj
index 433b80a..0d4f201 100644
--- a/CUE.NET.csproj
+++ b/CUE.NET.csproj
@@ -63,15 +63,22 @@
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
@@ -80,7 +87,7 @@
-
+
@@ -91,6 +98,7 @@
+
if $(PlatformName) == x86 copy "$(SolutionDir)libs\CUESDK_2013.dll" "$(TargetDir)CUESDK_2013.dll"
diff --git a/Enums/CorsairAccessMode.cs b/Enums/CorsairAccessMode.cs
index dc569f5..5ff32c7 100644
--- a/Enums/CorsairAccessMode.cs
+++ b/Enums/CorsairAccessMode.cs
@@ -8,6 +8,6 @@ namespace CUE.NET.Enums
///
public enum CorsairAccessMode
{
- CAM_ExclusiveLightingControl = 0
+ ExclusiveLightingControl = 0
};
}
diff --git a/Enums/CorsairDeviceCaps.cs b/Enums/CorsairDeviceCaps.cs
index f8982ae..fb8c9a0 100644
--- a/Enums/CorsairDeviceCaps.cs
+++ b/Enums/CorsairDeviceCaps.cs
@@ -14,11 +14,11 @@ namespace CUE.NET.Enums
///
/// For devices that do not support any SDK functions
///
- CDC_None = 0,
+ None = 0,
///
/// For devices that has controlled lighting
///
- CDC_Lighting = 1
+ Lighting = 1
};
}
diff --git a/Enums/CorsairDeviceType.cs b/Enums/CorsairDeviceType.cs
index e0f415d..94f6148 100644
--- a/Enums/CorsairDeviceType.cs
+++ b/Enums/CorsairDeviceType.cs
@@ -8,9 +8,9 @@ namespace CUE.NET.Enums
///
public enum CorsairDeviceType
{
- CDT_Unknown = 0,
- CDT_Mouse = 1,
- CDT_Keyboard = 2,
- CDT_Headset = 3
+ Unknown = 0,
+ Mouse = 1,
+ Keyboard = 2,
+ Headset = 3
};
}
diff --git a/Enums/CorsairError.cs b/Enums/CorsairError.cs
index 5938f06..029f65e 100644
--- a/Enums/CorsairError.cs
+++ b/Enums/CorsairError.cs
@@ -11,32 +11,32 @@ namespace CUE.NET.Enums
///
/// If previously called function completed successfully.
///
- CE_Success,
+ Success,
///
/// CUE is not running or was shut down or third-party control is disabled in CUE settings. (runtime error)
///
- CE_ServerNotFound,
+ ServerNotFound,
///
/// If some other client has or took over exclusive control. (runtime error)
///
- CE_NoControl,
+ NoControl,
///
/// If developer did not perform protocol handshake. (developer error)
///
- CE_ProtocolHandshakeMissing,
+ ProtocolHandshakeMissing,
///
/// If developer is calling the function that is not supported by the server (either because protocol has broken by server or client or because the function is new and server is too old.
/// Check CorsairProtocolDetails for details). (developer error)
///
- CE_IncompatibleProtocol,
+ IncompatibleProtocol,
///
/// If developer supplied invalid arguments to the function (for specifics look at function descriptions). (developer error)
///
- CE_InvalidArguments
+ InvalidArguments
};
}
diff --git a/Enums/CorsairLedId.cs b/Enums/CorsairLedId.cs
deleted file mode 100644
index 4b8909c..0000000
--- a/Enums/CorsairLedId.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-// ReSharper disable UnusedMember.Global
-// ReSharper disable InconsistentNaming
-
-namespace CUE.NET.Enums
-{
- public enum CorsairLedId
- {
- CLI_Invalid = 0,
- CLK_Escape = 1,
- CLK_F1 = 2,
- CLK_F2 = 3,
- CLK_F3 = 4,
- CLK_F4 = 5,
- CLK_F5 = 6,
- CLK_F6 = 7,
- CLK_F7 = 8,
- CLK_F8 = 9,
- CLK_F9 = 10,
- CLK_F10 = 11,
- CLK_F11 = 12,
- CLK_GraveAccentAndTilde = 13,
- CLK_1 = 14,
- CLK_2 = 15,
- CLK_3 = 16,
- CLK_4 = 17,
- CLK_5 = 18,
- CLK_6 = 19,
- CLK_7 = 20,
- CLK_8 = 21,
- CLK_9 = 22,
- CLK_0 = 23,
- CLK_MinusAndUnderscore = 24,
- CLK_Tab = 25,
- CLK_Q = 26,
- CLK_W = 27,
- CLK_E = 28,
- CLK_R = 29,
- CLK_T = 30,
- CLK_Y = 31,
- CLK_U = 32,
- CLK_I = 33,
- CLK_O = 34,
- CLK_P = 35,
- CLK_BracketLeft = 36,
- CLK_CapsLock = 37,
- CLK_A = 38,
- CLK_S = 39,
- CLK_D = 40,
- CLK_F = 41,
- CLK_G = 42,
- CLK_H = 43,
- CLK_J = 44,
- CLK_K = 45,
- CLK_L = 46,
- CLK_SemicolonAndColon = 47,
- CLK_ApostropheAndDoubleQuote = 48,
- CLK_LeftShift = 49,
- CLK_NonUsBackslash = 50,
- CLK_Z = 51,
- CLK_X = 52,
- CLK_C = 53,
- CLK_V = 54,
- CLK_B = 55,
- CLK_N = 56,
- CLK_M = 57,
- CLK_CommaAndLessThan = 58,
- CLK_PeriodAndBiggerThan = 59,
- CLK_SlashAndQuestionMark = 60,
- CLK_LeftCtrl = 61,
- CLK_LeftGui = 62,
- CLK_LeftAlt = 63,
- CLK_Lang2 = 64,
- CLK_Space = 65,
- CLK_Lang1 = 66,
- CLK_International2 = 67,
- CLK_RightAlt = 68,
- CLK_RightGui = 69,
- CLK_Application = 70,
- CLK_LedProgramming = 71,
- CLK_Brightness = 72,
- CLK_F12 = 73,
- CLK_PrintScreen = 74,
- CLK_ScrollLock = 75,
- CLK_PauseBreak = 76,
- CLK_Insert = 77,
- CLK_Home = 78,
- CLK_PageUp = 79,
- CLK_BracketRight = 80,
- CLK_Backslash = 81,
- CLK_NonUsTilde = 82,
- CLK_Enter = 83,
- CLK_International1 = 84,
- CLK_EqualsAndPlus = 85,
- CLK_International3 = 86,
- CLK_Backspace = 87,
- CLK_Delete = 88,
- CLK_End = 89,
- CLK_PageDown = 90,
- CLK_RightShift = 91,
- CLK_RightCtrl = 92,
- CLK_UpArrow = 93,
- CLK_LeftArrow = 94,
- CLK_DownArrow = 95,
- CLK_RightArrow = 96,
- CLK_WinLock = 97,
- CLK_Mute = 98,
- CLK_Stop = 99,
- CLK_ScanPreviousTrack = 100,
- CLK_PlayPause = 101,
- CLK_ScanNextTrack = 102,
- CLK_NumLock = 103,
- CLK_KeypadSlash = 104,
- CLK_KeypadAsterisk = 105,
- CLK_KeypadMinus = 106,
- CLK_KeypadPlus = 107,
- CLK_KeypadEnter = 108,
- CLK_Keypad7 = 109,
- CLK_Keypad8 = 110,
- CLK_Keypad9 = 111,
- CLK_KeypadComma = 112,
- CLK_Keypad4 = 113,
- CLK_Keypad5 = 114,
- CLK_Keypad6 = 115,
- CLK_Keypad1 = 116,
- CLK_Keypad2 = 117,
- CLK_Keypad3 = 118,
- CLK_Keypad0 = 119,
- CLK_KeypadPeriodAndDelete = 120,
- CLK_G1 = 121,
- CLK_G2 = 122,
- CLK_G3 = 123,
- CLK_G4 = 124,
- CLK_G5 = 125,
- CLK_G6 = 126,
- CLK_G7 = 127,
- CLK_G8 = 128,
- CLK_G9 = 129,
- CLK_G10 = 130,
- CLK_VolumeUp = 131,
- CLK_VolumeDown = 132,
- CLK_MR = 133,
- CLK_M1 = 134,
- CLK_M2 = 135,
- CLK_M3 = 136,
- CLK_G11 = 137,
- CLK_G12 = 138,
- CLK_G13 = 139,
- CLK_G14 = 140,
- CLK_G15 = 141,
- CLK_G16 = 142,
- CLK_G17 = 143,
- CLK_G18 = 144,
- CLK_International5 = 145,
- CLK_International4 = 146,
- CLK_Fn = 147,
- CLM_1 = 148,
- CLM_2 = 149,
- CLM_3 = 150,
- CLM_4 = 151,
- CLH_LeftLogo = 152,
- CLH_RightLogo = 153,
- CLK_Logo = 154,
-
- CLI_Last = CLK_Logo
- };
-}
diff --git a/Enums/CorsairLogicalLayout.cs b/Enums/CorsairLogicalLayout.cs
deleted file mode 100644
index 96d491e..0000000
--- a/Enums/CorsairLogicalLayout.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// ReSharper disable InconsistentNaming
-// ReSharper disable UnusedMember.Global
-
-namespace CUE.NET.Enums
-{
- ///
- /// Contains list of available logical layouts for keyboards.
- ///
- public enum CorsairLogicalLayout
- {
- ///
- /// Dummy value
- ///
- CLL_Invalid = 0,
-
- CLL_US_Int = 1,
- CLL_NA = 2,
- CLL_EU = 3,
- CLL_UK = 4,
- CLL_BE = 5,
- CLL_BR = 6,
- CLL_CH = 7,
- CLL_CN = 8,
- CLL_DE = 9,
- CLL_ES = 10,
- CLL_FR = 11,
- CLL_IT = 12,
- CLL_ND = 13,
- CLL_RU = 14,
- CLL_JP = 15,
- CLL_KR = 16,
- CLL_TW = 17,
- CLL_MEX = 18
- };
-}
diff --git a/Enums/CorsairPhysicalLayout.cs b/Enums/CorsairPhysicalLayout.cs
deleted file mode 100644
index 131eff8..0000000
--- a/Enums/CorsairPhysicalLayout.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// ReSharper disable InconsistentNaming
-// ReSharper disable UnusedMember.Global
-
-namespace CUE.NET.Enums
-{
- ///
- /// Contains list of available physical layouts for keyboards.
- ///
- public enum CorsairPhysicalLayout
- {
- ///
- /// Dummy value
- ///
- CPL_Invalid = 0,
-
- ///
- /// US-Keyboard
- ///
- CPL_US = 1,
-
- ///
- /// UK-Keyboard
- ///
- CPL_UK = 2,
-
- ///
- /// BR-Keyboard
- ///
- CPL_BR = 3,
-
- ///
- /// JP-Keyboard
- ///
- CPL_JP = 4,
-
- ///
- /// KR-Keyboard
- ///
- CPL_KR = 5,
-
- ///
- /// Zone1-Mouse
- ///
- CPL_Zones1 = 6,
-
- ///
- /// Zone1-Mouse
- ///
- CPL_Zones2 = 7,
-
- ///
- /// Zone1-Mouse
- ///
- CPL_Zones3 = 8,
-
- ///
- /// Zone1-Mouse
- ///
- CPL_Zones4 = 9
- };
-}
diff --git a/Enums/Headset/CorsairHeadsetLedId.cs b/Enums/Headset/CorsairHeadsetLedId.cs
new file mode 100644
index 0000000..61e3b7c
--- /dev/null
+++ b/Enums/Headset/CorsairHeadsetLedId.cs
@@ -0,0 +1,11 @@
+// ReSharper disable UnusedMember.Global
+// ReSharper disable InconsistentNaming
+
+namespace CUE.NET.Enums.Headset
+{
+ public enum CorsairHeadsetLedId
+ {
+ LeftLogo = 152,
+ RightLogo = 153
+ }
+}
diff --git a/Enums/Keyboard/CorsairKeyboardLedId.cs b/Enums/Keyboard/CorsairKeyboardLedId.cs
new file mode 100644
index 0000000..6c84eb1
--- /dev/null
+++ b/Enums/Keyboard/CorsairKeyboardLedId.cs
@@ -0,0 +1,157 @@
+// ReSharper disable UnusedMember.Global
+// ReSharper disable InconsistentNaming
+
+namespace CUE.NET.Enums.Keyboard
+{
+ public enum CorsairKeyboardLedId
+ {
+ Escape = 1,
+ F1 = 2,
+ F2 = 3,
+ F3 = 4,
+ F4 = 5,
+ F5 = 6,
+ F6 = 7,
+ F7 = 8,
+ F8 = 9,
+ F9 = 10,
+ F10 = 11,
+ F11 = 12,
+ GraveAccentAndTilde = 13,
+ D1 = 14,
+ D2 = 15,
+ D3 = 16,
+ D4 = 17,
+ D5 = 18,
+ D6 = 19,
+ D7 = 20,
+ D8 = 21,
+ D9 = 22,
+ D0 = 23,
+ MinusAndUnderscore = 24,
+ Tab = 25,
+ Q = 26,
+ W = 27,
+ E = 28,
+ R = 29,
+ T = 30,
+ Y = 31,
+ U = 32,
+ I = 33,
+ O = 34,
+ P = 35,
+ BracketLeft = 36,
+ CapsLock = 37,
+ A = 38,
+ S = 39,
+ D = 40,
+ F = 41,
+ G = 42,
+ H = 43,
+ J = 44,
+ K = 45,
+ L = 46,
+ SemicolonAndColon = 47,
+ ApostropheAndDoubleQuote = 48,
+ LeftShift = 49,
+ NonUsBackslash = 50,
+ Z = 51,
+ X = 52,
+ C = 53,
+ V = 54,
+ B = 55,
+ N = 56,
+ M = 57,
+ CommaAndLessThan = 58,
+ PeriodAndBiggerThan = 59,
+ SlashAndQuestionMark = 60,
+ LeftCtrl = 61,
+ LeftGui = 62,
+ LeftAlt = 63,
+ Lang2 = 64,
+ Space = 65,
+ Lang1 = 66,
+ International2 = 67,
+ RightAlt = 68,
+ RightGui = 69,
+ Application = 70,
+ LedProgramming = 71,
+ Brightness = 72,
+ F12 = 73,
+ PrintScreen = 74,
+ ScrollLock = 75,
+ PauseBreak = 76,
+ Insert = 77,
+ Home = 78,
+ PageUp = 79,
+ BracketRight = 80,
+ Backslash = 81,
+ NonUsTilde = 82,
+ Enter = 83,
+ International1 = 84,
+ EqualsAndPlus = 85,
+ International3 = 86,
+ Backspace = 87,
+ Delete = 88,
+ End = 89,
+ PageDown = 90,
+ RightShift = 91,
+ RightCtrl = 92,
+ UpArrow = 93,
+ LeftArrow = 94,
+ DownArrow = 95,
+ RightArrow = 96,
+ WinLock = 97,
+ Mute = 98,
+ Stop = 99,
+ ScanPreviousTrack = 100,
+ PlayPause = 101,
+ ScanNextTrack = 102,
+ NumLock = 103,
+ KeypadSlash = 104,
+ KeypadAsterisk = 105,
+ KeypadMinus = 106,
+ KeypadPlus = 107,
+ KeypadEnter = 108,
+ Keypad7 = 109,
+ Keypad8 = 110,
+ Keypad9 = 111,
+ KeypadComma = 112,
+ Keypad4 = 113,
+ Keypad5 = 114,
+ Keypad6 = 115,
+ Keypad1 = 116,
+ Keypad2 = 117,
+ Keypad3 = 118,
+ Keypad0 = 119,
+ KeypadPeriodAndDelete = 120,
+ G1 = 121,
+ G2 = 122,
+ G3 = 123,
+ G4 = 124,
+ G5 = 125,
+ G6 = 126,
+ G7 = 127,
+ G8 = 128,
+ G9 = 129,
+ G10 = 130,
+ VolumeUp = 131,
+ VolumeDown = 132,
+ MR = 133,
+ M1 = 134,
+ M2 = 135,
+ M3 = 136,
+ G11 = 137,
+ G12 = 138,
+ G13 = 139,
+ G14 = 140,
+ G15 = 141,
+ G16 = 142,
+ G17 = 143,
+ G18 = 144,
+ International5 = 145,
+ International4 = 146,
+ Fn = 147,
+ CLK_Logo = 154
+ }
+}
diff --git a/Enums/Keyboard/CorsairLogicalKeyboardLayout.cs b/Enums/Keyboard/CorsairLogicalKeyboardLayout.cs
new file mode 100644
index 0000000..d9dc0c9
--- /dev/null
+++ b/Enums/Keyboard/CorsairLogicalKeyboardLayout.cs
@@ -0,0 +1,30 @@
+// ReSharper disable InconsistentNaming
+// ReSharper disable UnusedMember.Global
+
+namespace CUE.NET.Enums.Keyboard
+{
+ ///
+ /// Contains list of available logical layouts for keyboards.
+ ///
+ public enum CorsairLogicalKeyboardLayout
+ {
+ US_Int = 1,
+ NA = 2,
+ EU = 3,
+ UK = 4,
+ BE = 5,
+ BR = 6,
+ CH = 7,
+ CN = 8,
+ DE = 9,
+ ES = 10,
+ FR = 11,
+ IT = 12,
+ ND = 13,
+ RU = 14,
+ JP = 15,
+ KR = 16,
+ TW = 17,
+ MEX = 18
+ };
+}
diff --git a/Enums/Keyboard/CorsairPhysicalKeyboardLayout.cs b/Enums/Keyboard/CorsairPhysicalKeyboardLayout.cs
new file mode 100644
index 0000000..5dc71d1
--- /dev/null
+++ b/Enums/Keyboard/CorsairPhysicalKeyboardLayout.cs
@@ -0,0 +1,36 @@
+// ReSharper disable UnusedMember.Global
+// ReSharper disable InconsistentNaming
+
+namespace CUE.NET.Enums.Keyboard
+{
+ ///
+ /// Contains list of available physical layouts for keyboards.
+ ///
+ public enum CorsairPhysicalKeyboardLayout
+ {
+ ///
+ /// US-Keyboard
+ ///
+ US = 1,
+
+ ///
+ /// UK-Keyboard
+ ///
+ UK = 2,
+
+ ///
+ /// BR-Keyboard
+ ///
+ BR = 3,
+
+ ///
+ /// JP-Keyboard
+ ///
+ JP = 4,
+
+ ///
+ /// KR-Keyboard
+ ///
+ KR = 5
+ }
+}
diff --git a/Enums/Mouse/CorsairMouseLedId.cs b/Enums/Mouse/CorsairMouseLedId.cs
new file mode 100644
index 0000000..b33ff61
--- /dev/null
+++ b/Enums/Mouse/CorsairMouseLedId.cs
@@ -0,0 +1,13 @@
+// ReSharper disable UnusedMember.Global
+// ReSharper disable InconsistentNaming
+
+namespace CUE.NET.Enums.Mouse
+{
+ public enum CorsairMouseLedId
+ {
+ B1 = 148,
+ B2 = 149,
+ B3 = 150,
+ B4 = 151
+ }
+}
diff --git a/Enums/Mouse/CorsairPhysicalMouseLayout.cs b/Enums/Mouse/CorsairPhysicalMouseLayout.cs
new file mode 100644
index 0000000..0198e00
--- /dev/null
+++ b/Enums/Mouse/CorsairPhysicalMouseLayout.cs
@@ -0,0 +1,31 @@
+// ReSharper disable UnusedMember.Global
+// ReSharper disable InconsistentNaming
+
+namespace CUE.NET.Enums.Mouse
+{
+ ///
+ /// Contains list of available physical layouts for mice.
+ ///
+ public enum CorsairPhysicalMouseLayout
+ {
+ ///
+ /// Zone1-Mouse
+ ///
+ Zones1 = 6,
+
+ ///
+ /// Zone2-Mouse
+ ///
+ Zones2 = 7,
+
+ ///
+ /// Zone3-Mouse
+ ///
+ Zones3 = 8,
+
+ ///
+ /// Zone4-Mouse
+ ///
+ Zones4 = 9
+ }
+}
diff --git a/Examples/SimpleDevTest/Program.cs b/Examples/SimpleDevTest/Program.cs
index a03bb5b..e1f4390 100644
--- a/Examples/SimpleDevTest/Program.cs
+++ b/Examples/SimpleDevTest/Program.cs
@@ -3,6 +3,7 @@ using System.Drawing;
using CUE.NET.Enums;
using CUE.NET.Exceptions;
using CUE.NET.Wrapper;
+using CUE.NET.Wrapper.Keyboard;
namespace SimpleDevTest
{
@@ -14,7 +15,7 @@ namespace SimpleDevTest
{
CueSDK.Initialize();
- CueKeyboard keyboard = CueSDK.KeyboardSDK;
+ CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
if (keyboard == null)
throw new WrapperException("No keyboard found");
diff --git a/Native/_CorsairDeviceInfo.cs b/Native/_CorsairDeviceInfo.cs
index 310bfb0..bbe3827 100644
--- a/Native/_CorsairDeviceInfo.cs
+++ b/Native/_CorsairDeviceInfo.cs
@@ -14,8 +14,8 @@ namespace CUE.NET.Native
{
internal CorsairDeviceType type; // enum describing device type
internal IntPtr model; // null - terminated device model(like “K95RGB”)
- internal CorsairPhysicalLayout physicalLayout; // enum describing physical layout of the keyboard or mouse
- internal CorsairLogicalLayout logicalLayout; // enum describing logical layout of the keyboard as set in CUE settings
+ internal int physicalLayout; // enum describing physical layout of the keyboard or mouse
+ internal int logicalLayout; // enum describing logical layout of the keyboard as set in CUE settings
internal int capsMask; // mask that describes device capabilities, formed as logical “or” of CorsairDeviceCaps enum values
}
}
diff --git a/Native/_CorsairLedColor.cs b/Native/_CorsairLedColor.cs
index 4539ac3..8761f63 100644
--- a/Native/_CorsairLedColor.cs
+++ b/Native/_CorsairLedColor.cs
@@ -3,18 +3,17 @@
#pragma warning disable 649 // Field 'x' is never assigned
using System.Runtime.InteropServices;
-using CUE.NET.Enums;
namespace CUE.NET.Native
{
// ReSharper disable once InconsistentNaming
[StructLayout(LayoutKind.Sequential)]
- public class _CorsairLedColor // contains information about led and its color
+ public class _CorsairLedColor // contains information about led and its color
{
- internal CorsairLedId ledId; // identifier of LED to set
- internal int r; // red brightness[0..255]
- internal int g; // green brightness[0..255]
- internal int b; // blue brightness[0..255]
+ internal int ledId; // identifier of LED to set
+ internal int r; // red brightness[0..255]
+ internal int g; // green brightness[0..255]
+ internal int b; // blue brightness[0..255]
};
}
diff --git a/Native/_CorsairLedPosition.cs b/Native/_CorsairLedPosition.cs
index c57521e..642d105 100644
--- a/Native/_CorsairLedPosition.cs
+++ b/Native/_CorsairLedPosition.cs
@@ -3,7 +3,6 @@
#pragma warning disable 649 // Field 'x' is never assigned
using System.Runtime.InteropServices;
-using CUE.NET.Enums;
namespace CUE.NET.Native
{
@@ -11,10 +10,10 @@ namespace CUE.NET.Native
[StructLayout(LayoutKind.Sequential)]
public class _CorsairLedPosition // contains led id and position of led rectangle.Most of the keys are rectangular. In case if key is not rectangular(like Enter in ISO / UK layout) it returns the smallest rectangle that fully contains the key
{
- internal CorsairLedId ledId; // identifier of led
+ internal int ledId; // identifier of led
internal double top;
internal double left;
internal double height;
- internal double width; // values in mm
+ internal double width; // values in mm
}
}
diff --git a/Wrapper/AbstractCueDevice.cs b/Wrapper/AbstractCueDevice.cs
index 1f349c5..495059b 100644
--- a/Wrapper/AbstractCueDevice.cs
+++ b/Wrapper/AbstractCueDevice.cs
@@ -8,13 +8,13 @@ namespace CUE.NET.Wrapper
{
#region Properties & Fields
- public CorsairDeviceInfo DeviceInfo { get; }
+ public IDeviceInfo DeviceInfo { get; }
#endregion
#region Constructors
- protected AbstractCueDevice(CorsairDeviceInfo info)
+ protected AbstractCueDevice(IDeviceInfo info)
{
this.DeviceInfo = info;
}
diff --git a/Wrapper/CorsairDeviceInfo.cs b/Wrapper/CorsairDeviceInfo.cs
deleted file mode 100644
index f6c68e0..0000000
--- a/Wrapper/CorsairDeviceInfo.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-// ReSharper disable MemberCanBePrivate.Global
-// ReSharper disable UnusedAutoPropertyAccessor.Global
-
-using System;
-using System.Runtime.InteropServices;
-using CUE.NET.Enums;
-using CUE.NET.Native;
-
-namespace CUE.NET.Wrapper
-{
- public class CorsairDeviceInfo
- {
- #region Properties & Fields
-
- ///
- /// Device type.
- ///
- public CorsairDeviceType Type { get; private set; }
-
- //TODO DarthAffe 17.09.2015: This could be an Enum
- ///
- /// Device model (like “K95RGB”).
- ///
- public string Model { get; private set; }
-
- ///
- /// Physical layout of the keyboard or mouse.
- ///
- public CorsairPhysicalLayout PhysicalLayout { get; private set; }
-
- //TODO DarthAffe 17.09.2015: Would device-specific infos be useful?
- ///
- /// Logical layout of the keyboard as set in CUE settings.
- ///
- public CorsairLogicalLayout LogicalLayout { get; private set; }
-
- ///
- /// Mask that describes device capabilities, formed as logical "or" of CorsairDeviceCaps enum values
- ///
- public CorsairDeviceCaps CapsMask { get; private set; }
-
- #endregion
-
- #region Constructors
-
- ///
- /// Internal constructor of managed CorsairDeviceInfo.
- ///
- /// The native CorsairDeviceInfo-struct
- public CorsairDeviceInfo(_CorsairDeviceInfo nativeInfo)
- {
- this.Type = nativeInfo.type;
- this.Model = nativeInfo.model == IntPtr.Zero ? null : Marshal.PtrToStringAuto(nativeInfo.model);
- this.PhysicalLayout = nativeInfo.physicalLayout;
- this.LogicalLayout = nativeInfo.logicalLayout;
- this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
- }
-
- #endregion
- }
-}
diff --git a/Wrapper/CueMouse.cs b/Wrapper/CueMouse.cs
deleted file mode 100644
index c8748e5..0000000
--- a/Wrapper/CueMouse.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace CUE.NET.Wrapper
-{
- //TODO DarthAffe 18.09.2015: Implement
- public class CueMouse : AbstractCueDevice
- {
- #region Properties & Fields
-
- #endregion
-
- #region Constructors
-
- internal CueMouse(CorsairDeviceInfo info)
- : base(info)
- { }
-
- #endregion
-
- #region Methods
-
- #endregion
- }
-}
diff --git a/Wrapper/CueSDK.cs b/Wrapper/CueSDK.cs
index 4315e9b..58007b6 100644
--- a/Wrapper/CueSDK.cs
+++ b/Wrapper/CueSDK.cs
@@ -4,6 +4,9 @@ using System.Runtime.InteropServices;
using CUE.NET.Enums;
using CUE.NET.Exceptions;
using CUE.NET.Native;
+using CUE.NET.Wrapper.Headset;
+using CUE.NET.Wrapper.Keyboard;
+using CUE.NET.Wrapper.Mouse;
namespace CUE.NET.Wrapper
{
@@ -17,9 +20,9 @@ namespace CUE.NET.Wrapper
public static bool HasExclusiveAccess { get; private set; }
public static CorsairError LastError => _CUESDK.CorsairGetLastError();
- public static CueKeyboard KeyboardSDK { get; private set; }
- public static CueMouse MouseSDK { get; private set; }
- public static CueHeadset HeadsetSDK { get; private set; }
+ public static CorsairKeyboard KeyboardSDK { get; private set; }
+ public static CorsairMouse MouseSDK { get; private set; }
+ public static CorsairHeadset HeadsetSDK { get; private set; }
// ReSharper restore UnusedAutoPropertyAccessor.Global
@@ -35,7 +38,7 @@ namespace CUE.NET.Wrapper
ProtocolDetails = new CorsairProtocolDetails(_CUESDK.CorsairPerformProtocolHandshake());
CorsairError error = LastError;
- if (error != CorsairError.CE_Success)
+ if (error != CorsairError.Success)
Throw(error);
if (ProtocolDetails.BreakingChanges)
@@ -45,7 +48,7 @@ namespace CUE.NET.Wrapper
if (exclusiveAccess)
{
- if (!_CUESDK.CorsairRequestControl(CorsairAccessMode.CAM_ExclusiveLightingControl))
+ if (!_CUESDK.CorsairRequestControl(CorsairAccessMode.ExclusiveLightingControl))
Throw(error);
HasExclusiveAccess = true;
@@ -54,30 +57,31 @@ namespace CUE.NET.Wrapper
int deviceCount = _CUESDK.CorsairGetDeviceCount();
for (int i = 0; i < deviceCount; i++)
{
- CorsairDeviceInfo info = new CorsairDeviceInfo((_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo)));
- if (!info.CapsMask.HasFlag(CorsairDeviceCaps.CDC_Lighting))
+ _CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
+ GenericDeviceInfo info = new GenericDeviceInfo(nativeDeviceInfo);
+ if (!info.CapsMask.HasFlag(CorsairDeviceCaps.Lighting))
continue; // Everything that doesn't support lighting control is useless
switch (info.Type)
{
- case CorsairDeviceType.CDT_Keyboard:
- KeyboardSDK = new CueKeyboard(info);
+ case CorsairDeviceType.Keyboard:
+ KeyboardSDK = new CorsairKeyboard(new CorsairKeyboardDeviceInfo(nativeDeviceInfo));
break;
- case CorsairDeviceType.CDT_Mouse:
- MouseSDK = new CueMouse(info);
+ case CorsairDeviceType.Mouse:
+ MouseSDK = new CorsairMouse(new CorsairMouseDeviceInfo(nativeDeviceInfo));
break;
- case CorsairDeviceType.CDT_Headset:
- HeadsetSDK = new CueHeadset(info);
+ case CorsairDeviceType.Headset:
+ HeadsetSDK = new CorsairHeadset(new CorsairHeadsetDeviceInfo(nativeDeviceInfo));
break;
// ReSharper disable once RedundantCaseLabel
- case CorsairDeviceType.CDT_Unknown:
+ case CorsairDeviceType.Unknown:
default:
throw new WrapperException("Unknown Device-Type");
}
error = LastError;
- if (error != CorsairError.CE_Success)
+ if (error != CorsairError.Success)
Throw(error);
}
}
diff --git a/Wrapper/GenericDeviceInfo.cs b/Wrapper/GenericDeviceInfo.cs
new file mode 100644
index 0000000..5f0ad6f
--- /dev/null
+++ b/Wrapper/GenericDeviceInfo.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Runtime.InteropServices;
+using CUE.NET.Enums;
+using CUE.NET.Native;
+
+namespace CUE.NET.Wrapper
+{
+ public class GenericDeviceInfo : IDeviceInfo
+ {
+ #region Properties & Fields
+
+ ///
+ /// Device type.
+ ///
+ public CorsairDeviceType Type { get; }
+
+ //TODO DarthAffe 17.09.2015: This could be an Enum
+ ///
+ /// Device model (like “K95RGB”).
+ ///
+ public string Model { get; }
+
+ ///
+ /// Flags that describes device capabilities
+ ///
+ public CorsairDeviceCaps CapsMask { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Internal constructor of managed CorsairDeviceInfo.
+ ///
+ /// The native CorsairDeviceInfo-struct
+ internal GenericDeviceInfo(_CorsairDeviceInfo nativeInfo)
+ {
+ this.Type = nativeInfo.type;
+ this.Model = nativeInfo.model == IntPtr.Zero ? null : Marshal.PtrToStringAuto(nativeInfo.model);
+ this.CapsMask = (CorsairDeviceCaps)nativeInfo.capsMask;
+ }
+
+ #endregion
+ }
+}
diff --git a/Wrapper/CueHeadset.cs b/Wrapper/Headset/CorsairHeadset.cs
similarity index 62%
rename from Wrapper/CueHeadset.cs
rename to Wrapper/Headset/CorsairHeadset.cs
index 9cb823f..a9c4915 100644
--- a/Wrapper/CueHeadset.cs
+++ b/Wrapper/Headset/CorsairHeadset.cs
@@ -1,7 +1,7 @@
-namespace CUE.NET.Wrapper
+namespace CUE.NET.Wrapper.Headset
{
//TODO DarthAffe 18.09.2015: Implement
- public class CueHeadset : AbstractCueDevice
+ public class CorsairHeadset : AbstractCueDevice
{
#region Properties & Fields
@@ -9,7 +9,7 @@
#region Constructors
- internal CueHeadset(CorsairDeviceInfo info)
+ internal CorsairHeadset(CorsairHeadsetDeviceInfo info)
: base(info)
{ }
diff --git a/Wrapper/Headset/CorsairHeadsetDeviceInfo.cs b/Wrapper/Headset/CorsairHeadsetDeviceInfo.cs
new file mode 100644
index 0000000..2b8af06
--- /dev/null
+++ b/Wrapper/Headset/CorsairHeadsetDeviceInfo.cs
@@ -0,0 +1,11 @@
+using CUE.NET.Native;
+
+namespace CUE.NET.Wrapper.Headset
+{
+ public class CorsairHeadsetDeviceInfo : GenericDeviceInfo
+ {
+ public CorsairHeadsetDeviceInfo(_CorsairDeviceInfo nativeInfo)
+ : base(nativeInfo)
+ { }
+ }
+}
diff --git a/Wrapper/ICueDevice.cs b/Wrapper/ICueDevice.cs
index dc36911..a6064b9 100644
--- a/Wrapper/ICueDevice.cs
+++ b/Wrapper/ICueDevice.cs
@@ -2,6 +2,6 @@
{
public interface ICueDevice
{
- CorsairDeviceInfo DeviceInfo { get; }
+ IDeviceInfo DeviceInfo { get; }
}
}
diff --git a/Wrapper/IDeviceInfo.cs b/Wrapper/IDeviceInfo.cs
new file mode 100644
index 0000000..d55fab8
--- /dev/null
+++ b/Wrapper/IDeviceInfo.cs
@@ -0,0 +1,20 @@
+using CUE.NET.Enums;
+
+namespace CUE.NET.Wrapper
+{
+ public interface IDeviceInfo
+ {
+ CorsairDeviceType Type { get; }
+
+ //TODO DarthAffe 17.09.2015: This could be an Enum
+ ///
+ /// Device model (like “K95RGB”).
+ ///
+ string Model { get; }
+
+ ///
+ /// Flags that describes device capabilities
+ ///
+ CorsairDeviceCaps CapsMask { get; }
+ }
+}
diff --git a/Wrapper/CueKeyboard.cs b/Wrapper/Keyboard/CorsairKeyboard.cs
similarity index 67%
rename from Wrapper/CueKeyboard.cs
rename to Wrapper/Keyboard/CorsairKeyboard.cs
index 8b73f64..b927970 100644
--- a/Wrapper/CueKeyboard.cs
+++ b/Wrapper/Keyboard/CorsairKeyboard.cs
@@ -1,20 +1,23 @@
using System.Drawing;
-using CUE.NET.Enums;
using CUE.NET.Native;
-namespace CUE.NET.Wrapper
+namespace CUE.NET.Wrapper.Keyboard
{
- public class CueKeyboard : AbstractCueDevice
+ public class CorsairKeyboard : AbstractCueDevice
{
#region Properties & Fields
+ public CorsairKeyboardDeviceInfo KeyboardDeviceInfo { get; }
+
#endregion
#region Constructors
- internal CueKeyboard(CorsairDeviceInfo info)
+ internal CorsairKeyboard(CorsairKeyboardDeviceInfo info)
: base(info)
- { }
+ {
+ this.KeyboardDeviceInfo = info;
+ }
#endregion
@@ -22,7 +25,7 @@ namespace CUE.NET.Wrapper
public void SetKeyColor(char key, Color color)
{
- CorsairLedId id = _CUESDK.CorsairGetLedIdForKeyName(key);
+ int id = _CUESDK.CorsairGetLedIdForKeyName(key);
_CorsairLedColor ledColor = new _CorsairLedColor { ledId = id, r = color.R, g = color.G, b = color.B };
SetKeyColors(ledColor);
}
@@ -32,7 +35,7 @@ namespace CUE.NET.Wrapper
_CorsairLedColor[] ledColors = new _CorsairLedColor[keys.Length];
for (int i = 0; i < keys.Length; i++)
{
- CorsairLedId id = _CUESDK.CorsairGetLedIdForKeyName(keys[i]);
+ int id = _CUESDK.CorsairGetLedIdForKeyName(keys[i]);
ledColors[i] = new _CorsairLedColor { ledId = id, r = color.R, g = color.G, b = color.B };
}
SetKeyColors(ledColors);
diff --git a/Wrapper/Keyboard/CorsairKeyboardDeviceInfo.cs b/Wrapper/Keyboard/CorsairKeyboardDeviceInfo.cs
new file mode 100644
index 0000000..0855745
--- /dev/null
+++ b/Wrapper/Keyboard/CorsairKeyboardDeviceInfo.cs
@@ -0,0 +1,40 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+
+using CUE.NET.Enums.Keyboard;
+using CUE.NET.Native;
+
+namespace CUE.NET.Wrapper.Keyboard
+{
+ public class CorsairKeyboardDeviceInfo : GenericDeviceInfo
+ {
+ #region Properties & Fields
+
+ ///
+ /// Physical layout of the keyboard.
+ ///
+ public CorsairPhysicalKeyboardLayout PhysicalLayout { get; private set; }
+
+ ///
+ /// Logical layout of the keyboard as set in CUE settings.
+ ///
+ public CorsairLogicalKeyboardLayout LogicalLayout { get; private set; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Internal constructor of managed CorsairDeviceInfo.
+ ///
+ /// The native CorsairDeviceInfo-struct
+ internal CorsairKeyboardDeviceInfo(_CorsairDeviceInfo nativeInfo)
+ : base(nativeInfo)
+ {
+ this.PhysicalLayout = (CorsairPhysicalKeyboardLayout)nativeInfo.physicalLayout;
+ this.LogicalLayout = (CorsairLogicalKeyboardLayout)nativeInfo.logicalLayout;
+ }
+
+ #endregion
+ }
+}
diff --git a/Wrapper/Mouse/CorsairMouse.cs b/Wrapper/Mouse/CorsairMouse.cs
new file mode 100644
index 0000000..fc33056
--- /dev/null
+++ b/Wrapper/Mouse/CorsairMouse.cs
@@ -0,0 +1,26 @@
+namespace CUE.NET.Wrapper.Mouse
+{
+ //TODO DarthAffe 18.09.2015: Implement
+ public class CorsairMouse : AbstractCueDevice
+ {
+ #region Properties & Fields
+
+ public CorsairMouseDeviceInfo MouseDeviceInfo { get; }
+
+ #endregion
+
+ #region Constructors
+
+ internal CorsairMouse(CorsairMouseDeviceInfo info)
+ : base(info)
+ {
+ this.MouseDeviceInfo = info;
+ }
+
+ #endregion
+
+ #region Methods
+
+ #endregion
+ }
+}
diff --git a/Wrapper/Mouse/CorsairMouseDeviceInfo.cs b/Wrapper/Mouse/CorsairMouseDeviceInfo.cs
new file mode 100644
index 0000000..8095acd
--- /dev/null
+++ b/Wrapper/Mouse/CorsairMouseDeviceInfo.cs
@@ -0,0 +1,34 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+
+using CUE.NET.Enums.Mouse;
+using CUE.NET.Native;
+
+namespace CUE.NET.Wrapper.Mouse
+{
+ public class CorsairMouseDeviceInfo : GenericDeviceInfo
+ {
+ #region Properties & Fields
+
+ ///
+ /// Physical layout of the mouse.
+ ///
+ public CorsairPhysicalMouseLayout PhysicalLayout { get; private set; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Internal constructor of managed CorsairDeviceInfo.
+ ///
+ /// The native CorsairDeviceInfo-struct
+ internal CorsairMouseDeviceInfo(_CorsairDeviceInfo nativeInfo)
+ : base(nativeInfo)
+ {
+ this.PhysicalLayout = (CorsairPhysicalMouseLayout)nativeInfo.physicalLayout;
+ }
+
+ #endregion
+ }
+}