1/* 2 * Copyright (c) 2022 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 Motion 18 * @{ 19 * 20 * @brief Provides common APIs for hardware services to access the motion driver module. 21 * 22 * A service can obtain a motion driver object or agent and then call APIs provided by this object or agent to 23 * enable or disable motion and subscribe to or unsubscribe from motion data. 24 * 25 * @since 3.2 26 */ 27 28/** 29 * @file IMotionCallback.idl 30 * 31 * @brief Defines the callback for reporting motion data. 32 * 33 * To subscribe to motion data, an instance of this callback must be registered. 34 * 35 * @since 3.2 36 * @version 1.0 37 */ 38 39/** 40 * @brief Defines the package path of the motion driver module APIs. 41 * 42 * @since 3.2 43 */ 44package ohos.hdi.motion.v1_0; 45 46import ohos.hdi.motion.v1_0.MotionTypes; 47 48/** 49 * @brief Defines the callback for reporting motion data. 50 * 51 * Motion users need to register this callback to subscribe to motion data and can receive the data only when motion is enabled. 52 * For details, see {@link IMotionInterface}. 53 * 54 * @since 3.2 55 */ 56[callback] interface IMotionCallback { 57 /** 58 * @brief Called to report motion data. 59 * 60 * @param event Motion data to report. For details, see {@link HdfMotionEvent}. 61 * 62 * @return Returns <b>0</b> if the operation is successful. 63 * @return Returns a negative value if the operation fails. 64 * 65 * @since 3.2 66 */ 67 OnDataEvent([in] struct HdfMotionEvent event); 68} 69/** @} */ 70