mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-10 20:46:24 +00:00
Initial commit (simple but working version)
This commit is contained in:
1 parent
0a8c571244
commit
f07595b50c
30 files changed
+1098
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE.NET.Enums;
|
||||
|
||||
namespace CUE.NET.Native
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
internal static class CUESDK
|
||||
{
|
||||
// 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.x64_2013.dll")]
|
||||
public static extern bool CorsairSetLedsColors(int size, IntPtr ledsColors);
|
||||
|
||||
//[DllImport("CUESDK.x64_2013.dll")]
|
||||
//public static extern bool CorsairSetLedsColorsAsync(int size, CorsairLedColor* ledsColors, void(*CallbackType)(void*, bool, CorsairError), void* context);
|
||||
|
||||
// returns number of connected Corsair devices that support lighting control.
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern int CorsairGetDeviceCount();
|
||||
|
||||
// returns information about device at provided index
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern IntPtr CorsairGetDeviceInfo(int deviceIndex);
|
||||
|
||||
// provides list of keyboard LEDs with their physical positions.
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern IntPtr CorsairGetLedPositions();
|
||||
|
||||
// retrieves led id for key name taking logical layout into account.
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern CorsairLedId CorsairGetLedIdForKeyName(char keyName);
|
||||
|
||||
// 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.x64_2013.dll")]
|
||||
public static extern bool CorsairRequestControl(CorsairAccessMode accessMode);
|
||||
|
||||
// checks file and protocol version of CUE to understand which of SDK functions can be used with this version of CUE
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern _CorsairProtocolDetails CorsairPerformProtocolHandshake();
|
||||
|
||||
// returns last error that occured while using any of Corsair* functions
|
||||
[DllImport("CUESDK.x64_2013.dll")]
|
||||
public static extern CorsairError CorsairGetLastError();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma warning disable 169 // Field 'x' is never used
|
||||
#pragma warning disable 414 // Field 'x' is assigned but its value never used
|
||||
#pragma warning disable 649 // Field 'x' is never assigned
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE.NET.Enums;
|
||||
|
||||
namespace CUE.NET.Native
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class _CorsairDeviceInfo // contains information about device
|
||||
{
|
||||
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 capsMask; // mask that describes device capabilities, formed as logical “or” of CorsairDeviceCaps enum values
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma warning disable 169 // Field 'x' is never used
|
||||
#pragma warning disable 414 // Field 'x' is assigned but its value never used
|
||||
#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
|
||||
{
|
||||
|
||||
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]
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma warning disable 169 // Field 'x' is never used
|
||||
#pragma warning disable 414 // Field 'x' is assigned but its value never used
|
||||
#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 _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 double top;
|
||||
internal double left;
|
||||
internal double height;
|
||||
internal double width; // values in mm
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma warning disable 169 // Field 'x' is never used
|
||||
#pragma warning disable 414 // Field 'x' is assigned but its value never used
|
||||
#pragma warning disable 649 // Field 'x' is never assigned
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CUE.NET.Native
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class _CorsairLedPositions // contains number of leds and arrays with their positions
|
||||
{
|
||||
internal int numberOfLed; // integer value.Number of elements in following array
|
||||
internal IntPtr pLedPosition; // array of led positions
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#pragma warning disable 169 // Field 'x' is never used
|
||||
#pragma warning disable 414 // Field 'x' is assigned but its value never used
|
||||
#pragma warning disable 649 // Field 'x' is never assigned
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CUE.NET.Native
|
||||
{
|
||||
// ReSharper disable once InconsistentNaming
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct _CorsairProtocolDetails // contains information about SDK and CUE versions
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user