Skip to main content

ohos_basic_services_kit_sys/
lib.rs

1//! Bindings to the OpenHarmony BasicServicesKit NDK.
2//!
3//! ## Overview
4//!
5//! [BasicServicesKit](https://gitcode.com/openharmony/docs/blob/master/en/application-dev/reference/apis-basic-services-kit/_o_h___common_event.md)
6//! groups several unrelated system-service NDKs under one upstream kit. Each
7//! lives in a separate shared library, so this crate exposes each behind its
8//! own cargo feature:
9//!
10//! | Module                                    | Feature        | Library                  | Min API |
11//! | ----------------------------------------- | -------------- | ------------------------ | ------- |
12//! | [`commonevent`] / [`commonevent_support`] | `commonevent`  | `libohcommonevent.so`    | 12      |
13//! | [`battery_info`]                          | `battery-info` | `libohbattery_info.so`   | 13      |
14//! | [`print`]                                 | `print`        | `libohprint.so`          | 12      |
15//! | [`scan`]                                  | `scan`         | `libohscan.so`           | 12      |
16//! | [`os_account`] / [`os_account_common`]    | `os-account`   | `libos_account_ndk.so`   | 12      |
17//! | [`time_service`]                          | `time-service` | `libtime_service_ndk.so` | 12      |
18//!
19//! A sub-API feature is a no-op unless the matching `api-XX` feature is also
20//! enabled — i.e. enabling `commonevent` without `api-12` (or higher) leaves
21//! the module hidden and the `.so` unlinked.
22//!
23//! ## Feature flags
24#![cfg_attr(
25    feature = "document-features",
26    cfg_attr(doc, doc = ::document_features::document_features!())
27)]
28#![cfg_attr(docsrs, feature(doc_cfg))]
29
30#[cfg(all(feature = "commonevent", feature = "api-12"))]
31#[cfg_attr(docsrs, doc(cfg(all(feature = "commonevent", feature = "api-12"))))]
32pub mod commonevent;
33
34#[cfg(all(feature = "commonevent", feature = "api-12"))]
35#[cfg_attr(docsrs, doc(cfg(all(feature = "commonevent", feature = "api-12"))))]
36pub mod commonevent_support;
37
38#[cfg(all(feature = "commonevent", feature = "api-12"))]
39#[link(name = "ohcommonevent")]
40unsafe extern "C" {}
41
42#[cfg(all(feature = "battery-info", feature = "api-13"))]
43#[cfg_attr(docsrs, doc(cfg(all(feature = "battery-info", feature = "api-13"))))]
44pub mod battery_info;
45
46#[cfg(all(feature = "battery-info", feature = "api-13"))]
47#[link(name = "ohbattery_info")]
48unsafe extern "C" {}
49
50#[cfg(all(feature = "print", feature = "api-12"))]
51#[cfg_attr(docsrs, doc(cfg(all(feature = "print", feature = "api-12"))))]
52pub mod print;
53
54#[cfg(all(feature = "print", feature = "api-12"))]
55#[link(name = "ohprint")]
56unsafe extern "C" {}
57
58#[cfg(all(feature = "scan", feature = "api-12"))]
59#[cfg_attr(docsrs, doc(cfg(all(feature = "scan", feature = "api-12"))))]
60pub mod scan;
61
62#[cfg(all(feature = "scan", feature = "api-12"))]
63#[link(name = "ohscan")]
64unsafe extern "C" {}
65
66#[cfg(all(feature = "os-account", feature = "api-12"))]
67#[cfg_attr(docsrs, doc(cfg(all(feature = "os-account", feature = "api-12"))))]
68pub mod os_account;
69
70#[cfg(all(feature = "os-account", feature = "api-12"))]
71#[cfg_attr(docsrs, doc(cfg(all(feature = "os-account", feature = "api-12"))))]
72pub mod os_account_common;
73
74#[cfg(all(feature = "os-account", feature = "api-12"))]
75#[link(name = "os_account_ndk")]
76unsafe extern "C" {}
77
78#[cfg(all(feature = "time-service", feature = "api-12"))]
79#[cfg_attr(docsrs, doc(cfg(all(feature = "time-service", feature = "api-12"))))]
80pub mod time_service;
81
82#[cfg(all(feature = "time-service", feature = "api-12"))]
83#[link(name = "time_service_ndk")]
84unsafe extern "C" {}