From 3419ebd8696780ddaa9918549b670a2daaa7a8ac Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 22 May 2022 17:31:31 +0000 Subject: [PATCH] chore(release): 0.2.1 [skip ci] ### [0.2.1](https://github.com/meskill/mystic-light-sdk/compare/v0.2.0...v0.2.1) (2022-05-22) ### Documentation * inline example to lib docs ([862c04d](https://github.com/meskill/mystic-light-sdk/commit/862c04d45dbe3632b2708203c62797c350ca949c)) ### Build System * add env usage to build script ([0137cfb](https://github.com/meskill/mystic-light-sdk/commit/0137cfb21665bc929987ca58b403532fdd5e0e89)) ### Continuous Integration * fix publish ([dc2d883](https://github.com/meskill/mystic-light-sdk/commit/dc2d883ca2f5ec965aa9ad4a92b3f17fd8b8d110)) * fixup changes to lock file after publish ([4b03592](https://github.com/meskill/mystic-light-sdk/commit/4b035924d0a434d2759d5c4fbd44fec8cb88a4e7)) * run tests with all features ([ea9bc64](https://github.com/meskill/mystic-light-sdk/commit/ea9bc64baf946c71afa63bb1295d283e7772253b)) --- CHANGELOG.md | 19 ++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 120 --------------------------------------------------- 4 files changed, 21 insertions(+), 122 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9c936..19169d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +### [0.2.1](https://github.com/meskill/mystic-light-sdk/compare/v0.2.0...v0.2.1) (2022-05-22) + + +### Documentation + +* inline example to lib docs ([862c04d](https://github.com/meskill/mystic-light-sdk/commit/862c04d45dbe3632b2708203c62797c350ca949c)) + + +### Build System + +* add env usage to build script ([0137cfb](https://github.com/meskill/mystic-light-sdk/commit/0137cfb21665bc929987ca58b403532fdd5e0e89)) + + +### Continuous Integration + +* fix publish ([dc2d883](https://github.com/meskill/mystic-light-sdk/commit/dc2d883ca2f5ec965aa9ad4a92b3f17fd8b8d110)) +* fixup changes to lock file after publish ([4b03592](https://github.com/meskill/mystic-light-sdk/commit/4b035924d0a434d2759d5c4fbd44fec8cb88a4e7)) +* run tests with all features ([ea9bc64](https://github.com/meskill/mystic-light-sdk/commit/ea9bc64baf946c71afa63bb1295d283e7772253b)) + ## [0.2.0](https://github.com/meskill/mystic-light-sdk/compare/v0.1.5...v0.2.0) (2022-05-22) diff --git a/Cargo.lock b/Cargo.lock index 4ee3a23..d9e95ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -154,7 +154,7 @@ dependencies = [ [[package]] name = "mystic_light_sdk" -version = "0.2.0" +version = "0.2.1" dependencies = [ "copy_dir", "custom_error", diff --git a/Cargo.toml b/Cargo.toml index 5c2282c..3c6e26a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mystic_light_sdk" -version = "0.2.0" +version = "0.2.1" edition = "2021" authors = ["meskill"] description = "A Rust wrapper for the MysticLight SDK (MSI hardware and peripherals)" diff --git a/README.md b/README.md index 3392749..2b8779c 100644 --- a/README.md +++ b/README.md @@ -14,125 +14,5 @@ Rust SDK wrapper for the [Mystic Light SDK](https://www.msi.com/Landing/mystic-l ## Examples ```rust -use mystic_light_sdk::{Color, CommonError, DeviceLedState, MysticLightSDK}; -use std::thread; -use std::time::Duration; - -const LIB_PATH: &str = if cfg!(target_arch = "x86_64") { - "sdk/MysticLight_SDK_x64.dll" -} else { - "sdk/MysticLight_SDK.dll" -}; - -fn main() -> Result<(), CommonError> { - let sdk = MysticLightSDK::new(LIB_PATH)?; - - let devices = sdk.get_devices()?; - - println!("{:#?}", devices); - - let mut keyboard_leds = devices[2].leds()?; - - println!("{:#?}", keyboard_leds); - - let state = keyboard_leds[0].get_state()?.to_owned(); - - println!("Current device state: {:#?}", state); - - println!("Disable lightning!"); - - let new_state = DeviceLedState { - color: Color { - red: 0, - green: 0, - blue: 0, - }, - style: String::from("NoAnimation"), - ..state.clone() - }; - - keyboard_leds[0].set_state(&new_state)?; - - thread::sleep(Duration::from_secs(5)); - - println!("Enable lightning"); - - keyboard_leds[0].set_state(&state)?; - - Ok(()) -} -``` - -### Pass right dll file - -It depends on the os architecture you are building the program to and the os architecture for the end users. - -Currently, most of the PC's are 64 bit architecture so you may just use MysticLight_SDK_x64.dll - -Or if you are targetting both architecture you may use code below - -```rust -const LIB_PATH: &str = if cfg!(target_arch = "x86_64") { - "sdk/MysticLight_SDK_x64.dll" // path to the dll file that must be available in runtime -} else { - "sdk/MysticLight_SDK.dll" -}; -``` - -### Copy dll files to the output dir - -As sdk dll is required in runtime you must provide these files somehow in the runtime. - -You may use build script below in order to copy sdk files to the output dir. In this case dll files must reside in the `/sdk` directory - -```rust -use std::env; -use std::path::Path; - -fn main() -> std::io::Result<()> { - println!("cargo:rerun-if-changed=sdk"); - - let current_dir = env::current_dir()?; - let out_dir = env::var("OUT_DIR").unwrap(); - - let from_path = current_dir.join("sdk"); - - let dest_path = Path::new(&out_dir) - .parent() - .unwrap() - .parent() - .unwrap() - .parent() - .unwrap() - .join("sdk"); - - if !dest_path.exists() { - copy_dir::copy_dir(from_path, dest_path)?; - } - - Ok(()) -} -``` - -## Panics - -- in case of any problems with conversion from and into WinApi types - -## Features - -### serde - -Enables [serde](https://crates.io/crates/serde) serialization/deserialization for some of the sdk structs - -## Troubleshooting - -### Timeout error on initialization - -Make sure you have been fulfilled [requirements](#requirements) and you running the result program with the admin rights - -### NotSupported error when trying to set color - -Some of the device's styles do not support colors. In this case this kind of error will be generated. - License: Apache-2.0