From 6de1087c1f88780dafab0f7fc9fc4e05c5f1bf54 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sat, 17 Oct 2015 16:57:50 +0200 Subject: [PATCH] Added tons of xml-comments. --- CueSDK.cs | 34 ++++++++++++ Devices/Generic/AbstractCueDevice.cs | 1 + Devices/Generic/GenericDeviceInfo.cs | 7 ++- Devices/Generic/OnExceptionEventArgs.cs | 5 +- Devices/Headset/CorsairHeadset.cs | 31 ++++++++++- Devices/Headset/CorsairHeadsetDeviceInfo.cs | 6 ++- Devices/Headset/Enums/CorsairHeadsetLedId.cs | 3 ++ Devices/ICueDevice.cs | 24 +++++++++ Devices/IDeviceInfo.cs | 8 +-- Devices/Mouse/CorsairMouse.cs | 26 +++++++++ Devices/Mouse/CorsairMouseDeviceInfo.cs | 6 +-- Devices/Mouse/Enums/CorsairMouseButtonId.cs | 3 ++ Exceptions/CUEException.cs | 10 ++++ Exceptions/WrapperException.cs | 8 +++ Helper/ColorHelper.cs | 56 ++++++++++++++++++++ Helper/GradientHelper.cs | 24 ++++++++- Helper/RectangleHelper.cs | 41 ++++++++++++-- Native/_CUESDK.cs | 36 ++++++++++--- Native/_CorsairDeviceInfo.cs | 34 +++++++++--- Native/_CorsairLedColor.cs | 29 +++++++--- Native/_CorsairLedPosition.cs | 29 ++++++++-- Native/_CorsairLedPositions.cs | 16 ++++-- Native/_CorsairProtocolDetails.cs | 36 ++++++++++--- 23 files changed, 422 insertions(+), 51 deletions(-) diff --git a/CueSDK.cs b/CueSDK.cs index c3c2679..c6c48b7 100644 --- a/CueSDK.cs +++ b/CueSDK.cs @@ -17,13 +17,42 @@ namespace CUE.NET // ReSharper disable UnusedAutoPropertyAccessor.Global + /// + /// Gets the loaded architecture (x64/x86). + /// public static string LoadedArchitecture => _CUESDK.LoadedArchitecture; + + /// + /// Gets the protocol details for the current SDK-connection. + /// public static CorsairProtocolDetails ProtocolDetails { get; private set; } + + /// + /// Gets whether the application has exclusive access to the SDK or not. + /// public static bool HasExclusiveAccess { get; private set; } + + /// + /// Gets the last error documented by CUE. + /// public static CorsairError LastError => _CUESDK.CorsairGetLastError(); + /// + /// Gets the managed representation of a keyboard managed by the CUE-SDK. + /// Note that currently only one connected keyboard is supported. + /// public static CorsairKeyboard KeyboardSDK { get; private set; } + + /// + /// Gets the managed representation of a mouse managed by the CUE-SDK. + /// Note that currently only one connected mouse is supported. + /// public static CorsairMouse MouseSDK { get; private set; } + + /// + /// Gets the managed representation of a headset managed by the CUE-SDK. + /// Note that currently only one connected headset is supported. + /// public static CorsairHeadset HeadsetSDK { get; private set; } // ReSharper restore UnusedAutoPropertyAccessor.Global @@ -32,6 +61,11 @@ namespace CUE.NET #region Methods + /// + /// Initializes the CUE-SDK. This method should be called exactly ONE time, before anything else is done. + /// + /// Specifies whether the application should request exclusive access or not. + /// Thrown if the SDK is already initialized, the SDK is not compatible to CUE or if CUE returns unknown devices. public static void Initialize(bool exclusiveAccess = false) { if (ProtocolDetails != null) diff --git a/Devices/Generic/AbstractCueDevice.cs b/Devices/Generic/AbstractCueDevice.cs index 4c6177d..abfde01 100644 --- a/Devices/Generic/AbstractCueDevice.cs +++ b/Devices/Generic/AbstractCueDevice.cs @@ -35,6 +35,7 @@ namespace CUE.NET.Devices.Generic CheckUpdateLoop(); } } + /// /// Gets or sets the update-frequency in seconds. (Calculate by using '1f / updates per second') /// diff --git a/Devices/Generic/GenericDeviceInfo.cs b/Devices/Generic/GenericDeviceInfo.cs index 06f17ec..030918d 100644 --- a/Devices/Generic/GenericDeviceInfo.cs +++ b/Devices/Generic/GenericDeviceInfo.cs @@ -5,6 +5,9 @@ using CUE.NET.Native; namespace CUE.NET.Devices.Generic { + /// + /// Represents generic information about a CUE device. + /// public class GenericDeviceInfo : IDeviceInfo { #region Properties & Fields @@ -29,9 +32,9 @@ namespace CUE.NET.Devices.Generic #region Constructors /// - /// Internal constructor of managed CorsairDeviceInfo. + /// Internal constructor of managed . /// - /// The native CorsairDeviceInfo-struct + /// The native -struct internal GenericDeviceInfo(_CorsairDeviceInfo nativeInfo) { this.Type = nativeInfo.type; diff --git a/Devices/Generic/OnExceptionEventArgs.cs b/Devices/Generic/OnExceptionEventArgs.cs index 27fd53a..ecb3325 100644 --- a/Devices/Generic/OnExceptionEventArgs.cs +++ b/Devices/Generic/OnExceptionEventArgs.cs @@ -1,4 +1,7 @@ -using System; +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global + +using System; namespace CUE.NET.Devices.Generic { diff --git a/Devices/Headset/CorsairHeadset.cs b/Devices/Headset/CorsairHeadset.cs index 017bd3a..85e8a6b 100644 --- a/Devices/Headset/CorsairHeadset.cs +++ b/Devices/Headset/CorsairHeadset.cs @@ -1,4 +1,7 @@ -using System.Collections; +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global + +using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; @@ -7,12 +10,21 @@ using CUE.NET.Devices.Headset.Enums; namespace CUE.NET.Devices.Headset { + /// + /// Represents the SDK for a corsair headset. + /// public class CorsairHeadset : 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. + /// is null. public CorsairLed this[CorsairHeadsetLedId ledId] { get @@ -24,16 +36,29 @@ namespace CUE.NET.Devices.Headset #endregion + /// + /// Gets specific information provided by CUE for the headset. + /// public CorsairHeadsetDeviceInfo HeadsetDeviceInfo { get; } + /// + /// Indicates if the headset has an active effect to deal with. + /// protected override bool HasEffect => false; + /// + /// Gets a read-only collection containing all LEDs of the headset. + /// 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 headset internal CorsairHeadset(CorsairHeadsetDeviceInfo info) : base(info) { @@ -53,6 +78,10 @@ namespace CUE.NET.Devices.Headset #region IEnumerable + /// + /// Returns an enumerator that iterates over all LEDs of the headset. + /// + /// An enumerator for all LDS of the headset. public IEnumerator GetEnumerator() { return Leds.GetEnumerator(); diff --git a/Devices/Headset/CorsairHeadsetDeviceInfo.cs b/Devices/Headset/CorsairHeadsetDeviceInfo.cs index b94b2f9..344bfb2 100644 --- a/Devices/Headset/CorsairHeadsetDeviceInfo.cs +++ b/Devices/Headset/CorsairHeadsetDeviceInfo.cs @@ -4,10 +4,14 @@ using CUE.NET.Native; namespace CUE.NET.Devices.Headset { /// - /// Stub for planned headset-support. + /// Represents specific information for a CUE headset. /// public class CorsairHeadsetDeviceInfo : GenericDeviceInfo { + /// + /// Internal constructor of managed . + /// + /// The native -struct internal CorsairHeadsetDeviceInfo(_CorsairDeviceInfo nativeInfo) : base(nativeInfo) { } diff --git a/Devices/Headset/Enums/CorsairHeadsetLedId.cs b/Devices/Headset/Enums/CorsairHeadsetLedId.cs index 8a27111..84e551a 100644 --- a/Devices/Headset/Enums/CorsairHeadsetLedId.cs +++ b/Devices/Headset/Enums/CorsairHeadsetLedId.cs @@ -3,6 +3,9 @@ namespace CUE.NET.Devices.Headset.Enums { + /// + /// Contains list of all LEDs available for corsair headsets. + /// public enum CorsairHeadsetLedId { Invalid = 0, diff --git a/Devices/ICueDevice.cs b/Devices/ICueDevice.cs index 4a1c2fa..f9ee0e8 100644 --- a/Devices/ICueDevice.cs +++ b/Devices/ICueDevice.cs @@ -3,18 +3,42 @@ using CUE.NET.Devices.Generic.Enums; namespace CUE.NET.Devices { + /// + /// Represents the event-handler of the OnException-event. + /// + /// The sender of the event. + /// The arguments provided by the event. public delegate void OnExceptionEventHandler(object sender, OnExceptionEventArgs args); + /// + /// Represents a generic cue device. + /// public interface ICueDevice { + /// + /// Gets generic information provided by CUE for the device. + /// IDeviceInfo DeviceInfo { get; } + /// + /// Gets or sets the update-mode for the device. + /// UpdateMode UpdateMode { get; set; } + /// + /// Gets or sets the update-frequency in seconds. (Calculate by using '1f / updates per second') + /// float UpdateFrequency { get; set; } + /// + /// Occurs when a catched exception is thrown inside the device. + /// event OnExceptionEventHandler OnException; + /// + /// Perform an update for all dirty keys, or all keys if flushLeds is set to true. + /// + /// Specifies whether all keys (including clean ones) should be updated. void Update(bool flushLeds = false); } } diff --git a/Devices/IDeviceInfo.cs b/Devices/IDeviceInfo.cs index 75ff15a..e17053d 100644 --- a/Devices/IDeviceInfo.cs +++ b/Devices/IDeviceInfo.cs @@ -5,17 +5,17 @@ namespace CUE.NET.Devices public interface IDeviceInfo { /// - /// Device type + /// Gets the device type. /// CorsairDeviceType Type { get; } - + /// - /// Device model (like “K95RGB”). + /// Gets the device model (like “K95RGB”). /// string Model { get; } /// - /// Flags that describes device capabilities + /// Gets flags, which describe device capabilities. /// CorsairDeviceCaps CapsMask { get; } } diff --git a/Devices/Mouse/CorsairMouse.cs b/Devices/Mouse/CorsairMouse.cs index 96d09a5..b1c5129 100644 --- a/Devices/Mouse/CorsairMouse.cs +++ b/Devices/Mouse/CorsairMouse.cs @@ -12,12 +12,21 @@ using CUE.NET.Exceptions; namespace CUE.NET.Devices.Mouse { + /// + /// Represents the SDK for a corsair mouse. + /// public class CorsairMouse : 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. + /// is null. public CorsairLed this[CorsairMouseLedId ledId] { get @@ -29,16 +38,29 @@ namespace CUE.NET.Devices.Mouse #endregion + /// + /// Gets specific information provided by CUE for the mouse. + /// public CorsairMouseDeviceInfo MouseDeviceInfo { get; } + /// + /// Indicates if the mouse has an active effect to deal with. + /// protected override bool HasEffect => false; + /// + /// Gets a read-only collection containing all LEDs of the mouse. + /// 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 mouse internal CorsairMouse(CorsairMouseDeviceInfo info) : base(info) { @@ -80,6 +102,10 @@ namespace CUE.NET.Devices.Mouse #region IEnumerable + /// + /// Returns an enumerator that iterates over all LEDs of the mouse. + /// + /// An enumerator for all LDS of the mouse. public IEnumerator GetEnumerator() { return Leds.GetEnumerator(); diff --git a/Devices/Mouse/CorsairMouseDeviceInfo.cs b/Devices/Mouse/CorsairMouseDeviceInfo.cs index 2290e02..fd13ffd 100644 --- a/Devices/Mouse/CorsairMouseDeviceInfo.cs +++ b/Devices/Mouse/CorsairMouseDeviceInfo.cs @@ -8,7 +8,7 @@ using CUE.NET.Native; namespace CUE.NET.Devices.Mouse { /// - /// Stub for planned headset-support. + /// Represents specific information for a CUE mouse. /// public class CorsairMouseDeviceInfo : GenericDeviceInfo { @@ -24,9 +24,9 @@ namespace CUE.NET.Devices.Mouse #region Constructors /// - /// Internal constructor of managed CorsairDeviceInfo. + /// Internal constructor of managed . /// - /// The native CorsairDeviceInfo-struct + /// The native -struct internal CorsairMouseDeviceInfo(_CorsairDeviceInfo nativeInfo) : base(nativeInfo) { diff --git a/Devices/Mouse/Enums/CorsairMouseButtonId.cs b/Devices/Mouse/Enums/CorsairMouseButtonId.cs index 99494da..47c7288 100644 --- a/Devices/Mouse/Enums/CorsairMouseButtonId.cs +++ b/Devices/Mouse/Enums/CorsairMouseButtonId.cs @@ -3,6 +3,9 @@ namespace CUE.NET.Devices.Mouse.Enums { + /// + /// Contains list of all LEDs available for corsair mice. + /// public enum CorsairMouseLedId { Invalid = 0, diff --git a/Exceptions/CUEException.cs b/Exceptions/CUEException.cs index bf09654..52824b7 100644 --- a/Exceptions/CUEException.cs +++ b/Exceptions/CUEException.cs @@ -6,16 +6,26 @@ using CUE.NET.Devices.Generic.Enums; namespace CUE.NET.Exceptions { + /// + /// Represents an exception thrown by the CUE. + /// public class CUEException : ApplicationException { #region Properties & Fields + /// + /// Gets the provided by CUE. + /// public CorsairError Error { get; } #endregion #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// The provided by CUE, which leads to this exception. public CUEException(CorsairError error) { this.Error = error; diff --git a/Exceptions/WrapperException.cs b/Exceptions/WrapperException.cs index 5fca300..2eaa7b1 100644 --- a/Exceptions/WrapperException.cs +++ b/Exceptions/WrapperException.cs @@ -2,10 +2,18 @@ namespace CUE.NET.Exceptions { + /// + /// Represents an exception thrown by this SDK-Wrapper. + /// public class WrapperException : ApplicationException { #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// The message which describes the reason of throwing this exception. + /// Optional inner exception, which lead to this exception. public WrapperException(string message, Exception innerException = null) : base(message, innerException) { } diff --git a/Helper/ColorHelper.cs b/Helper/ColorHelper.cs index b4cbc7e..3825ca3 100644 --- a/Helper/ColorHelper.cs +++ b/Helper/ColorHelper.cs @@ -5,32 +5,64 @@ using System.Drawing; namespace CUE.NET.Helper { + /// + /// Offers some extensions and helper-methods for color related things. + /// public static class ColorHelper { #region byte/float conversion + /// + /// Converts the alpha-value of the to an float value int the range [0..1]. + /// + /// The color to take the alpha-value from. + /// The float-value in the range of [0..1] public static float GetFloatA(this Color color) { return color.A / 255f; } + /// + /// Converts the red-value of the to an float value int the range [0..1]. + /// + /// The color to take the red-value from. + /// The float-value in the range of [0..1] public static float GetFloatR(this Color color) { return color.R / 255f; } + /// + /// Converts the green-value of the to an float value int the range [0..1]. + /// + /// The color to take the green-value from. + /// The float-value in the range of [0..1] public static float GetFloatG(this Color color) { return color.G / 255f; } + /// + /// Converts the blue-value of the to an float value int the range [0..1]. + /// + /// The color to take the blue-value from. + /// The float-value in the range of [0..1] public static float GetFloatB(this Color color) { return color.B / 255f; } + /// + /// Creates a object from the respective rgb-float-values in the range [0..1]. + /// + /// The alpha-value in the range [0..1]. + /// The red-value in the range [0..1]. + /// The green-value in the range [0..1]. + /// The blue-value in the range [0..1]. + /// The color-object created representing the given values. public static Color CreateColorFromFloat(float a, float r, float g, float b) { + // ReSharper disable once ExceptionNotDocumentedOptional return Color.FromArgb(GetIntColorFromFloat(a), GetIntColorFromFloat(r), GetIntColorFromFloat(g), GetIntColorFromFloat(b)); } @@ -45,6 +77,12 @@ namespace CUE.NET.Helper #region Blending + /// + /// Blends two colors. + /// + /// The background-color. + /// The foreground-color + /// The resulting color. public static Color Blend(this Color bg, Color fg) { if (fg.A == 255) @@ -65,6 +103,11 @@ namespace CUE.NET.Helper #region RGB/HSV conversion // https://en.wikipedia.org/wiki/HSL_and_HSV + /// + /// Gets the saturation-value (HSV-color space) of the color. + /// + /// The color to take the saturation from. + /// The saturation-value (HSV-color space) of the color. public static float GetHSVSaturation(this Color color) { int max = Math.Max(color.R, Math.Max(color.G, color.B)); @@ -75,12 +118,25 @@ namespace CUE.NET.Helper // ReSharper restore RedundantCast } + /// + /// Gets the value-value (HSV-color space) of the color. + /// + /// The color to take the value from. + /// The value-value (HSV-color space) of the color. public static float GetHSVValue(this Color color) { return Math.Max(color.R, Math.Max(color.G, color.B)) / 255f; } // Based on http://stackoverflow.com/questions/3018313/algorithm-to-convert-rgb-to-hsv-and-hsv-to-rgb-in-range-0-255-for-both/6930407#6930407 as of 27.09.2015 + /// + /// Creates a object from the respective hsv-float-values in the range [0..1]. + /// + /// The hue of the color. + /// The saturation of the color. + /// The value of the color. + /// The alpha of the color. + /// The color-object created representing the given values. public static Color ColorFromHSV(float hue, float saturation, float value, byte alpha = 255) { if (saturation <= 0.0) diff --git a/Helper/GradientHelper.cs b/Helper/GradientHelper.cs index 54dac67..2ba2f4d 100644 --- a/Helper/GradientHelper.cs +++ b/Helper/GradientHelper.cs @@ -5,9 +5,19 @@ using System.Drawing; namespace CUE.NET.Helper { + /// + /// Offers some extensions and helper-methods for gradient related things. + /// public static class GradientHelper { // Based on https://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/ + /// + /// Calculates the offset of an given point on an gradient. + /// + /// The start point of the gradient. + /// The end point of the gradient. + /// The point on the gradient to which the offset is calculated. + /// The offset of the point on the gradient. public static float CalculateLinearGradientOffset(PointF startPoint, PointF endPoint, PointF point) { PointF intersectingPoint; @@ -17,7 +27,7 @@ namespace CUE.NET.Helper else if (startPoint.X.Equals(endPoint.X)) // Vertical case intersectingPoint = new PointF(startPoint.X, point.Y); - else // Diagnonal case + else // Diagonal case { float slope = (endPoint.Y - startPoint.Y) / (endPoint.X - startPoint.X); float orthogonalSlope = -1 / slope; @@ -39,8 +49,12 @@ namespace CUE.NET.Helper // Based on https://dotupdate.wordpress.com/2008/01/28/find-the-color-of-a-point-in-a-lineargradientbrush/ /// - /// Returns the signed magnitude of a point on a vector + /// Returns the signed magnitude of a point on a vector. /// + /// The point on the vector of which the magnitude should be calculated. + /// The origin of the vector. + /// The direction of the vector. + /// The signed magnitude of a point on a vector. public static float CalculateDistance(PointF point, PointF origin, PointF direction) { float distance = CalculateDistance(point, origin); @@ -52,6 +66,12 @@ namespace CUE.NET.Helper ? -distance : distance; } + /// + /// Calculated the distance between two points. + /// + /// The first point. + /// The second point. + /// The distance between the two points. public static float CalculateDistance(PointF point1, PointF point2) { return (float)Math.Sqrt((point1.Y - point2.Y) * (point1.Y - point2.Y) + (point1.X - point2.X) * (point1.X - point2.X)); diff --git a/Helper/RectangleHelper.cs b/Helper/RectangleHelper.cs index 3082fbd..dc1faea 100644 --- a/Helper/RectangleHelper.cs +++ b/Helper/RectangleHelper.cs @@ -4,13 +4,27 @@ using System.Drawing; namespace CUE.NET.Helper { + /// + /// Offers some extensions and helper-methods for rectangle related things. + /// public static class RectangleHelper { + /// + /// Calculates the center-point of a rectangle. + /// + /// The rectangle. + /// The center point of the rectangle. public static PointF GetCenter(this RectangleF rectangle) { return new PointF(rectangle.Left + rectangle.Width / 2f, rectangle.Top + rectangle.Height / 2f); } + /// + /// Creates a rectangle from two corner points. + /// + /// The first point. + /// The second points. + /// The rectangle created from the two points. public static RectangleF CreateRectangleFromPoints(PointF point1, PointF point2) { float posX = Math.Min(point1.X, point2.X); @@ -21,16 +35,27 @@ namespace CUE.NET.Helper return new RectangleF(posX, posY, width, height); } - public static RectangleF CreateRectangleFromRectangles(RectangleF point1, RectangleF point2) + /// + /// Creates a rectangle containing two other rectangles. + /// + /// The first rectangle. + /// The second rectangle. + /// The rectangle created from the two rectangles. + public static RectangleF CreateRectangleFromRectangles(RectangleF rectangle1, RectangleF rectangle2) { - float posX = Math.Min(point1.X, point2.X); - float posY = Math.Min(point1.Y, point2.Y); - float width = Math.Max(point1.X + point1.Width, point2.X + point2.Width) - posX; - float height = Math.Max(point1.Y + point1.Height, point2.Y + point2.Height) - posY; + float posX = Math.Min(rectangle1.X, rectangle2.X); + float posY = Math.Min(rectangle1.Y, rectangle2.Y); + float width = Math.Max(rectangle1.X + rectangle1.Width, rectangle2.X + rectangle2.Width) - posX; + float height = Math.Max(rectangle1.Y + rectangle1.Height, rectangle2.Y + rectangle2.Height) - posY; return new RectangleF(posX, posY, width, height); } + /// + /// Creates a rectangle containing n other rectangles. + /// + /// The list of rectangles. + /// The rectangle created from the rectangles. public static RectangleF CreateRectangleFromRectangles(IEnumerable rectangles) { float posX = float.MaxValue; @@ -49,6 +74,12 @@ namespace CUE.NET.Helper return CreateRectangleFromPoints(new PointF(posX, posY), new PointF(posX2, posY2)); } + /// + /// Calculates the percentage of the intersection of two rectangles. + /// + /// The rectangle from which the percentage should be calculated. + /// The intersecting rectangle. + /// The percentage of the intersection. public static float CalculateIntersectPercentage(RectangleF rect, RectangleF referenceRect) { if (rect.IsEmpty || referenceRect.IsEmpty) return 0; diff --git a/Native/_CUESDK.cs b/Native/_CUESDK.cs index 094c253..87c6bf8 100644 --- a/Native/_CUESDK.cs +++ b/Native/_CUESDK.cs @@ -10,6 +10,9 @@ namespace CUE.NET.Native { #region Libary Management + /// + /// Gets the loaded architecture (x64/x86). + /// internal static string LoadedArchitecture { get; private set; } static _CUESDK() @@ -25,8 +28,10 @@ namespace CUE.NET.Native #region SDK-IMPORTS + /// + /// CUE-SDK: set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // set specified leds to some colors. The color is retained until changed by successive calls. This function does not take logical layout into account internal static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors); //#if WIN64 @@ -36,32 +41,47 @@ namespace CUE.NET.Native //#endif //internal static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context); + /// + /// CUE-SDK: returns number of connected Corsair devices that support lighting control. + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // returns number of connected Corsair devices that support lighting control. internal static extern int CorsairGetDeviceCount(); + /// + /// CUE-SDK: returns information about device at provided index + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // returns information about device at provided index internal static extern IntPtr CorsairGetDeviceInfo(int deviceIndex); + /// + /// CUE-SDK: provides list of keyboard LEDs with their physical positions. + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // provides list of keyboard LEDs with their physical positions. internal static extern IntPtr CorsairGetLedPositions(); + /// + /// CUE-SDK: retrieves led id for key name taking logical layout into account. + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // retrieves led id for key name taking logical layout into account. internal static extern CorsairKeyboardKeyId CorsairGetLedIdForKeyName(char keyName); + /// + /// CUE-SDK: requestes control using specified access mode. + /// By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // requestes control using specified access mode. By default client has shared control over lighting so there is no need to call CorsairRequestControl unless client requires exclusive control internal static extern bool CorsairRequestControl(CorsairAccessMode accessMode); + /// + /// CUE-SDK: checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE internal static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake(); + /// + /// CUE-SDK: returns last error that occured while using any of Corsair* functions + /// [DllImport("CUESDK_2013.dll", CallingConvention = CallingConvention.Cdecl)] - // returns last error that occured while using any of Corsair* functions internal static extern CorsairError CorsairGetLastError(); #endregion diff --git a/Native/_CorsairDeviceInfo.cs b/Native/_CorsairDeviceInfo.cs index 846e240..fe41dfe 100644 --- a/Native/_CorsairDeviceInfo.cs +++ b/Native/_CorsairDeviceInfo.cs @@ -9,13 +9,35 @@ using CUE.NET.Devices.Generic.Enums; namespace CUE.NET.Native { // ReSharper disable once InconsistentNaming + /// + /// CUE-SDK: contains information about device + /// [StructLayout(LayoutKind.Sequential)] - internal class _CorsairDeviceInfo // contains information about device + internal class _CorsairDeviceInfo { - internal CorsairDeviceType type; // enum describing device type - internal IntPtr model; // null - terminated device model(like “K95RGB”) - 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 + /// + /// CUE-SDK: enum describing device type + /// + internal CorsairDeviceType type; + + /// + /// CUE-SDK: null - terminated device model(like “K95RGB”) + /// + internal IntPtr model; + + /// + /// CUE-SDK: enum describing physical layout of the keyboard or mouse + /// + internal int physicalLayout; + + /// + /// CUE-SDK: enum describing logical layout of the keyboard as set in CUE settings + /// + internal int logicalLayout; + + /// + /// CUE-SDK: mask that describes device capabilities, formed as logical “or” of CorsairDeviceCaps enum values + /// + internal int capsMask; } } diff --git a/Native/_CorsairLedColor.cs b/Native/_CorsairLedColor.cs index 489589a..00a5e27 100644 --- a/Native/_CorsairLedColor.cs +++ b/Native/_CorsairLedColor.cs @@ -6,14 +6,31 @@ using System.Runtime.InteropServices; namespace CUE.NET.Native { - // ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming + /// + /// CUE-SDK: contains information about led and its color + /// [StructLayout(LayoutKind.Sequential)] - internal class _CorsairLedColor // contains information about led and its color + internal class _CorsairLedColor { + /// + /// CUE-SDK: identifier of LED to set + /// + internal int ledId; - 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] + /// + /// CUE-SDK: red brightness[0..255] + /// + internal int r; + + /// + /// CUE-SDK: green brightness[0..255] + /// + internal int g; + + /// + /// CUE-SDK: blue brightness[0..255] + /// + internal int b; }; } diff --git a/Native/_CorsairLedPosition.cs b/Native/_CorsairLedPosition.cs index ebd29e2..bb0cc96 100644 --- a/Native/_CorsairLedPosition.cs +++ b/Native/_CorsairLedPosition.cs @@ -8,13 +8,36 @@ using CUE.NET.Devices.Keyboard.Enums; namespace CUE.NET.Native { // ReSharper disable once InconsistentNaming + /// + /// CUE-SDK: 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 + /// [StructLayout(LayoutKind.Sequential)] - internal 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 class _CorsairLedPosition { - internal CorsairKeyboardKeyId ledId; // identifier of led + /// + /// CUE-SDK: identifier of led + /// + internal CorsairKeyboardKeyId ledId; + + /// + /// CUE-SDK: values in mm + /// internal double top; + + /// + /// CUE-SDK: values in mm + /// internal double left; + + /// + /// CUE-SDK: values in mm + /// internal double height; - internal double width; // values in mm + + /// + /// CUE-SDK: values in mm + /// + internal double width; } } diff --git a/Native/_CorsairLedPositions.cs b/Native/_CorsairLedPositions.cs index 9bcfd9e..109fdcb 100644 --- a/Native/_CorsairLedPositions.cs +++ b/Native/_CorsairLedPositions.cs @@ -8,10 +8,20 @@ using System.Runtime.InteropServices; namespace CUE.NET.Native { // ReSharper disable once InconsistentNaming + /// + /// CUE-SDK: contains number of leds and arrays with their positions + /// [StructLayout(LayoutKind.Sequential)] - internal class _CorsairLedPositions // contains number of leds and arrays with their positions + internal class _CorsairLedPositions { - internal int numberOfLed; // integer value.Number of elements in following array - internal IntPtr pLedPosition; // array of led positions + /// + /// CUE-SDK: integer value.Number of elements in following array + /// + internal int numberOfLed; + + /// + /// CUE-SDK: array of led positions + /// + internal IntPtr pLedPosition; } } diff --git a/Native/_CorsairProtocolDetails.cs b/Native/_CorsairProtocolDetails.cs index 92fa888..f521388 100644 --- a/Native/_CorsairProtocolDetails.cs +++ b/Native/_CorsairProtocolDetails.cs @@ -8,13 +8,37 @@ using System.Runtime.InteropServices; namespace CUE.NET.Native { // ReSharper disable once InconsistentNaming + /// + /// CUE-SDK: contains information about SDK and CUE versions + /// [StructLayout(LayoutKind.Sequential)] - internal struct _CorsairProtocolDetails // contains information about SDK and CUE versions + internal struct _CorsairProtocolDetails { - internal IntPtr sdkVersion; // null - terminated string containing version of SDK(like “1.0.0.1”). Always contains valid value even if there was no CUE found - internal IntPtr serverVersion; // null - terminated string containing version of CUE(like “1.0.0.1”) or NULL if CUE was not found. - internal int sdkProtocolVersion; // integer number that specifies version of protocol that is implemented by current SDK. Numbering starts from 1. Always contains valid value even if there was no CUE found - internal int serverProtocolVersion; // integer number that specifies version of protocol that is implemented by CUE. Numbering starts from 1. If CUE was not found then this value will be 0 - internal byte breakingChanges; // boolean value that specifies if there were breaking changes between version of protocol implemented by server and client + /// + /// CUE-SDK: null - terminated string containing version of SDK(like “1.0.0.1”). Always contains valid value even if there was no CUE found + /// + internal IntPtr sdkVersion; + + /// + /// CUE-SDK: null - terminated string containing version of CUE(like “1.0.0.1”) or NULL if CUE was not found. + /// + internal IntPtr serverVersion; + + /// + /// CUE-SDK: integer number that specifies version of protocol that is implemented by current SDK. + /// Numbering starts from 1. Always contains valid value even if there was no CUE found + /// + internal int sdkProtocolVersion; + + /// + /// CUE-SDK: integer number that specifies version of protocol that is implemented by CUE. + /// Numbering starts from 1. If CUE was not found then this value will be 0 + /// + internal int serverProtocolVersion; + + /// + /// CUE-SDK: boolean value that specifies if there were breaking changes between version of protocol implemented by server and client + /// + internal byte breakingChanges; }; }