Skip to content

Commit

Permalink
Add syscap_ndk canIuse binding
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Schwender <[email protected]>
  • Loading branch information
jschwe committed Aug 29, 2024
1 parent 9b656d6 commit 9047294
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/generate_bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ bindgen "${BASE_BINDGEN_ARGS[@]}" \
-- \
"${BASE_CLANG_ARGS[@]}"

bindgen "${BASE_BINDGEN_ARGS[@]}" \
--default-enum-style=newtype \
--output "${ROOT_DIR}/src/syscap/syscap_api${OHOS_API_VERSION}.rs" \
"${OHOS_SYSROOT_DIR}/usr/include/syscap_ndk.h" \
-- \
"${BASE_CLANG_ARGS[@]}"

bindgen "${BASE_BINDGEN_ARGS[@]}" \
--default-enum-style=newtype \
--output "${ROOT_DIR}/src/hilog/hilog_api${OHOS_API_VERSION}.rs" \
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ pub mod native_image;
#[cfg_attr(docsrs, doc(cfg(feature = "native_window")))]
pub mod native_window;

// It's just one function, so we don't feature guard this.
pub mod syscap;

#[cfg(feature = "vsync")]
#[cfg_attr(docsrs, doc(cfg(feature = "vsync")))]
pub mod vsync;
Expand Down
5 changes: 5 additions & 0 deletions src/syscap.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
///! Bindings to check a devices system capabilites at runtime
///
/// [Official SystemCapability Documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/reference/syscap.md)
mod syscap_api10;
pub use syscap_api10::*;
9 changes: 9 additions & 0 deletions src/syscap/syscap_api10.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* automatically generated by rust-bindgen 0.69.4 */

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

extern "C" {
pub fn canIUse(cap: *const ::core::ffi::c_char) -> bool;
}
9 changes: 9 additions & 0 deletions src/syscap/syscap_api11.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* automatically generated by rust-bindgen 0.69.4 */

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

extern "C" {
pub fn canIUse(cap: *const ::core::ffi::c_char) -> bool;
}
9 changes: 9 additions & 0 deletions src/syscap/syscap_api12.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* automatically generated by rust-bindgen 0.69.4 */

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

extern "C" {
pub fn canIUse(cap: *const ::core::ffi::c_char) -> bool;
}

0 comments on commit 9047294

Please sign in to comment.