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