ohos-sensors-sys 0.1.0

Rust bindings to the sensors and vibrator modules of OpenHarmony
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::sensor_type::*;

extern "C" {
    /// Obtains information about all sensors on the device.
    ///
    /// # Arguments
    ///
    /// * `infos` - - Double pointer to the information about all sensors on the device.
    /// For details, see [`Sensor_Info`].
    ///
    /// * `count` - - Pointer to the number of sensors on the device.
    ///
    /// # Returns
    ///
    /// * Returns <b>SENSOR_SUCCESS</b> if the operation is successful; returns the following error code otherwise.
    /// [`SENSOR_PARAMETER_ERROR`] Parameter check failed. For example, the parameter is invalid,
    /// or the parameter type passed in is incorrect.
    ///
    /// [`SENSOR_SERVICE_EXCEPTION`] The sensor service is abnormal.
    ///
    ///
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_Sensor_GetInfos(infos: *mut *mut Sensor_Info, count: *mut u32) -> Sensor_Result;
    /// Subscribes to sensor data. The system will report sensor data to the subscriber at the specified frequency.
    /// If you need to apply for the ohos.permission.ACCELEROMETER permission when subscribing to the accelerometer sensor,
    /// you need to apply for the ohos.permission.GYROSCOPE permission when subscribing to the gyroscope sensor, and you need
    /// to apply for the ohos.permission.ACTIVITY_MOTION permission when subscribing to the pedometer related sensor. Apply
    /// for ohos.permission.READ_HEALTH_DATA permission when subscribing to health-related sensors, such as heart rate
    /// sensors, otherwise the subscription fails. Other sensors do not require permissions.
    ///
    /// # Arguments
    ///
    /// * `id` - - Pointer to the sensor subscription ID. For details, see [`Sensor_SubscriptionId`].
    ///
    /// * `attribute` - - Pointer to the subscription attribute, which is used to specify the data reporting frequency.
    /// For details, see [`Sensor_SubscriptionAttribute`].
    ///
    /// * `subscriber` - - Pointer to the subscriber information, which is used to specify the callback function for
    /// reporting the sensor data. For details, see [`Sensor_Subscriber`].
    ///
    /// # Returns
    ///
    /// * Returns <b>SENSOR_SUCCESS</b> if the operation is successful; returns the following error code otherwise.
    /// [`SENSOR_PERMISSION_DENIED`] Permission verification failed.
    ///
    /// [`SENSOR_PARAMETER_ERROR`] Parameter check failed. For example, the parameter is invalid,
    /// or the parameter type passed in is incorrect.
    ///
    /// [`SENSOR_SERVICE_EXCEPTION`] The sensor service is abnormal.
    ///
    /// ohos.permission.ACCELEROMETER or ohos.permission.GYROSCOPE or
    /// ohos.permission.ACTIVITY_MOTION or ohos.permission.READ_HEALTH_DATA
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_Sensor_Subscribe(
        id: *const Sensor_SubscriptionId,
        attribute: *const Sensor_SubscriptionAttribute,
        subscriber: *const Sensor_Subscriber,
    ) -> Sensor_Result;
    /// Unsubscribes from sensor data.
    /// If you need to apply for the ohos.permission.ACCELEROMETER permission to unsubscribe from the accelerometer sensor,
    /// you need to request the ohos.permission.GYROSCOPE permission to unsubscribe from the gyroscope sensor, and you need
    /// to request the ohos.permission.ACTIVITY_MOTION permission to unsubscribe from the pedometer-related sensor. When you
    /// unsubscribe from health-related sensors, such as heart rate sensors, apply for ohos.permission.READ_HEALTH_DATA
    /// permissions, otherwise the subscription will fail. Other sensors do not require permissions.
    ///
    /// # Arguments
    ///
    /// * `id` - - Pointer to the sensor subscription ID. For details, see [`Sensor_SubscriptionId`].
    ///
    /// * `subscriber` - - Pointer to the subscriber information, which is used to specify the callback function for
    /// reporting the sensor data. For details, see [`Sensor_Subscriber`].
    ///
    /// # Returns
    ///
    /// * Returns <b>SENSOR_SUCCESS</b> if the operation is successful; returns the following error code otherwise.
    /// [`SENSOR_PERMISSION_DENIED`] Permission verification failed.
    ///
    /// [`SENSOR_PARAMETER_ERROR`] Parameter check failed. For example, the parameter is invalid,
    /// or the parameter type passed in is incorrect.
    ///
    /// [`SENSOR_SERVICE_EXCEPTION`] The sensor service is abnormal.
    ///
    /// ohos.permission.ACCELEROMETER or ohos.permission.GYROSCOPE or
    /// ohos.permission.ACTIVITY_MOTION or ohos.permission.READ_HEALTH_DATA
    ///
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_Sensor_Unsubscribe(
        id: *const Sensor_SubscriptionId,
        subscriber: *const Sensor_Subscriber,
    ) -> Sensor_Result;
}