1/* 2 * Copyright (c) 2021-2023 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 * @version 1.1 28 */ 29 30package ohos.hdi.sensor.v1_1; 31 32import ohos.hdi.sensor.v1_1.SensorTypes; 33 34/** 35 * @brief Defines the callback for reporting sensor data. This callback needs to be registered when 36 * a sensor user subscribes to sensor data. Only after the sensor is enabled, the sensor data subscriber can receive 37 * sensor data. For details, see {@link ISensorInterface}. 38 * 39 * @since 4.0 40 */ 41[callback] interface ISensorCallback { 42 /** 43 * @brief Defines the function for reporting sensor data. 44 * 45 * @since 2.2 46 */ 47 OnDataEvent([in] struct HdfSensorEvents event); 48} 49