From 6311562101372e0799eae12bdf3f578e8e86d8bb Mon Sep 17 00:00:00 2001 From: guowen666 Date: Thu, 24 Feb 2022 03:51:21 +0000 Subject: [PATCH] Add Input hdi interface definition Signed-off-by: guowen666 --- input/v1_0/BUILD.gn | 36 +++++++++++++ input/v1_0/IInputCallback.idl | 23 +++++++++ input/v1_0/IInputInterface.idl | 40 +++++++++++++++ input/v1_0/MyTypes.idl | 94 ++++++++++++++++++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 input/v1_0/BUILD.gn create mode 100644 input/v1_0/IInputCallback.idl create mode 100644 input/v1_0/IInputInterface.idl create mode 100644 input/v1_0/MyTypes.idl diff --git a/input/v1_0/BUILD.gn b/input/v1_0/BUILD.gn new file mode 100644 index 00000000..9882ef4c --- /dev/null +++ b/input/v1_0/BUILD.gn @@ -0,0 +1,36 @@ +# 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") +if (defined(ohos_lite)) { + group("libinput_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("input") { + package = "OHOS.HDI.input.v1_0" + + module_name = "input_service" + + sources = [ + "IInputCallback.idl", + "IInputInterface.idl", + "MyTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "input_device_driver" + } +} diff --git a/input/v1_0/IInputCallback.idl b/input/v1_0/IInputCallback.idl new file mode 100644 index 00000000..fa7dcd12 --- /dev/null +++ b/input/v1_0/IInputCallback.idl @@ -0,0 +1,23 @@ +/* + * 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.input.v1_0; + +import OHOS.HDI.input.v1_0.MyTypes; + +[callback] interface IInputCallback { + EventPkgCallback([in] struct EventPackage[] pkgs, [in] unsigned int count, [in] unsigned int devIndex); + HotPlugCallback([in] struct HotPlugEvent event); +} \ No newline at end of file diff --git a/input/v1_0/IInputInterface.idl b/input/v1_0/IInputInterface.idl new file mode 100644 index 00000000..68c9842d --- /dev/null +++ b/input/v1_0/IInputInterface.idl @@ -0,0 +1,40 @@ +/* + * 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.input.v1_0; + +import OHOS.HDI.input.v1_0.IInputCallback; +import OHOS.HDI.input.v1_0.MyTypes; + +interface IInputInterface { + ScanInputDevice([out] struct DevDesc staArr, [in] unsigned int arrLen); + OpenInputDevice([in] unsigned int devIndex); + CloseInputDevice([in] unsigned int devIndex); + GetInputDevice([in] unsigned int devIndex, [out] struct DeviceInfo[] devInfo); + GetInputDeviceList([in] unsigned int devNum, [out] struct DeviceInfo[] devList, [in]unsigned int size); + SetPowerStatus([in] unsigned int devIndex, [in] unsigned int status); + GetPowerStatus([in] unsigned int devIndex, [out] unsigned int status); + GetDeviceType([in] unsigned int devIndex, [out] unsigned int deviceType); + GetChipInfo([in] unsigned int devIndex, [out] String chipInfo, [in] unsigned int length); + GetVendorName([in] unsigned int devIndex, [out] String vendorName, [in] unsigned int length); + GetChipName([in] unsigned int devIndex, [out] String chipName, [in] unsigned int length); + SetGestureMode([in] unsigned int devIndex, [in] unsigned int gestureMode); + RunCapacitanceTest([in] unsigned int devIndex, [in] unsigned int testType, [out] String result, [in] unsigned int length); + RunExtraCommand([in] unsigned int devIndex, [in] struct InputExtraCmd cmd); + RegisterReportCallback([in] unsigned int devIndex, [in] IInputCallback eventPkgCallback); + UnregisterReportCallback([in] unsigned int devIndex); + RegisterHotPlugCallback([in] IInputCallback hotPlugCallback); + UnregisterHotPlugCallback(); +} \ No newline at end of file diff --git a/input/v1_0/MyTypes.idl b/input/v1_0/MyTypes.idl new file mode 100644 index 00000000..db457241 --- /dev/null +++ b/input/v1_0/MyTypes.idl @@ -0,0 +1,94 @@ +/* + * 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.input.v1_0; + +struct DevDesc { + unsigned int devIndex; + unsigned int devType; +}; + +struct InputDevIdentify { + unsigned short busType; + unsigned short vendor; + unsigned short product; + unsigned short version; +}; + +struct DimensionInfo { + int axis; + int min; + int max; + int fuzz; + int flat; + int range; +}; + +struct DevAttr { + String devName; + struct InputDevIdentify id; + struct DimensionInfo axisInfo; +}; + +struct DevAbility { + unsigned long devProp; + unsigned long eventType; + unsigned long absCode; + unsigned long relCode; + unsigned long keyCode; + unsigned long ledCode; + unsigned long miscCode; + unsigned long soundCode; + unsigned long forceCode; + unsigned long switchCode; + unsigned long keyType; + unsigned long ledType; + unsigned long soundType; + unsigned long switchType; +}; + +struct DeviceInfo { + unsigned int devIndex; /**< Device index */ + unsigned int devType; /**< Device type */ + String chipInfo; /**< Driver chip information */ + String vendorName; /**< Module vendor name */ + String chipName; /**< Driver chip name */ + struct DevAttr attrSet; + struct DevAbility abilitySet; +}; + +/** + * @brief Describes the extra commands. + */ +struct InputExtraCmd { + String cmdCode; /**< Command code */ + String cmdValue; /**< Data transmitted in the command */ +}; + +struct HotPlugEvent { + unsigned int devIndex; + unsigned int devType; + unsigned int status; +}; + +/** + * @brief Describes the input event data package. + */ +struct EventPackage { + unsigned int type; /**< Type of the input event */ + unsigned int code; /**< Specific code item of the input event */ + int value; /**< Value of the input event code item */ + unsigned long timestamp; /**< Timestamp of the input event */ +}; -- Gitee