mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Added corsair session details
This commit is contained in:
parent
2ff7a65519
commit
cc652a08a6
@ -45,6 +45,11 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool ExclusiveAccess { get; set; } = false;
|
public static bool ExclusiveAccess { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the details for the current SDK-session.
|
||||||
|
/// </summary>
|
||||||
|
public CorsairSessionDetails SessionDetails { get; private set; } = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@ -81,12 +86,17 @@ public class CorsairDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
_CUESDK.SessionStateChanged += OnSessionStateChanged;
|
_CUESDK.SessionStateChanged += OnSessionStateChanged;
|
||||||
|
|
||||||
CorsairError errorCode = _CUESDK.CorsairConnect();
|
CorsairError errorCode = _CUESDK.CorsairConnect();
|
||||||
|
|
||||||
if (errorCode != CorsairError.Success)
|
if (errorCode != CorsairError.Success)
|
||||||
Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (ErrorCode: {errorCode})"));
|
Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (ErrorCode: {errorCode})"));
|
||||||
|
|
||||||
if (!waitEvent.Wait(ConnectionTimeout))
|
if (!waitEvent.Wait(ConnectionTimeout))
|
||||||
Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (Timeout - Current connection state: {_CUESDK.SesionState})"));
|
Throw(new RGBDeviceException($"Failed to initialized Corsair-SDK. (Timeout - Current connection state: {_CUESDK.SesionState})"));
|
||||||
|
|
||||||
|
_CUESDK.CorsairGetSessionDetails(out _CorsairSessionDetails? details);
|
||||||
|
if (errorCode != CorsairError.Success)
|
||||||
|
Throw(new RGBDeviceException($"Failed to get session details. (ErrorCode: {errorCode})"));
|
||||||
|
|
||||||
|
SessionDetails = new CorsairSessionDetails(details!);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
37
RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs
Normal file
37
RGB.NET.Devices.Corsair/Generic/CorsairProtocolDetails.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
|
using RGB.NET.Devices.Corsair.Native;
|
||||||
|
|
||||||
|
namespace RGB.NET.Devices.Corsair;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents version information for the Corsair-SDK
|
||||||
|
/// </summary>
|
||||||
|
public class CorsairSessionDetails
|
||||||
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
public string ClientVersion { get; }
|
||||||
|
public string ServerVersion { get; }
|
||||||
|
public string ServerHostVersion { get; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
internal CorsairSessionDetails()
|
||||||
|
{
|
||||||
|
ClientVersion = string.Empty;
|
||||||
|
ServerVersion = string.Empty;
|
||||||
|
ServerHostVersion = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal CorsairSessionDetails(_CorsairSessionDetails nativeDetails)
|
||||||
|
{
|
||||||
|
this.ClientVersion = nativeDetails.clientVersion.ToString();
|
||||||
|
this.ServerVersion = nativeDetails.serverVersion.ToString();
|
||||||
|
this.ServerHostVersion = nativeDetails.serverHostVersion.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user