Skip to main content

ohos_basic_services_kit_sys/battery_info/
battery_info_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6
7/// A string that identifies the common event sent after battery capacity changes.
8///
9/// Available since API-level: 13
10///
11/// Version: 1.0
12#[cfg(feature = "api-13")]
13#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
14pub const COMMON_EVENT_KEY_CAPACITY: &::core::ffi::CStr = c"soc";
15/// A string that identifies the common event sent after charge state changes.
16///
17/// Available since API-level: 13
18///
19/// Version: 1.0
20#[cfg(feature = "api-13")]
21#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
22pub const COMMON_EVENT_KEY_CHARGE_STATE: &::core::ffi::CStr = c"chargeState";
23/// A string that identifies the common event sent after plugged type changes.
24///
25/// Available since API-level: 13
26///
27/// Version: 1.0
28#[cfg(feature = "api-13")]
29#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
30pub const COMMON_EVENT_KEY_PLUGGED_TYPE: &::core::ffi::CStr = c"pluggedType";
31#[cfg(feature = "api-13")]
32#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
33impl BatteryInfo_BatteryPluggedType {
34    /// Power source is unplugged.
35    pub const PLUGGED_TYPE_NONE: BatteryInfo_BatteryPluggedType = BatteryInfo_BatteryPluggedType(0);
36    /// Power source is an AC charger.
37    pub const PLUGGED_TYPE_AC: BatteryInfo_BatteryPluggedType = BatteryInfo_BatteryPluggedType(1);
38    /// Power source is a USB DC charger.
39    pub const PLUGGED_TYPE_USB: BatteryInfo_BatteryPluggedType = BatteryInfo_BatteryPluggedType(2);
40    /// Power source is wireless charger.
41    pub const PLUGGED_TYPE_WIRELESS: BatteryInfo_BatteryPluggedType =
42        BatteryInfo_BatteryPluggedType(3);
43    /// The bottom of the enum.
44    pub const PLUGGED_TYPE_BUTT: BatteryInfo_BatteryPluggedType = BatteryInfo_BatteryPluggedType(4);
45}
46#[repr(transparent)]
47/// Defines plugged types.
48///
49///
50/// Available since API-level: 13
51///
52/// Version: 1.0
53#[cfg(feature = "api-13")]
54#[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
55#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
56pub struct BatteryInfo_BatteryPluggedType(pub ::core::ffi::c_uint);
57extern "C" {
58    /// This API returns the current battery capacity.
59    ///
60    ///
61    /// # Returns
62    ///
63    /// * Returns number between 0 and 100.
64    ///
65    /// Available since API-level: 13
66    #[cfg(feature = "api-13")]
67    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
68    pub fn OH_BatteryInfo_GetCapacity() -> i32;
69    /// This API returns the current plugged type.
70    ///
71    ///
72    /// # Returns
73    ///
74    /// * [`BatteryInfo_BatteryPluggedType#PLUGGED_TYPE_NONE`] if the power source is unplugged.
75    /// [`PLUGGED_TYPE_AC`] if the power source is an AC charger.
76    /// [`PLUGGED_TYPE_USB`] if the power source is an USB DC charger.
77    /// [`PLUGGED_TYPE_WIRELESS`] if the power source is wireless charger.
78    /// [`PLUGGED_TYPE_BUTT`] if the type is unknown.
79    ///
80    /// Available since API-level: 13
81    #[cfg(feature = "api-13")]
82    #[cfg_attr(docsrs, doc(cfg(feature = "api-13")))]
83    pub fn OH_BatteryInfo_GetPluggedType() -> BatteryInfo_BatteryPluggedType;
84}