diff --git a/motion/bundle.json b/motion/bundle.json new file mode 100644 index 0000000000000000000000000000000000000000..a4a28869101b2e9ff407a7c82f0df7eb4e498051 --- /dev/null +++ b/motion/bundle.json @@ -0,0 +1,42 @@ +{ + "name": "motion_device_driver_interface", + "description": "motion device driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "motion_device_driver_interface", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "675KB", + "ram": "1024KB", + "deps": { + "components": [ + "ipc", + "device_driver_framework", + "hiviewdfx_hilog_native", + "utils_base" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/interface/motion/v1_0:libmotion_proxy_1.0" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/motion/v1_0:libmotion_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/motion" + } + } + ] + } + } + } \ No newline at end of file diff --git a/motion/v1_0/BUILD.gn b/motion/v1_0/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e696f14db8dc9ef939b2437da8dc11d2c5f5a01d --- /dev/null +++ b/motion/v1_0/BUILD.gn @@ -0,0 +1,27 @@ +# 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. + +import("//drivers/adapter/uhdf2/hdi.gni") +hdi("motion") { + module_name = "motion_service" + + sources = [ + "IMotionCallback.idl", + "IMotionInterface.idl", + "MotionTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "motion_device_driver" +} diff --git a/motion/v1_0/IMotionCallback.idl b/motion/v1_0/IMotionCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..2538f4cc4b400784c839667abeffdaeb160f315a --- /dev/null +++ b/motion/v1_0/IMotionCallback.idl @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package ohos.hdi.motion.v1_0; + +import ohos.hdi.motion.v1_0.MotionTypes; + +[callback] interface IMotionCallback { + /** + * @brief Defines the function for reporting sensor data. + * + * @since 3.2 + */ + OnDataEvent([in] struct HdfMotionEvent event); +} \ No newline at end of file diff --git a/motion/v1_0/IMotionInterface.idl b/motion/v1_0/IMotionInterface.idl new file mode 100644 index 0000000000000000000000000000000000000000..5705c58c6b6801ccf03bf031a8d132c205f9b6d1 --- /dev/null +++ b/motion/v1_0/IMotionInterface.idl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package ohos.hdi.motion.v1_0; + +import ohos.hdi.motion.v1_0.MotionTypes; +import ohos.hdi.motion.v1_0.IMotionCallback; + +interface IMotionInterface { + EnableMotion([in] int motionType); + DisableMotion([in] int motionType); + Register([in] IMotionCallback callbackObj); + Unregister([in] IMotionCallback callbackObj); +} \ No newline at end of file diff --git a/motion/v1_0/MotionTypes.idl b/motion/v1_0/MotionTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..e7c0656fa90ba251d3ea4a90ce57bf57f08fc1df --- /dev/null +++ b/motion/v1_0/MotionTypes.idl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package ohos.hdi.motion.v1_0; + +enum HdfMotionTypeTag { + HDF_MOTION_TYPE_PICKUP = 1, + HDF_MOTION_TYPE_FLIP, + HDF_MOTION_CLOSE_TO_EAR, + HDF_MOTION_TYPE_LEAVE_EAR, + HDF_MOTION_TYPE_SHAKE, + HDF_MOTION_TYPE_ROTATION, + HDF_MOTION_TYPE_POCKET_MODE, + HDF_MOTION_TYPE_WRIST_UP, + HDF_MOTION_TYPE_WRIST_DOWN, + HDF_MOTION_TYPE_MAX, +}; + +struct HdfMotionEvent { + int motion; + int result; + int status; + int datalen; + int [] data; +}; \ No newline at end of file