Crates.io | cue-sdk |
lib.rs | cue-sdk |
version | 0.0.3 |
source | src |
created_at | 2020-09-09 06:29:28.62295 |
updated_at | 2020-11-08 00:59:28.535723 |
description | A high-level safe wrapper on top of cue-sdk-sys, for interfacing with the iCUE SDK. |
homepage | |
repository | https://github.com/scottroemeschke/cue-sdk-rust |
max_upload_size | |
id | 286507 |
size | 229,690 |
A high level rust wrapper for the native iCUE SDK.
If you are looking for low-level (and unsafe) access, check out the parent crate for this repository cue-sdk-sys.
Make sure you set the required environment variables for the cue-sdk-sys dependency crate.
If you need the binaries, the easiest place to get them is on the Github Releases Page. Since we can't build them from scratch (not open source) you have to get them yourself.
This version of the crate is built against version 3.0.55 of the iCUE SDK.
use cue_sdk::led::LedColor;
use cue_sdk::initialize;
let sdk = initialize()
.expect("failed to initialize sdk");
let mut devices = sdk.get_all_devices().expect("failed to get all devices");
let new_color = LedColor { red: 200, green: 20, blue: 165 };
for d in &mut devices {
//print some info
println!("Device: {:?} at index {:?} has led count: ${:?}",
d.device_info.model, d.device_index, d.leds.len());
// set the first led in every device to our `new_color` color
d.leds.first_mut().unwrap().update_color_buffer(new_color);
}
//flush the colors buffer (send to device hardware)
sdk.flush_led_colors_update_buffer_sync()
.expect("failed to flush led buffer");
You can note from the following example, most "write" operations can fail for a variety of reasons including but not limited to:
For additional examples see the example code
and run examples with cargo run --example {example_name}
.
The async
feature gives additional methods/structs which return futures
instead of taking callbacks/closures.