diff --git a/Cargo.lock b/Cargo.lock index 5f21511..a168ea4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -191,7 +191,7 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "scs-rs-proc-macros" -version = "0.1.0" +version = "0.1.1" dependencies = [ "quote", "syn", diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7c29de --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# SCS SDK Bindings for Rust + +## How to use +Check out [README.md](scs_rs/README.md) of [scs-sdk-rs](https://crates.io/crates/scs-sdk-rs) crate. \ No newline at end of file diff --git a/scs_rs/README.md b/scs_rs/README.md new file mode 100644 index 0000000..3792720 --- /dev/null +++ b/scs_rs/README.md @@ -0,0 +1,22 @@ +# SCS SDK Bindings + +## Usage Example +```rust +#[no_mangle] +#[scs_sdk_rs::proc_macros::scs_telemetry_init] +// pub extern "C" fn scs_telemetry_init(version: scs_sdk_rs::scs_u32_t, params: *const scs_sdk_rs::scs_telemetry_init_params_t) -> scs_sdk_rs::scs_result_t +pub fn init() { + let version_params_ptr = params as *const scs_sdk_rs::scs_telemetry_init_params_v101_t; + + unsafe { + // example for using params + let version_params = *version_params_ptr; + + version_params.common.log.unwrap()(scs_sdk_rs::SCS_LOG_TYPE_message, "The Rust telemetry plugin is loaded.".as_ptr() as *const i8); + } + + // ... + + scs_sdk_rs::SCS_RESULT_ok +} +``` \ No newline at end of file diff --git a/scs_rs/build.rs b/scs_rs/build.rs index fbae077..0f67c05 100644 --- a/scs_rs/build.rs +++ b/scs_rs/build.rs @@ -5,6 +5,9 @@ fn main() { let bindings = bindgen::Builder::default() .header("wrapper.hpp") + .blocklist_item(r#"(\w+)_(MAX|MIN|WIDTH)"#) + .blocklist_item(r#"some_requirement_failed_at_(\d+)"#) + .blocklist_function(r#"(\w+)_(init|shutdown)(\w*)"#) .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate() .expect("Unable to generate bindings");