1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use cue_sdk_sys as ffi;
use num_traits::FromPrimitive;
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive)]
#[repr(u32)]
pub enum CueSdkError {
ServerNotFound = ffi::CorsairError_CE_ServerNotFound,
NoControl = ffi::CorsairError_CE_NoControl,
ProtocolHandshakeMissing = ffi::CorsairError_CE_ProtocolHandshakeMissing,
IncompatibleProtocol = ffi::CorsairError_CE_IncompatibleProtocol,
InvalidArguments = ffi::CorsairError_CE_InvalidArguments,
}
pub(crate) fn get_last_error() -> Option<CueSdkError> {
CueSdkError::from_u32(unsafe { cue_sdk_sys::CorsairGetLastError() })
}
pub type CueSdkErrorResult<T = ()> = Result<T, Option<CueSdkError>>;