1/* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @addtogroup HdiSensor 18 * @{ 19 * 20 * @brief Provides unified APIs for sensor services to access sensor drivers. 21 * 22 * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to 23 * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, 24 * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, 25 * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. 26 * 27 * @since 5.1 28 * @version 3.0 29 */ 30 31package ohos.hdi.sensor.v3_0; 32 33import ohos.hdi.sensor.v3_0.SensorTypes; 34 35/** 36 * @brief Defines the callback for reporting sensor data. This callback needs to be registered when 37 * a sensor user subscribes to sensor data. Only after the sensor is enabled, the sensor data subscriber can receive 38 * sensor data. For details, see {@link ISensorInterface}. 39 * 40 * @since 5.1 41 * @version 3.0 42 */ 43[callback] interface ISensorCallback { 44 /** 45 * @brief Defines the function for reporting sensor data. 46 * @param event Indicates the information about sensor event in the system. 47 * 48 * @since 5.1 49 * @version 3.0 50 */ 51 OnDataEvent([in] struct HdfSensorEvents event); 52 /** 53 * @brief Defines the function for reporting sensor data. 54 * @param event Indicates the information about sensor event in the system. 55 * 56 * @since 5.1 57 * @version 3.0 58 */ 59 [oneway] OnDataEventAsync([in] struct HdfSensorEvents[] events); 60} 61