cue_sdk/lib.rs
1//! A safe, high-level wrapper for the Corsair iCUE SDK v4.
2//!
3//! # Quick Start
4//!
5//! ```no_run
6//! use std::time::Duration;
7//! use cue_sdk::device::DeviceType;
8//! use cue_sdk::led::LedColor;
9//!
10//! let session = cue_sdk::connect().expect("connect failed");
11//! session.wait_for_connection(Duration::from_secs(5)).expect("timeout");
12//!
13//! let devices = session.get_devices(DeviceType::ALL).expect("get_devices");
14//! for dev in &devices {
15//! println!("{} ({})", dev.model, dev.id);
16//! }
17//! ```
18//!
19//! # Architecture
20//!
21//! [`Session`] is the single entry point for all SDK operations. Call
22//! [`connect()`] to create one; it calls `CorsairDisconnect` on drop.
23//!
24//! Device information is returned as plain data structs ([`DeviceInfo`],
25//! [`LedPosition`]). Operations that need a device take a [`&DeviceId`]
26//! parameter.
27
28pub(crate) mod callback;
29pub mod device;
30pub mod error;
31pub mod event;
32pub mod led;
33pub mod property;
34pub mod session;
35
36pub use device::{DeviceId, DeviceInfo, DeviceType};
37pub use error::{Result, SdkError};
38#[cfg(feature = "async")]
39pub use event::AsyncEventSubscription;
40pub use event::{Event, EventSubscription, MacroKeyId};
41pub use led::{LedColor, LedPosition};
42pub use property::{PropertyId, PropertyValue};
43pub use session::{AccessLevel, Session, SessionDetails, SessionState, Version};
44
45/// Connect to the iCUE SDK and return a [`Session`].
46///
47/// This is a convenience wrapper around [`Session::connect()`].
48pub fn connect() -> Result<Session> {
49 Session::connect()
50}