Expand description
Ohos-sys
This crate provides Raw FFI bindings to the native API of OpenHarmonyOS (target_env = "ohos").
Each module corresponds to one OpenHarmony API feature, and is gated behind a cargo feature.
If you are an application developer, you probably do not want to use this crate directly,
and instead want to use a higher-level API built on top of this crate.
Note: There are currently still quite a few missing bindings, which will slowly be added.
§Feature flags
abilitykit— Enables bindings to the AbilitKit. Re-exports theohos-abilitykit-syslibrary.accesstoken— Enables bindings to the AbilityAccessControl (AccessToken) NDK. Re-exportsohos-accesstoken-sys.arkui— Enables bindings to the native ArkUI module. Re-exports thearkui-syslibrary.asset-store— Enables bindings to the AssetStoreKit (Asset NDK). Re-exportsohos-asset-store-sys.basic-services-kit— Enables bindings to BasicServicesKit. Re-exportsohos-basic-services-kit-sys. Use the sub-API features (basic-services-kit-commonevent, …) to select individual NDKs within the kit.basic-services-kit-commonevent— Enables the CommonEvent NDK from BasicServicesKit.basic-services-kit-battery-info— Enables the BatteryInfo NDK from BasicServicesKit. Requires API-level 13.basic-services-kit-print— Enables the Print NDK from BasicServicesKit.basic-services-kit-scan— Enables the Scan NDK from BasicServicesKit.basic-services-kit-os-account— Enables the OS Account NDK from BasicServicesKit.basic-services-kit-time-service— Enables the Time Service NDK from BasicServicesKit.crypto— Enables bindings to the CryptoArchitectureKit. Re-exportsohos-crypto-sys.huks— Enables bindings to the Universal Keystore Kit (HUKS). Re-exportsohos-huks-sys.deviceinfo— Enables bindings todeviceinfo.h. Re-exportsohos-deviceinfo-sysdrawing— Enables bindings tonative_drawing. Re-exportsohos-drawing-sys.hilog— Enables bindings tohiloghitrace— Enables bindings tohitraceinputmethod— Enables bindings toinputmethodfrom the IME-Kit. Empty if API-level < 12.ipckit— Enables bindings to the IPCKit framework.locationkit— Enables bindings to the LocationKit framework.netmanager— Enables bindings to the NetworkKit netmanager framework.net_ssl— Enables bindings to the NetworkKit net_ssl framework.netstack— Enables bindings to the NetworkKit netstack framework.image-kit— Bindings to the Image Kitmedia— Bindings to the Media framework (Player / Recorder / Transcoder, AVCodec, demuxer / muxer, screen capture, low-power AV sinks). Re-exportsohos-media-sys.video-processing-engine— Bindings to the VideoProcessingEngine subsystem (GPU-accelerated colour space conversion, HDR metadata, scaling). Re-exportsohos-video-processing-engine-sys. Usevideo-processing-engine-video-processing/video-processing-engine-image-processingto select individual modules.multimodal-input— Bindings to the Multimodal Input kit.ohaudio— Enables bindings to the OHAudio module.web— Enables bindings to the Web module.napi— Enables bindings tonapinative_buffer— Enables bindings tonative_buffernative_image— Enables bindings tonative_imagenative_window— Enables bindings tonative_windowpasteboard— Enables to the ohos pasteboard (clipboard)qos— Enables bindings to the QoS thread scheduling APIs (and at api-20+ the Gewu on-device LLM inference APIs that sharelibqos.so).rawfile— Enables bindings torawfilerdb— Enables bindings to the relational database (RDB)sensors— Enables bindings to the sensors module.udmf— Enables bindings to the Unified Data Management Framework (UDMF)vsync— Enables bindings tonative_vsyncxcomponent— Enables bindings tonative_xcomponentwindow_manager— Enables bindings towindow_managerall-components— Enables all components listed above. Orthogonal toapi-XXfeatures.
§OpenHarmony API level
This crate by default exposes bindings for API-level 10.
Optionally enable one of the api-* features to get access to bindings for newer
OpenHarmony versions.
api-10(enabled by default) — No effect. API-10 bindings can’t be deselected. The feature exists for internal purposes.api-11— Enables bindings for OpenHarmony API-level 11api-12— Enables bindings for OpenHarmony API-level 12api-13— Enables bindings for OpenHarmony API-level 13api-14— Enables bindings for OpenHarmony API-level 14api-15— Enables bindings for OpenHarmony API-level 15api-16— Enables bindings for OpenHarmony API-level 16.api-17— Enables bindings for OpenHarmony API-level 17.api-18— Enables bindings for OpenHarmony API-level 18 (5.1.0).api-19— Enables bindings for OpenHarmony API-level 19api-20— Enables bindings for OpenHarmony API-level 20api-21— Enables bindings for OpenHarmony API-level 21api-22— Enables bindings for OpenHarmony API-level 22api-23— Enables bindings for OpenHarmony API-level 23
§Features of dependencies
Re-exports features of individual component crates of ohos-sys.
In general, it is recommended to depend on the individual component crates
§Internal features
document-features— Document available features when building the documentation
Re-exports§
pub use arkui_sys as arkui;arkuipub use ohos_asset_store_sys as asset_store;asset-storepub use ohos_basic_services_kit_sys as basic_services_kit;basic-services-kitpub use ohos_crypto_sys as crypto;cryptopub use ohos_deviceinfo_sys as deviceinfo;deviceinfopub use ohos_drawing_sys as drawing;drawingpub use hilog_sys as hilog;hilogpub use ohos_huks_sys as huks;hukspub use hitrace_sys as hitrace;hitracepub use ohos_ime_sys as inputmethod;inputmethodpub use ohaudio_sys as ohaudio;ohaudiopub use arkweb_sys as web;webpub use ohos_ipckit_sys as ipckit;ipckitpub use ohos_locationkit_sys as locationkit;locationkitpub use ohos_netmanager_sys as netmanager;netmanagerpub use ohos_net_ssl_sys as net_ssl;net_sslpub use ohos_netstack_sys as netstack;netstackpub use ohos_input_sys as multimodal_input;multimodal-inputpub use ohos_abilitykit_sys as abilitykit;abilitykitpub use ohos_pasteboard_sys as pasteboard;pasteboardpub use ohos_rawfile_sys as rawfile;rawfilepub use ohos_rdb_sys as rdb;rdbpub use ohos_sensors_sys as sensors;sensorspub use udmf_sys as udmf;udmfpub use ohos_vsync_sys as vsync;vsyncpub use xcomponent_sys as xcomponent;xcomponentpub use ohos_window_manager_sys as window_manager;window_manager
Modules§
- multimedia
- napi
napi - native_
buffer native_buffer - Native Buffer bindings
- native_
image native_image - Bindings to
native_image - native_
window native_window - Native Window bindings
- syscap
- Bindings to check a devices system capabilites at runtime