From 6e6282f72bfa88e68925c35c3d64f2baa68b6cd9 Mon Sep 17 00:00:00 2001 From: yangjunrui Date: Tue, 5 Jul 2022 16:59:39 +0800 Subject: [PATCH] feat: add motion hdi chinese annotation Signed-off-by: yangjunrui --- .../hdi/motion/v1_0/IMotionCallback.idl | 69 +++++++++++ .../hdi/motion/v1_0/IMotionInterface.idl | 107 ++++++++++++++++++ .../hdi/motion/v1_0/MotionTypes.idl | 91 +++++++++++++++ 3 files changed, 267 insertions(+) create mode 100755 zh-cn/device_api/hdi/motion/v1_0/IMotionCallback.idl create mode 100755 zh-cn/device_api/hdi/motion/v1_0/IMotionInterface.idl create mode 100755 zh-cn/device_api/hdi/motion/v1_0/MotionTypes.idl diff --git a/zh-cn/device_api/hdi/motion/v1_0/IMotionCallback.idl b/zh-cn/device_api/hdi/motion/v1_0/IMotionCallback.idl new file mode 100755 index 00000000..edb521d3 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_0/IMotionCallback.idl @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Motion + * @{ + * + * @brief 手势识别设备驱动对硬件服务提供通用的接口能力。 + * + * 模块提供硬件服务对手势识别驱动模块访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现使能手势识别/ + * 去使能手势识别、订阅/去订阅手势识别数据。 + * + * @since 3.2 + */ + +/** + * @file IMotionCallback.idl + * + * @brief 定义上报手势识别数据回调函数接口。 + * + * 在手势识别用户订阅手势识别数据时需要注册这个回调函数接口的实例。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 手势识别模块接口的包路径。 + * + * @since 3.2 + */ +package ohos.hdi.motion.v1_0; + +import ohos.hdi.motion.v1_0.MotionTypes; + +/** + * @brief 定义上报手势识别数据回调函数。 + * + * 手势识别用户在订阅手势识别数据时需要注册这个回调函数,只有当使能手势识别后,手势识别数据用户才会收到手势识别数据。 + * 详情可参考{@link IMotionInterface}。 + * + * @since 3.2 + */ +[callback] interface IMotionCallback { + /** + * @brief 定义上报手势识别数据回调函数。 + * + * @param event 回调函数上报的数据。详见{@link HdfMotionEvent}。 + * + * @return 如果回调函数上报数据成功,则返回0。 + * @return 如果回调函数上报数据失败,则返回负值。 + * + * @since 3.2 + */ + OnDataEvent([in] struct HdfMotionEvent event); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/motion/v1_0/IMotionInterface.idl b/zh-cn/device_api/hdi/motion/v1_0/IMotionInterface.idl new file mode 100755 index 00000000..e10a2fa3 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_0/IMotionInterface.idl @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Motion + * @{ + * + * @brief 手势识别设备驱动对硬件服务提供通用的接口能力。 + * + * 模块提供硬件服务对手势识别驱动模块访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现使能手势识别/ + * 去使能手势识别、订阅/去订阅手势识别数据。 + * + * @since 3.2 + */ + +/** + * @file IMotionInterface.idl + * + * @brief 定义使能/去使能手势识别、订阅/去订阅手势识别数据的接口。 + * + * 在实现拿起、翻转、摇一摇、旋转屏等手势识别功能时,需要调用此处定义的接口。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 手势识别模块接口的包路径。 + * + * @since 3.2 + */ +package ohos.hdi.motion.v1_0; + +import ohos.hdi.motion.v1_0.MotionTypes; +import ohos.hdi.motion.v1_0.IMotionCallback; + +/** + * @brief 提供Motion设备基本控制操作接口。 + * + * 接口提供使能/去使能手势识别、订阅/去订阅手势识别数据功能。 + */ +interface IMotionInterface { + /** + * @brief 使能手势识别。 + * + * @param motionType 手势识别类型,详见{@link HdfMotionTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + EnableMotion([in] int motionType); + + /** + * @brief 去使能手势识别。 + * + * @param motionType,手势识别类型,详见{@link HdfMotionTypeTag}。 + * + * @return 如果操作成功,则返回0。 + * @return 如果操作失败,则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + DisableMotion([in] int motionType); + + /** + * @brief 订阅者注册手势识别数据回调函数,如果注册成功,系统会将获取到的手势识别数据上报给订阅者。 + * + * @param callbackObj 要注册的回调函数,只需成功订阅一次,无需重复订阅。详见{@link IMotionCallback}。 + * + * @return 如果注册回调函数成功,则返回0。 + * @return 如果注册回调函数失败,则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + Register([in] IMotionCallback callbackObj); + + /** + * @brief 订阅者取消注册手势识别数据回调函数。 + * + * @param callbackObj 要取消注册的回调函数,只需成功取消订阅一次,无需重复取消订阅。详见{@link IMotionCallback}。 + * + * @return 如果取消注册回调函数成功,则返回0。 + * @return 如果取消注册回调函数失败,则返回负值。 + * + * @since 3.2 + * @version 1.0 + */ + Unregister([in] IMotionCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/zh-cn/device_api/hdi/motion/v1_0/MotionTypes.idl b/zh-cn/device_api/hdi/motion/v1_0/MotionTypes.idl new file mode 100755 index 00000000..247df302 --- /dev/null +++ b/zh-cn/device_api/hdi/motion/v1_0/MotionTypes.idl @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Motion + * @{ + * + * @brief 手势识别设备驱动对硬件服务提供通用的接口能力。 + * + * 模块提供硬件服务对手势识别驱动模块访问统一接口,服务获取驱动对象或者代理后,通过其提供的各类方法,实现使能手势识别/ + * 去使能手势识别、订阅/去订阅手势识别数据。 + * + * @since 3.2 + */ + +/** + * @file MotionTypes.idl + * + * @brief 定义手势识别模块用到的数据结构,包括手势识别类型、上报的手势识别数据结构。 + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief 手势识别模块接口的包路径。 + * + * @since 3.2 + */ +package ohos.hdi.motion.v1_0; + +/** + * @brief 枚举手势识别类型。 + * + * @since 3.2 + */ +enum HdfMotionTypeTag { + /** 拿起类型。 */ + HDF_MOTION_TYPE_PICKUP = 0, + /** 翻转类型。 */ + HDF_MOTION_TYPE_FLIP, + /** 靠近耳朵类型。 */ + HDF_MOTION_CLOSE_TO_EAR, + /** 摇一摇类型。 */ + HDF_MOTION_TYPE_SHAKE, + /** 旋转屏类型。 */ + HDF_MOTION_TYPE_ROTATION, + /** 口袋模式类型。 */ + HDF_MOTION_TYPE_POCKET_MODE, + /** 拿离耳朵类型。 */ + HDF_MOTION_TYPE_LEAVE_EAR, + /** 腕朝上类型。 */ + HDF_MOTION_TYPE_WRIST_UP, + /** 腕朝下类型。 */ + HDF_MOTION_TYPE_WRIST_DOWN, + /** 最大手势识别类型。*/ + HDF_MOTION_TYPE_MAX, +}; + +/** + * @brief 上报手势识别数据结构。 + * + * 上报手势识别数据事件信息包括手势识别类型、手势识别结果、手势识别状态、手势识别数据长度、手势识别数据。 + * + * @since 3.2 + */ +struct HdfMotionEvent { + /** 手势识别类型。 */ + int motion; + /** 手势识别结果。 */ + int result; + /** 手势识别状态。 */ + int status; + /** 手势识别数据长度。 */ + int datalen; + /** 手势识别数据。 */ + int [] data; +}; +/** @} */ \ No newline at end of file -- Gitee