• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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 2.0
29 */
30
31package ohos.hdi.sensor.v2_1;
32
33import ohos.hdi.sensor.v2_0.SensorTypes;
34import ohos.hdi.sensor.v2_0.ISensorCallback;
35
36/**
37 * @brief Defines the callback for reporting sensor data. This callback needs to be registered when
38 * a sensor user subscribes to sensor data. Only after the sensor is enabled, the sensor data subscriber can receive
39 * sensor data. For details, see {@link ISensorInterface}.
40 *
41 * @since 5.1
42 * @version 1.1
43 */
44[callback] interface ISensorCallback extends ohos.hdi.sensor.v2_0.ISensorCallback {
45    /**
46    * @brief Defines the function for reporting sensor data.
47    * @param event Indicates the information about sensor event in the system.
48    *
49    * @since 1.0
50    * @version 1.0
51    */
52    [oneway] OnDataEventAsync([in] struct HdfSensorEvents[] events);
53}
54