diff --git a/CUE.NET.csproj b/CUE.NET.csproj
index 0d2a862..d0d8a00 100644
--- a/CUE.NET.csproj
+++ b/CUE.NET.csproj
@@ -63,6 +63,9 @@
+
+
+
diff --git a/CUE.NET.sln b/CUE.NET.sln
index 8183f2b..d99caab 100644
--- a/CUE.NET.sln
+++ b/CUE.NET.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
+VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUE.NET", "CUE.NET.csproj", "{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}"
EndProject
@@ -20,12 +20,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{D69EF6D8-6
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x86", "x86", "{0525D895-E706-4920-8733-DABD9194BFB1}"
ProjectSection(SolutionItems) = preProject
- libs\x86\CUESDK_2013.dll = libs\x86\CUESDK_2013.dll
+ bin\x86\CUESDK_2015.dll = bin\x86\CUESDK_2015.dll
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x64", "x64", "{2F99124B-FAED-432D-B797-45566D373411}"
ProjectSection(SolutionItems) = preProject
- libs\x64\CUESDK_2013.dll = libs\x64\CUESDK_2013.dll
+ bin\x64\CUESDK_2015.dll = bin\x64\CUESDK_2015.dll
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AudioAnalyzer", "AudioAnalyzer", "{BE16A0BF-6794-4718-AF27-F2A50078D880}"
diff --git a/CueSDK.cs b/CueSDK.cs
index 5a233ad..0369cfd 100644
--- a/CueSDK.cs
+++ b/CueSDK.cs
@@ -7,6 +7,7 @@ using CUE.NET.Devices.Generic.Enums;
using CUE.NET.Devices.Headset;
using CUE.NET.Devices.Keyboard;
using CUE.NET.Devices.Mouse;
+using CUE.NET.Devices.Mousemat;
using CUE.NET.Exceptions;
using CUE.NET.Native;
@@ -61,6 +62,12 @@ namespace CUE.NET
///
public static CorsairHeadset HeadsetSDK { get; private set; }
+ ///
+ /// Gets the managed representation of a moustmat managed by the CUE-SDK.
+ /// Note that currently only one connected mousemat is supported.
+ ///
+ public static CorsairMousemat MousematSDK { get; private set; }
+
// ReSharper restore UnusedAutoPropertyAccessor.Global
#endregion
@@ -86,6 +93,8 @@ namespace CUE.NET
return MouseSDK != null;
case CorsairDeviceType.Headset:
return HeadsetSDK != null;
+ case CorsairDeviceType.Mousemat:
+ return MousematSDK != null;
default:
return true;
}
@@ -163,7 +172,9 @@ namespace CUE.NET
case CorsairDeviceType.Headset:
HeadsetSDK = new CorsairHeadset(new CorsairHeadsetDeviceInfo(nativeDeviceInfo));
break;
-
+ case CorsairDeviceType.Mousemat:
+ MousematSDK = new CorsairMousemat(new CorsairMousematDeviceInfo(nativeDeviceInfo));
+ break;
// ReSharper disable once RedundantCaseLabel
case CorsairDeviceType.Unknown:
default:
@@ -198,6 +209,7 @@ namespace CUE.NET
KeyboardSDK?.ResetLeds();
MouseSDK?.ResetLeds();
HeadsetSDK?.ResetLeds();
+ MousematSDK?.ResetLeds();
_CUESDK.Reload();
@@ -244,6 +256,10 @@ namespace CUE.NET
if (!reloadedDevices.ContainsKey(CorsairDeviceType.Headset)
|| HeadsetSDK.HeadsetDeviceInfo.Model != reloadedDevices[CorsairDeviceType.Headset].Model)
throw new WrapperException("The previously loaded Headset got disconnected.");
+ if (MousematSDK != null)
+ if (!reloadedDevices.ContainsKey(CorsairDeviceType.Mousemat)
+ || MousematSDK.MousematDeviceInfo.Model != reloadedDevices[CorsairDeviceType.Mousemat].Model)
+ throw new WrapperException("The previously loaded Mousemat got disconnected.");
IsInitialized = true;
}
@@ -255,6 +271,7 @@ namespace CUE.NET
KeyboardSDK = null;
MouseSDK = null;
HeadsetSDK = null;
+ MousematSDK = null;
IsInitialized = false;
throw new CUEException(error);
diff --git a/Devices/Generic/Enums/CorsairDeviceType.cs b/Devices/Generic/Enums/CorsairDeviceType.cs
index 4deeeba..0e31b63 100644
--- a/Devices/Generic/Enums/CorsairDeviceType.cs
+++ b/Devices/Generic/Enums/CorsairDeviceType.cs
@@ -11,6 +11,7 @@ namespace CUE.NET.Devices.Generic.Enums
Unknown = 0,
Mouse = 1,
Keyboard = 2,
- Headset = 3
+ Headset = 3,
+ Mousemat = 4
};
}
diff --git a/Devices/Generic/Enums/CorsairLedId.cs b/Devices/Generic/Enums/CorsairLedId.cs
new file mode 100644
index 0000000..a19b648
--- /dev/null
+++ b/Devices/Generic/Enums/CorsairLedId.cs
@@ -0,0 +1,183 @@
+namespace CUE.NET.Devices.Generic.Enums
+{
+ ///
+ /// Contains list of all LEDs available for all corsair devices.
+ ///
+ public enum CorsairLedId
+ {
+ Invalid = 0,
+ 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,
+
+ B1 = 148,
+ B2 = 149,
+ B3 = 150,
+ B4 = 151,
+
+ LeftLogo = 152,
+ RightLogo = 153,
+
+ Logo = 154,
+
+ Zone1 = 155,
+ Zone2 = 156,
+ Zone3 = 157,
+ Zone4 = 158,
+ Zone5 = 159,
+ Zone6 = 160,
+ Zone7 = 161,
+ Zone8 = 162,
+ Zone9 = 163,
+ Zone10 = 164,
+ Zone11 = 165,
+ Zone12 = 166,
+ Zone13 = 167,
+ Zone14 = 168,
+ Zone15 = 169
+ }
+}
diff --git a/Devices/Generic/PositionedCorsairLed.cs b/Devices/Generic/PositionedCorsairLed.cs
new file mode 100644
index 0000000..a3e1077
--- /dev/null
+++ b/Devices/Generic/PositionedCorsairLed.cs
@@ -0,0 +1,29 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
+
+using System.Drawing;
+
+namespace CUE.NET.Devices.Generic
+{
+ public class PositionedCorsairLed : CorsairLed
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets a rectangle representing the physical location of the led.
+ ///
+ public RectangleF LedRectangle { get; }
+
+ #endregion
+
+ #region Constructors
+
+ internal PositionedCorsairLed(RectangleF ledRectangle)
+ {
+ this.LedRectangle = ledRectangle;
+ }
+
+ #endregion
+ }
+}
diff --git a/Devices/Headset/CorsairHeadset.cs b/Devices/Headset/CorsairHeadset.cs
index 4f4793a..9a66aea 100644
--- a/Devices/Headset/CorsairHeadset.cs
+++ b/Devices/Headset/CorsairHeadset.cs
@@ -81,7 +81,7 @@ namespace CUE.NET.Devices.Headset
///
/// Returns an enumerator that iterates over all LEDs of the headset.
///
- /// An enumerator for all LDS of the headset.
+ /// An enumerator for all LEDS of the headset.
public IEnumerator GetEnumerator()
{
return Leds.GetEnumerator();
diff --git a/Devices/Headset/CorsairHeadsetDeviceInfo.cs b/Devices/Headset/CorsairHeadsetDeviceInfo.cs
index 344bfb2..42b3fd3 100644
--- a/Devices/Headset/CorsairHeadsetDeviceInfo.cs
+++ b/Devices/Headset/CorsairHeadsetDeviceInfo.cs
@@ -8,6 +8,8 @@ namespace CUE.NET.Devices.Headset
///
public class CorsairHeadsetDeviceInfo : GenericDeviceInfo
{
+ #region Constructors
+
///
/// Internal constructor of managed .
///
@@ -15,5 +17,7 @@ namespace CUE.NET.Devices.Headset
internal CorsairHeadsetDeviceInfo(_CorsairDeviceInfo nativeInfo)
: base(nativeInfo)
{ }
+
+ #endregion
}
}
diff --git a/Devices/Mousemat/CorsairMousemat.cs b/Devices/Mousemat/CorsairMousemat.cs
new file mode 100644
index 0000000..1536dea
--- /dev/null
+++ b/Devices/Mousemat/CorsairMousemat.cs
@@ -0,0 +1,137 @@
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedMember.Global
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Drawing;
+using System.Linq;
+using System.Runtime.InteropServices;
+using CUE.NET.Devices.Generic;
+using CUE.NET.Devices.Generic.Enums;
+using CUE.NET.Devices.Mousemat.Enums;
+using CUE.NET.Effects;
+using CUE.NET.Exceptions;
+using CUE.NET.Native;
+
+namespace CUE.NET.Devices.Mousemat
+{
+ ///
+ /// Represents the SDK for a corsair mousemat.
+ ///
+ public class CorsairMousemat : AbstractCueDevice, IEnumerable
+ {
+ #region Properties & Fields
+
+ #region Indexer
+
+ ///
+ /// Gets the with the specified ID.
+ ///
+ /// The ID of the LED to get.
+ /// The LED with the specified ID.
+ public CorsairLed this[CorsairMousematLedId ledId]
+ {
+ get
+ {
+ CorsairLed led;
+ return base.Leds.TryGetValue((int)ledId, out led) ? led : null;
+ }
+ }
+
+ #endregion
+
+ ///
+ /// Gets specific information provided by CUE for the mousemat.
+ ///
+ public CorsairMousematDeviceInfo MousematDeviceInfo { get; }
+
+ ///
+ /// Gets a read-only collection containing all LEDs of the mousemat.
+ ///
+ public new IEnumerable Leds => new ReadOnlyCollection(base.Leds.Values.ToList());
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The specific information provided by CUE for the mousemat
+ internal CorsairMousemat(CorsairMousematDeviceInfo info)
+ : base(info)
+ {
+ this.MousematDeviceInfo = info;
+ InitializeLeds();
+ }
+
+ #endregion
+
+ #region Methods
+
+ private void InitializeLeds()
+ {
+ int deviceCount = _CUESDK.CorsairGetDeviceCount();
+
+ // Get mousemat device index
+ int mousematIndex = -1;
+ for (int i = 0; i < deviceCount; i++)
+ {
+ _CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
+ GenericDeviceInfo info = new GenericDeviceInfo(nativeDeviceInfo);
+ if (info.Type != CorsairDeviceType.Mousemat)
+ continue;
+
+ mousematIndex = i;
+ break;
+ }
+ if (mousematIndex < 0)
+ throw new WrapperException("Can't determine mousemat device index");
+
+ _CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(mousematIndex), typeof(_CorsairLedPositions));
+ int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
+ IntPtr ptr = nativeLedPositions.pLedPosition;
+
+ // Put the positions in an array for sorting later on
+ List<_CorsairLedPosition> positions = new List<_CorsairLedPosition>();
+ for (int i = 0; i < nativeLedPositions.numberOfLed; i++)
+ {
+ _CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition));
+ ptr = new IntPtr(ptr.ToInt64() + structSize);
+ positions.Add(ledPosition);
+ }
+
+ // Sort for easy iteration by clients
+ foreach (_CorsairLedPosition position in positions.OrderBy(p => p.ledId))
+ GetLed((int)position.ledId);
+ }
+
+ protected override void DeviceUpdate()
+ {
+ //TODO DarthAffe 10.09.2016: Implement
+ }
+
+ #region IEnumerable
+
+ ///
+ /// Returns an enumerator that iterates over all LEDs of the mousemat.
+ ///
+ /// An enumerator for all LEDS of the mousemat.
+ public IEnumerator GetEnumerator()
+ {
+ return Leds.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Devices/Mousemat/CorsairMousematDeviceInfo.cs b/Devices/Mousemat/CorsairMousematDeviceInfo.cs
new file mode 100644
index 0000000..669c063
--- /dev/null
+++ b/Devices/Mousemat/CorsairMousematDeviceInfo.cs
@@ -0,0 +1,26 @@
+// ReSharper disable MemberCanBePrivate.Global
+// ReSharper disable UnusedAutoPropertyAccessor.Global
+
+using CUE.NET.Devices.Generic;
+using CUE.NET.Native;
+
+namespace CUE.NET.Devices.Mousemat
+{
+ ///
+ /// Represents specific information for a CUE Mousemat.
+ ///
+ public class CorsairMousematDeviceInfo : GenericDeviceInfo
+ {
+ #region Constructors
+
+ ///
+ /// Internal constructor of managed .
+ ///
+ /// The native -struct
+ internal CorsairMousematDeviceInfo(_CorsairDeviceInfo nativeInfo)
+ : base(nativeInfo)
+ { }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Devices/Mousemat/Enums/CorsairMousematLedId.cs b/Devices/Mousemat/Enums/CorsairMousematLedId.cs
new file mode 100644
index 0000000..d3a6d5f
--- /dev/null
+++ b/Devices/Mousemat/Enums/CorsairMousematLedId.cs
@@ -0,0 +1,25 @@
+namespace CUE.NET.Devices.Mousemat.Enums
+{
+ ///
+ /// Contains list of all LEDs available for corsair mousemats.
+ ///
+ public enum CorsairMousematLedId
+ {
+ Invalid = 0,
+ Zone1 = 155,
+ Zone2 = 156,
+ Zone3 = 157,
+ Zone4 = 158,
+ Zone5 = 159,
+ Zone6 = 160,
+ Zone7 = 161,
+ Zone8 = 162,
+ Zone9 = 163,
+ Zone10 = 164,
+ Zone11 = 165,
+ Zone12 = 166,
+ Zone13 = 167,
+ Zone14 = 168,
+ Zone15 = 169
+ }
+}
\ No newline at end of file
diff --git a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/Example_AudioAnalyzer_full.csproj b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/Example_AudioAnalyzer_full.csproj
index 8bdfa2e..4410765 100644
--- a/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/Example_AudioAnalyzer_full.csproj
+++ b/Examples/AudioAnalyzer/Example_AudioAnalyzer_full/Example_AudioAnalyzer_full.csproj
@@ -95,7 +95,7 @@
- xcopy "$(SolutionDir)libs\x86\CUESDK_2013.dll" "$(TargetDir)x86\" /y
+ xcopy "$(SolutionDir)libs\x86\CUESDK_2015.dll" "$(TargetDir)x86\" /y