1/* 2 * Copyright (c) 2022-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 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 MotionTypes.idl 30 * 31 * @brief Defines the data structures used by the motion module, including the motion types and reported motion data structure. 32 * 33 * @since 3.2 34 * @version 1.0 35 */ 36 37/** 38 * @brief Defines the package path of the motion driver module APIs. 39 * 40 * @since 3.2 41 */ 42package ohos.hdi.motion.v1_0; 43 44/** 45 * @brief Enumerates motion types. 46 * 47 * @since 3.2 48 */ 49enum HdfMotionTypeTag { 50 /** Pickup */ 51 HDF_MOTION_TYPE_PICKUP = 0, 52 /** Flip */ 53 HDF_MOTION_TYPE_FLIP, 54 /** Closing to the ear */ 55 HDF_MOTION_CLOSE_TO_EAR, 56 /** Shaking */ 57 HDF_MOTION_TYPE_SHAKE, 58 /** Screen rotation */ 59 HDF_MOTION_TYPE_ROTATION, 60 /** Pocket mode */ 61 HDF_MOTION_TYPE_POCKET_MODE, 62 /** Taking away from the ear */ 63 HDF_MOTION_TYPE_LEAVE_EAR, 64 /** Wrist-up */ 65 HDF_MOTION_TYPE_WRIST_UP, 66 /** Wrist-down */ 67 HDF_MOTION_TYPE_WRIST_DOWN, 68 /** Wave */ 69 HDF_MOTION_TYPE_WAVE, 70 /** Step counter */ 71 HDF_MOTION_TYPE_STEP_COUNTER, 72 /** Maximum motion type */ 73 HDF_MOTION_TYPE_MAX, 74}; 75 76/** 77 * @brief Defines the motion event data structure. 78 * 79 * The motion event data includes the motion type, motion result, motion status, length of motion data, and motion data. 80 * 81 * @since 3.2 82 */ 83struct HdfMotionEvent { 84 /** Provides the motion type. */ 85 int motion; 86 /** Provides the motion result. */ 87 int result; 88 /** Provides the motion status. */ 89 int status; 90 /** Provides the length of motion data. */ 91 int datalen; 92 /** Provides the motion data. */ 93 int [] data; 94}; 95/** @} */ 96