From 1795c9faa4d988f68238c2d03142a1bb14ff866f Mon Sep 17 00:00:00 2001 From: xiaosi Date: Thu, 4 Jan 2024 20:15:15 +0800 Subject: [PATCH 001/210] feat:add new hdi interface for network optimization Signed-off-by: xiaosi --- wlan/v1_2/IWlanInterface.idl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/wlan/v1_2/IWlanInterface.idl b/wlan/v1_2/IWlanInterface.idl index 89d0b15f..e10bf61b 100644 --- a/wlan/v1_2/IWlanInterface.idl +++ b/wlan/v1_2/IWlanInterface.idl @@ -83,5 +83,35 @@ interface IWlanInterface extends ohos.hdi.wlan.v1_1.IWlanInterface { * @version 1.2 */ RegisterActionFrameReceiver([in] String ifName, [in] unsigned char[] match); + + /** + * @brief set power save manager mode. + * + * @param ifName Indicates the NIC name. + * @param frequency Indicates connected ap frequency. + * @param mode Indicates power save mode, 3(enable power save), 4(disable power save). + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.2 + */ + SetPowerSaveMode([in] String ifName, [in] int frequency, [in] int mode); + + /** + * @brief set data packet identification mark rule. + * + * @param uid Indicates target app uid. + * @param protocol Indicates target protocol type, tcp/udp. + * @param enable Indicates enable/disable dpi mark rule. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.2 + */ + SetDpiMarkRule([in] int uid, [in] int protocol, [in] int enable); } /** @} */ -- Gitee From 86b9195f1a289aa18e7d0e4ae28889bd388367f8 Mon Sep 17 00:00:00 2001 From: liuxiyao223 Date: Tue, 9 Jan 2024 10:41:39 +0800 Subject: [PATCH 002/210] =?UTF-8?q?HDI=E9=80=9A=E7=94=A8=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=8B=E5=8F=91=E4=B8=8E=E4=BA=8B=E4=BB=B6=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3(2/3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuxiyao223 Change-Id: I6e50e450a052bf872a7bb37bbb82f9d1c17ba6cf --- wlan/hostapd/v1_0/IHostapdCallback.idl | 11 +++++++++ wlan/hostapd/v1_0/IHostapdInterface.idl | 14 ++++++++++++ wlan/wpa/v1_0/IWpaCallback.idl | 22 ++++++++++++++++++ wlan/wpa/v1_0/IWpaInterface.idl | 30 ++++++++++++++++++++++++- wlan/wpa/v1_0/WpaTypes.idl | 13 +++++++++++ 5 files changed, 89 insertions(+), 1 deletion(-) diff --git a/wlan/hostapd/v1_0/IHostapdCallback.idl b/wlan/hostapd/v1_0/IHostapdCallback.idl index e050a2c0..3e200644 100644 --- a/wlan/hostapd/v1_0/IHostapdCallback.idl +++ b/wlan/hostapd/v1_0/IHostapdCallback.idl @@ -77,4 +77,15 @@ import ohos.hdi.wlan.hostapd.v1_0.HostapdTypes; * @version 1.0 */ OnEventApState([in] struct HdiApCbParm apCbParm, [in] String ifName); + + /** + * Used to handle Hostapd callback parameters + * + * @param notifyParam Indicates the paramerter of Hostapd. + * @param ifName Indicates the NIC name. + * + * @since 4.1 + * @version 1.0 + */ + OnEventHostApdNotify([in] String notifyParam, [in] String ifName); } diff --git a/wlan/hostapd/v1_0/IHostapdInterface.idl b/wlan/hostapd/v1_0/IHostapdInterface.idl index 8efe8dfe..d852c506 100644 --- a/wlan/hostapd/v1_0/IHostapdInterface.idl +++ b/wlan/hostapd/v1_0/IHostapdInterface.idl @@ -299,4 +299,18 @@ interface IHostapdInterface { * @version 1.0 */ UnregisterEventCallback([in] IHostapdCallback cbFunc, [in] String ifName); + + /** + * @brief Used to process cmd of Hostapd + * + * @param ifName Indicates the NIC name. + * @param cmd Indicates command of HostApd from WifiHal + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + HostApdShellCmd([in] String ifName, [in] String cmd); } diff --git a/wlan/wpa/v1_0/IWpaCallback.idl b/wlan/wpa/v1_0/IWpaCallback.idl index 899d583e..b87214a0 100644 --- a/wlan/wpa/v1_0/IWpaCallback.idl +++ b/wlan/wpa/v1_0/IWpaCallback.idl @@ -339,4 +339,26 @@ import ohos.hdi.wlan.wpa.v1_0.WpaTypes; * @version 1.0 */ OnEventIfaceCreated([in] struct HdiP2pIfaceCreatedParam ifaceCreatedParam, [in] String ifName); + + /** + * Used to indicate STA authentication reject + * + * @param authRejectParam Indicates the paramerter of auth reject. + * @param ifName Indicates the NIC name. + * + * @since 4.1 + * @version 1.0 + */ + OnEventAuthReject([in] struct HdiWpaAuthRejectParam authRejectParam, [in] String ifName); + + /** + * Used to handle STA callback parameters + * + * @param notifyParam Indicates the paramerter of Sta. + * @param cmd Indicates command of Sta from WifiHal. + * + * @since 4.1 + * @version 1.0 + */ + OnEventStaNotify([in] String notifyParam, [in] String ifName); } \ No newline at end of file diff --git a/wlan/wpa/v1_0/IWpaInterface.idl b/wlan/wpa/v1_0/IWpaInterface.idl index ecfa54dc..ba53d76a 100644 --- a/wlan/wpa/v1_0/IWpaInterface.idl +++ b/wlan/wpa/v1_0/IWpaInterface.idl @@ -1146,5 +1146,33 @@ import ohos.hdi.wlan.wpa.v1_0.IWpaCallback; * @version 1.0 */ P2pSaveConfig([in] String ifName); - + + /** + * @brief Reassociate in wpa supplicant. + * + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + Reassociate([in] String ifName); + + /** + * @brief STA CMD in wpa supplicant. + * + * @param ifName Indicates the NIC name. + * @param cmd Indicates command of Sta from WifiHal + * Example: If CMD is "SET external_sim 1", then + * the final result is "external_sim=1". + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + StaShellCmd([in] String ifName, [in] String cmd); } \ No newline at end of file diff --git a/wlan/wpa/v1_0/WpaTypes.idl b/wlan/wpa/v1_0/WpaTypes.idl index 118b82d3..51105ffd 100644 --- a/wlan/wpa/v1_0/WpaTypes.idl +++ b/wlan/wpa/v1_0/WpaTypes.idl @@ -450,4 +450,17 @@ struct HdiP2pStaConnectStateParam { struct HdiP2pIfaceCreatedParam { int isGo; +}; + +/** + * @brief STA authentication rejection parameter + * + * @since 4.1 + * @version 1.0 + */ +struct HdiWpaAuthRejectParam { + unsigned char[] bssid; + unsigned short authType; + unsigned short authTransaction; + unsigned short statusCode; }; \ No newline at end of file -- Gitee From 24e6772d2732492fa764b3ea928be6ee8b25d1d1 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Fri, 26 Jan 2024 11:17:17 +0800 Subject: [PATCH 003/210] fix alarm Signed-off-by: luzhiye --- camera/metadata/src/camera_metadata_info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 845d4a54..63a873da 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -28,7 +28,7 @@ static CameraVendorTag* g_vendorTagImpl = nullptr; const char* g_exampleVendorTagLib = "libcamera_example_vendor_tag_impl.z.so"; const char* g_vendorTagLib = "libcamera_vendor_tag_impl.z.so"; const int METADATA_HEADER_DATA_SIZE = 4; -const std::vector g_metadataTags = { +const std::vector g_metadataTags = { OHOS_ABILITY_CAMERA_POSITION, OHOS_ABILITY_CAMERA_TYPE, OHOS_ABILITY_CAMERA_CONNECTION_TYPE, -- Gitee From 350a953affe55f8164e9210475e27c235cc32abb Mon Sep 17 00:00:00 2001 From: yiicen Date: Fri, 26 Jan 2024 17:33:00 +0800 Subject: [PATCH 004/210] =?UTF-8?q?=E9=81=B5=E5=BE=AA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=EF=BC=8Cnew[]=E5=92=8Cdelete[]=E6=88=90?= =?UTF-8?q?=E5=AF=B9=E4=BD=BF=E7=94=A8=20Signed-off-by:=20yiicen=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- display/composer/command_pack/command_data_packer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/display/composer/command_pack/command_data_packer.h b/display/composer/command_pack/command_data_packer.h index d049cc30..5d7fe40e 100644 --- a/display/composer/command_pack/command_data_packer.h +++ b/display/composer/command_pack/command_data_packer.h @@ -40,7 +40,7 @@ public: ~CommandDataPacker() { if (data_ != nullptr) { - delete data_; + delete[] data_; } } @@ -205,7 +205,7 @@ private: newData = nullptr; return false; } - delete data_; + delete[] data_; data_ = newData; packSize_ = newSize; } -- Gitee From 789a7c70abe4b5e4d2c8f9ee7e3f1f37d2bacf00 Mon Sep 17 00:00:00 2001 From: hxf233333 Date: Fri, 26 Jan 2024 15:58:47 +0800 Subject: [PATCH 005/210] fix: add runninglock callback Signed-off-by: hxf233333 --- power/v1_1/BUILD.gn | 1 + power/v1_1/IPowerInterface.idl | 49 +++++++++++++++++++ power/v1_1/IPowerRunningLockCallback.idl | 62 ++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 power/v1_1/IPowerRunningLockCallback.idl diff --git a/power/v1_1/BUILD.gn b/power/v1_1/BUILD.gn index 09d4bb47..2b0bc947 100644 --- a/power/v1_1/BUILD.gn +++ b/power/v1_1/BUILD.gn @@ -24,6 +24,7 @@ if (defined(ohos_lite)) { sources = [ "IPowerHdiCallback.idl", "IPowerInterface.idl", + "IPowerRunningLockCallback.idl", "PowerTypes.idl", "RunningLockTypes.idl", ] diff --git a/power/v1_1/IPowerInterface.idl b/power/v1_1/IPowerInterface.idl index cc9e73cb..c508ddda 100755 --- a/power/v1_1/IPowerInterface.idl +++ b/power/v1_1/IPowerInterface.idl @@ -41,6 +41,7 @@ package ohos.hdi.power.v1_1; +import ohos.hdi.power.v1_1.IPowerRunningLockCallback; import ohos.hdi.power.v1_1.IPowerHdiCallback; import ohos.hdi.power.v1_1.PowerTypes; import ohos.hdi.power.v1_1.RunningLockTypes; @@ -161,5 +162,53 @@ interface IPowerInterface { * @since 4.1 */ GetWakeupReason([out] String reason); + + /** + * @brief Holds the running lock to block device hibernation. + * + * @param extra Running lock info. + * + * @return Returns HDF_SUCCESS if the operation is successful; returns HDF_FAILED if the + * running lock type conflicts with current lock. + * + * @since 4.1 + * @deprecated + */ + HoldRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName); + + /** + * @brief Unholds the running lock to unblock device hibernation. + * + * @param extra Running lock info. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 4.1 + * @deprecated + */ + UnholdRunningLockExt([in] struct RunningLockInfo info, [in] unsigned long lockid, [in] String bundleName); + + /** + * @brief Registers the callback of the running lock status. + * + * @param iPowerRunningLockCallback Callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @see IPowerRunningLockCallback + * + * @since 4.1 + * @deprecated + */ + RegisterRunningLockCallback([in] IPowerRunningLockCallback iPowerRunningLockCallback); + + /** + * @brief Unregister the callback of the running lock status. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * + * @since 4.1 + * @deprecated + */ + UnRegisterRunningLockCallback(); } /** @} */ diff --git a/power/v1_1/IPowerRunningLockCallback.idl b/power/v1_1/IPowerRunningLockCallback.idl new file mode 100644 index 00000000..555f99e2 --- /dev/null +++ b/power/v1_1/IPowerRunningLockCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 power + * @{ + * + * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, + * and managing running locks. + * + * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform + * hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks. + * + * @since 3.1 + * @version 1.0 + */ + + /** + * @file IPowerRunningLockCallback.idl + * + * @brief Provides the callbacks of the running lock status. + * + * The power module provides callbacks for the power service to handle the running lock status. + * + * @since 4.1 + * @version 1.1 + */ + +package ohos.hdi.power.v1_1; + +/** + * @brief Represents the callbacks of the running lock status. + * + * After creating a callback object, the power service can call {@link IPowerInterface} to register a callback to + * subscribe to running lock status changes. + * + * @since 4.1 + */ +[callback] interface IPowerRunningLockCallback { + /** + * @brief Callback of running lock state. + * + * This callback is used to notify the power service when the device enters the running lock state. + * + * @since 4.1 + * @deprecated + */ + HandleRunningLockMessage([in] String message); +} +/** @} */ \ No newline at end of file -- Gitee From d43f418aef6b77e0abba0c7f66b5d4dcfb144822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A4=9A=E6=99=A8=E8=BE=89?= <734222381@qq.com> Date: Thu, 1 Feb 2024 11:32:39 +0800 Subject: [PATCH 006/210] delete syscap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 褚晨辉 <734222381@qq.com> --- location/agnss/bundle.json | 1 - location/gnss/bundle.json | 1 - 2 files changed, 2 deletions(-) diff --git a/location/agnss/bundle.json b/location/agnss/bundle.json index 86b29ada..e93eb941 100644 --- a/location/agnss/bundle.json +++ b/location/agnss/bundle.json @@ -12,7 +12,6 @@ "component": { "name": "drivers_interface_location_agnss", "subsystem": "hdf", - "syscap": [ "SystemCapability.Location.Location.Gnss" ], "adapted_system_type": [ "standard" ], diff --git a/location/gnss/bundle.json b/location/gnss/bundle.json index 22676de2..212fc282 100644 --- a/location/gnss/bundle.json +++ b/location/gnss/bundle.json @@ -12,7 +12,6 @@ "component": { "name": "drivers_interface_location_gnss", "subsystem": "hdf", - "syscap": [ "SystemCapability.Location.Location.Gnss" ], "adapted_system_type": [ "standard" ], -- Gitee From c9546fb07b0c07a312e4963259ffd2627205600b Mon Sep 17 00:00:00 2001 From: AnXiang Date: Fri, 2 Feb 2024 13:53:52 +0800 Subject: [PATCH 007/210] add StartSessionWithParams interface and update version number Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/BUILD.gn | 27 +++++ bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl | 80 ++++++++++++++ .../a2dp/v1_1/IBluetoothAudioCallback.idl | 74 +++++++++++++ .../a2dp/v1_1/IBluetoothAudioSession.idl | 100 ++++++++++++++++++ bluetooth/bundle.json | 27 ++++- 5 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 bluetooth/a2dp/v1_1/BUILD.gn create mode 100644 bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl create mode 100644 bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl create mode 100644 bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl diff --git a/bluetooth/a2dp/v1_1/BUILD.gn b/bluetooth/a2dp/v1_1/BUILD.gn new file mode 100644 index 00000000..f47fa4cb --- /dev/null +++ b/bluetooth/a2dp/v1_1/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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("bluetooth_a2dp") { + module_name = "bluetooth_a2dp" + + sources = [ + "BluetoothAudioTypes.idl", + "IBluetoothAudioCallback.idl", + "IBluetoothAudioSession.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_bluetooth" +} diff --git a/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl new file mode 100644 index 00000000..7ccad563 --- /dev/null +++ b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl @@ -0,0 +1,80 @@ +/* + * 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 HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio subsystem. + * + * @since 4.0 + */ + +/* + * @file BluetoothAudioTypes.idl + * + * @brief Defines the data structure. + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.bluetooth.a2dp.v1_1; + +/* + * @brief Defines the operation. + * + * @since 4.0 + */ +enum Operation { + SUSPEND_RENDER = 0, + START_RENDER = 1, +}; + +/* + * @brief Defines the operation result of the interface. + * + * @since 4.0 + */ +enum Status { + SUCCESS = 0, + FAILURE = 1, +}; + +/* + * @brief Defines the type of audio session. + * + * @since 4.0 + */ +enum SessionType { + UNKNOWN_TYPE, + SOFTWARE_ENCODING, + HARDWARE_ENCODING, +}; + +/** + * @brief Defines the start session parameters information. + * + * @since 4.1 + */ +struct StartSessionParams { + /** type of audio session */ + enum SessionType sessionType; + /** audio pcm encoding sample rate */ + unsigned int sampleRate; +}; \ No newline at end of file diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl new file mode 100644 index 00000000..1f722432 --- /dev/null +++ b/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl @@ -0,0 +1,74 @@ +/* + * 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 HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio subsystem. + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioCallback.idl + * + * @brief Defines the callback function, including the start, suspend, stop operations from audio. + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.bluetooth.a2dp.v1_1; + +/** + * @brief Defines the callback function to start, suspend, stop audio render. + * + * @since 4.0 + */ +[callback] interface IBluetoothAudioCallback { + /** + * @brief Start audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + StartRender(); + + /** + * @brief Suspend audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + SuspendRender(); + + /** + * @brief Stop audio render callback function. + * + * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + StopRender(); +} diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl new file mode 100644 index 00000000..24ad30c0 --- /dev/null +++ b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl @@ -0,0 +1,100 @@ +/* + * 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 HdiA2dp + * @{ + * + * @brief Provides unified APIs for the A2DP service. + * + * The Host can use the interface provided by the module to create an audio session, + * and exchange data with the audio. + * + * @since 4.0 + */ + +/** + * @file IBluetoothAudioSession.idl + * + * @brief Defines the interfaces to start audio session, send render operation result, + * and stop the audio session. + * + * @since 4.0 + * @version 1.1 + */ + +package ohos.hdi.bluetooth.a2dp.v1_1; + +import ohos.hdi.bluetooth.a2dp.v1_1.IBluetoothAudioCallback; +import ohos.hdi.bluetooth.a2dp.v1_1.BluetoothAudioTypes; + +/** + * @brief Defines the interfaces to start audio session, send render operation result, + * and stop the audio session. + * + * @since 4.0 + */ +interface IBluetoothAudioSession { + /** + * @brief Start audio session and register the callback function. + * + * @param sessionType Indicates the session type. + * @param callbackObj Indicates the callback function. For details, see {@link IBluetoothAudioCallback}. + * @param queue Returns sharedMemQueue for audio data. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + StartSession([in] enum SessionType sessionType, [in] IBluetoothAudioCallback callbackObj, + [out] SharedMemQueue queue); + + /** + * @brief Start audio session and register the callback function. + * + * @param params Indicates the start session parameters. For details, see {@link BluetoothAudioTypes}. + * @param callbackObj Indicates the callback function. For details, see {@link IBluetoothAudioCallback}. + * @param queue Returns sharedMemQueue for audio data. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.1 + * @version 1.1 + */ + StartSessionWithParams([in] struct StartSessionParams params, [in] IBluetoothAudioCallback callbackObj, + [out] SharedMemQueue queue); + + /** + * @brief Stop audio session. + * + * @param sessionType Indicates the session type. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + StopSession([in] enum SessionType sessionType); + + /** + * @brief send the render operation result. + * + * @param operation Indicates the render operation. + * @param Status SUCCESS or FAILURE for operation. + * @return Returns 0 if the operation is successfully; returns a negative value otherwise. + * + * @since 4.0 + * @version 1.1 + */ + RenderOperationResult([in] enum Operation operation, [in] enum Status status); +} diff --git a/bluetooth/bundle.json b/bluetooth/bundle.json index 37b23705..cdbbf6b2 100644 --- a/bluetooth/bundle.json +++ b/bluetooth/bundle.json @@ -27,7 +27,8 @@ "build": { "sub_component": [ "//drivers/interface/bluetooth/hci/v1_0:bluetooth_hci_idl_target", - "//drivers/interface/bluetooth/a2dp/v1_0:bluetooth_a2dp_idl_target" + "//drivers/interface/bluetooth/a2dp/v1_0:bluetooth_a2dp_idl_target", + "//drivers/interface/bluetooth/a2dp/v1_1:bluetooth_a2dp_idl_target" ], "test": [ ], @@ -56,6 +57,30 @@ "header_base": "//drivers/interface/bluetooth/hci" } }, + { + "name": "//drivers/interface/bluetooth/a2dp/v1_1:libbluetooth_a2dp_proxy_1.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/a2dp" + } + }, + { + "name": "//drivers/interface/bluetooth/a2dp/v1_1:libbluetooth_a2dp_stub_1.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/a2dp" + } + }, + { + "name": "//drivers/interface/bluetooth/a2dp/v1_1:bluetooth_a2dp_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/a2dp" + } + }, { "name": "//drivers/interface/bluetooth/a2dp/v1_0:libbluetooth_a2dp_proxy_1.0", "header": { -- Gitee From 4158d03a48d29bca48013eb713b22d0bd4ab5377 Mon Sep 17 00:00:00 2001 From: maoyong Date: Sun, 4 Feb 2024 02:53:46 +0000 Subject: [PATCH 008/210] add nnrt ops for v2.1 Signed-off-by: maoyong --- nnrt/bundle.json | 27 ++- nnrt/v2_1/BUILD.gn | 28 +++ nnrt/v2_1/INnrtDevice.idl | 40 ++++ nnrt/v2_1/IPreparedModel.idl | 24 ++ nnrt/v2_1/ModelTypes.idl | 52 +++++ nnrt/v2_1/NnrtTypes.idl | 294 ++++++++++++++++++++++++ nnrt/v2_1/NodeAttrTypes.idl | 429 +++++++++++++++++++++++++++++++++++ 7 files changed, 893 insertions(+), 1 deletion(-) create mode 100644 nnrt/v2_1/BUILD.gn create mode 100644 nnrt/v2_1/INnrtDevice.idl create mode 100644 nnrt/v2_1/IPreparedModel.idl create mode 100644 nnrt/v2_1/ModelTypes.idl create mode 100644 nnrt/v2_1/NnrtTypes.idl create mode 100644 nnrt/v2_1/NodeAttrTypes.idl diff --git a/nnrt/bundle.json b/nnrt/bundle.json index 1f80d475..c2741324 100644 --- a/nnrt/bundle.json +++ b/nnrt/bundle.json @@ -26,7 +26,8 @@ "build": { "sub_component": [ "//drivers/interface/nnrt/v1_0:nnrt_idl_target", - "//drivers/interface/nnrt/v2_0:nnrt_idl_target" + "//drivers/interface/nnrt/v2_0:nnrt_idl_target", + "//drivers/interface/nnrt/v2_1:nnrt_idl_target" ], "test": [ ], @@ -78,6 +79,30 @@ ], "header_base": "//drivers/interface/nnrt" } + }, + { + "name": "//drivers/interface/nnrt/v2_1:libnnrt_proxy_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/nnrt" + } + }, + { + "name": "//drivers/interface/nnrt/v2_1:libnnrt_stub_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/nnrt" + } + }, + { + "name": "//drivers/interface/nnrt/v2_1:nnrt_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/nnrt" + } } ] } diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn new file mode 100644 index 00000000..17f1dc57 --- /dev/null +++ b/nnrt/v2_1/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("nnrt") { + module_name = "nnrt" + sources = [ + "INnrtDevice.idl", + "IPreparedModel.idl", + "ModelTypes.idl", + "NnrtTypes.idl", + "NodeAttrTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_nnrt" +} diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl new file mode 100644 index 00000000..46450cda --- /dev/null +++ b/nnrt/v2_1/INnrtDevice.idl @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; +import ohos.hdi.nnrt.v2_1.ModelTypes; +import ohos.hdi.nnrt.v2_1.IPreparedModel; + +interface INnrtDevice { + GetDeviceName([out] String name); + GetVendorName([out] String name); + GetDeviceType([out] enum DeviceType deviceType); + GetDeviceStatus([out] enum DeviceStatus status); + GetSupportedOperation([in] struct Model model, [out] boolean[] ops); + IsFloat16PrecisionSupported([out] boolean isSupported); + IsPerformanceModeSupported([out] boolean isSupported); + IsPrioritySupported([out] boolean isSupported); + IsDynamicInputSupported([out] boolean isSupported); + PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + IsModelCacheSupported([out] boolean isSupported); + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); + ReleaseBuffer([in] struct SharedBuffer buffer); +} \ No newline at end of file diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl new file mode 100644 index 00000000..b568b4fe --- /dev/null +++ b/nnrt/v2_1/IPreparedModel.idl @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; + +interface IPreparedModel { + ExportModelCache([out] struct SharedBuffer[] modelCache); + GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); + Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); +} \ No newline at end of file diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl new file mode 100644 index 00000000..e463cf6b --- /dev/null +++ b/nnrt/v2_1/ModelTypes.idl @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; + +struct Tensor { + String name; + enum DataType dataType; + int[] dims; + enum Format format; + struct SharedBuffer data; + struct QuantParam[] quantParams; +}; + +struct Node { + String name; + enum NodeType nodeType; + byte[] nodeAttr; + unsigned int[] inputIndex; + unsigned int[] outputIndex; + enum QuantType quantType; +}; + +struct SubGraph { + String name; + unsigned int[] inputIndices; + unsigned int[] outputIndices; + unsigned int[] nodeIndices; +}; + +struct Model { + String name; + unsigned int[] inputIndex; + unsigned int[] outputIndex; + struct Node[] nodes; + struct Tensor[] allTensors; + struct SubGraph[] subGraph; +}; \ No newline at end of file diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl new file mode 100644 index 00000000..a270e842 --- /dev/null +++ b/nnrt/v2_1/NnrtTypes.idl @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +struct SharedBuffer { + FileDescriptor fd; + unsigned int bufferSize; + unsigned int offset; + unsigned int dataSize; +}; + +enum DeviceType: int { + OTHER, + CPU, + GPU, + ACCELERATOR +}; + +enum DeviceStatus: int { + AVAILABLE, + BUSY, + OFFLINE, + UNKNOWN +}; + +enum PerformanceMode: int { + PERFORMANCE_NONE, + PERFORMANCE_LOW, + PERFORMANCE_MEDIUM, + PERFORMANCE_HIGH, + PERFORMANCE_EXTREME +}; + +enum Priority: int { + PRIORITY_NONE, + PRIORITY_LOW, + PRIORITY_MEDIUM, + PRIORITY_HIGH +}; + +struct ModelConfig { + boolean enableFloat16; + enum PerformanceMode mode; + enum Priority priority; + Map extensions; +}; + +enum Format : byte { + FORMAT_NONE = -1, + FORMAT_NCHW = 0, + FORMAT_NHWC = 1 +}; + +struct QuantParam { + int numBits; + int zeroPoint; + double scale; +}; + +enum DataType : byte { + DATA_TYPE_UNKNOWN = 0, + DATA_TYPE_BOOL = 30, + DATA_TYPE_INT8 = 32, + DATA_TYPE_INT16 = 33, + DATA_TYPE_INT32 = 34, + DATA_TYPE_INT64 = 35, + DATA_TYPE_UINT8 = 37, + DATA_TYPE_UINT16 = 38, + DATA_TYPE_UINT32 = 39, + DATA_TYPE_UINT64 = 40, + DATA_TYPE_FLOAT16 = 42, + DATA_TYPE_FLOAT32 = 43, + DATA_TYPE_FLOAT64 = 44, +}; + +struct IOTensor { + String name; + enum DataType dataType; + int[] dimensions; + enum Format format; + struct SharedBuffer data; +}; + +enum QuantType: byte { + QUANT_TYPE_NONE, + QUANT_TYPE_ALL, +}; + +/** + * @brief Enumerates types of the extended stream information. + */ +enum NodeType : unsigned int { + NODE_TYPE_NONE = 0, + NODE_TYPE_ABS = 1, + NODE_TYPE_ACTIVATION = 2, + NODE_TYPE_ADD_FUSION = 5, + NODE_TYPE_ARGMAX_FUSION = 11, + NODE_TYPE_AVGPOOL_FUSION = 17, + NODE_TYPE_BATCH_TO_SPACE_ND = 22, + NODE_TYPE_BIAS_ADD = 23, + NODE_TYPE_BROADCAST_TO = 27, + NODE_TYPE_CAST = 28, + NODE_TYPE_CLIP = 30, + NODE_TYPE_CONCAT = 31, + NODE_TYPE_CONV2D_FUSION = 35, + NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, + NODE_TYPE_CONSTANT_OF_SHAPE = 38, + NODE_TYPE_DEPTH_TO_SPACE = 45, + NODE_TYPE_DIV_FUSION = 47, + NODE_TYPE_ELTWISE = 52, + NODE_TYPE_EQUAL = 53, + NODE_TYPE_EXPFUSION = 55, + NODE_TYPE_EXPAND_DIMS = 56, + NODE_TYPE_FLATTEN = 61, + NODE_TYPE_FILL = 66, + NODE_TYPE_FULL_CONNECTION = 67, + NODE_TYPE_FUSED_BATCH_NORM = 68, + NODE_TYPE_GATHER = 69, + NODE_TYPE_GREATER = 71, + NODE_TYPE_GREATER_EQUAL = 72, + NODE_TYPE_INSTANCE_NORM = 74, + NODE_TYPE_LAYER_NORM_FUSION = 75, + NODE_TYPE_LEAKY_RELU = 76, + NODE_TYPE_LESS = 77, + NODE_TYPE_LESS_EQUAL = 78, + NODE_TYPE_LSTM = 87, + NODE_TYPE_MATMUL_FUSION = 89, + NODE_TYPE_MAXIMUM = 90, + NODE_TYPE_MAX_POOL_FUSION = 92, + NODE_TYPE_MUL_FUSION = 99, + NODE_TYPE_NOT_EQUAL = 103, + NODE_TYPE_ONE_HOT = 105, + NODE_TYPE_PAD_FUSION = 107, + NODE_TYPE_POW_FUSION = 110, + NODE_TYPE_PRELU_FUSION = 112, + NODE_TYPE_QUANT_DTYPE_CAST = 113, + NODE_TYPE_RANGE = 115, + NODE_TYPE_REAL_DIV = 117, + NODE_TYPE_REDUCE_FUSION = 118, + NODE_TYPE_RESHAPE = 119, + NODE_TYPE_RESIZE = 120, + NODE_TYPE_RSQRT = 126, + NODE_TYPE_SCALE_FUSION = 127, + NODE_TYPE_SHAPE = 130, + NODE_TYPE_SLICE_FUSION = 135, + NODE_TYPE_SOFTMAX = 138, + NODE_TYPE_SPACE_TO_BATCH_ND = 141, + NODE_TYPE_SPLIT = 145, + NODE_TYPE_SQRT = 146, + NODE_TYPE_SQUEEZE = 147, + NODE_TYPE_SQUARE = 148, + NODE_TYPE_SQUARED_DIFFERENCE = 149, + NODE_TYPE_STACK = 150, + NODE_TYPE_STRIDED_SLICE = 151, + NODE_TYPE_SUB_FUSION = 152, + NODE_TYPE_TILE_FUSION = 160, + NODE_TYPE_TOPK_FUSION = 161, + NODE_TYPE_TRANSPOSE = 162, + NODE_TYPE_UNSQUEEZE = 165, + NODE_TYPE_UNSTACK = 166, + NODE_TYPE_SELECT = 170, + NODE_TYPE_ERF = 178, +}; + +enum ResizeMethod : byte { + RESIZE_METHOD_UNKNOWN = -1, + RESIZE_METHOD_LINEAR = 0, + RESIZE_METHOD_NEAREST = 1, + RESIZE_METHOD_CUBIC = 2 +}; + +enum CoordinateTransformMode : byte { + COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, + COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, + COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 +}; + +enum NearestMode : byte { + NEAREST_MODE_NORMAL = 0, + NEAREST_MODE_ROUND_HALF_DOWN = 1, + NEAREST_MODE_ROUND_HALF_UP = 2, + NEAREST_MODE_FLOOR = 3, + NEAREST_MODE_CEIL = 4 +}; + +enum ActivationType : byte { + ACTIVATION_TYPE_NO_ACTIVATION = 0, + ACTIVATION_TYPE_RELU = 1, + ACTIVATION_TYPE_SIGMOID = 2, + ACTIVATION_TYPE_RELU6 = 3, + ACTIVATION_TYPE_ELU = 4, + ACTIVATION_TYPE_LEAKY_RELU = 5, + ACTIVATION_TYPE_ABS = 6, + ACTIVATION_TYPE_RELU1 = 7, + ACTIVATION_TYPE_SOFTSIGN = 8, + ACTIVATION_TYPE_SOFTPLUS = 9, + ACTIVATION_TYPE_TANH = 10, + ACTIVATION_TYPE_SELU = 11, + ACTIVATION_TYPE_HSWISH = 12, + ACTIVATION_TYPE_HSIGMOID = 13, + ACTIVATION_TYPE_THRESHOLDRELU = 14, + ACTIVATION_TYPE_LINEAR = 15, + ACTIVATION_TYPE_HARD_TANH = 16, + ACTIVATION_TYPE_SIGN = 17, + ACTIVATION_TYPE_SWISH = 18, + ACTIVATION_TYPE_GELU = 19, + ACTIVATION_TYPE_UNKNOWN = 20 +}; + +enum ReduceMode : byte { + REDUCE_MODE_MEAN = 0, + REDUCE_MODE_MAX = 1, + REDUCE_MODE_MIN = 2, + REDUCE_MODE_PROD = 3, + REDUCE_MODE_SUM = 4, + REDUCE_MODE_SUM_SQUARE = 5, + REDUCE_MODE_ASUM = 6, + REDUCE_MODE_ALL = 7 +}; + +enum EltwiseMode : byte { + ELTWISE_MODE_PROD = 0, + ELTWISE_MODE_SUM = 1, + ELTWISE_MODE_MAXIMUM = 2, + ELTWISE_MODE_UNKNOWN = 3 +}; + +enum PadMode : byte { + PAD_MODE_PAD = 0, + PAD_MODE_SAME = 1, + PAD_MODE_VALID = 2, +}; + +enum RoundMode : byte { + ROUND_MODE_FLOOR = 0, + ROUND_MODE_CEIL = 1 +}; + +enum PaddingMode : byte { + PADDING_MODE_CONSTANT = 0, + PADDING_MODE_REFLECT = 1, + PADDING_MODE_SYMMETRIC = 2, + PADDING_MODE_RESERVED = 3 +}; + +enum NNRT_ReturnCode : unsigned int { + NNRT_SUCCESS = 0, + NNRT_FAILED = 1, + NNRT_NULL_PTR = 2, + NNRT_INVALID_PARAMETER = 3, + NNRT_MEMORY_ERROR = 4, + NNRT_OUT_OF_MEMORY = 5, + NNRT_OPERATION_FORBIDDEN = 6, + NNRT_INVALID_FILE = 7, + NNRT_INVALID_PATH = 8, + NNRT_INSUFFICIENT_BUFFER = 9, + NNRT_NO_CHANGE = 10, + NNRT_NOT_SUPPORT = 11, + NNRT_SERVICE_ERROR = 12, + NNRT_DEVICE_ERROR = 13, + NNRT_DEVICE_BUSY = 14, + NNRT_CANCELLED = 15, + NNRT_PERMISSION_DENIED = 16, + NNRT_TIME_OUT = 17, + NNRT_INVALID_TENSOR = 18, + NNRT_INVALID_NODE = 19, + NNRT_INVALID_INPUT = 20, + NNRT_INVALID_OUTPUT = 21, + NNRT_INVALID_DATATYPE = 22, + NNRT_INVALID_FORMAT = 23, + NNRT_INVALID_TENSOR_NAME = 24, + NNRT_INVALID_SHAPE = 25, + NNRT_OUT_OF_DIMENTION_RANGES = 26, + NNRT_INVALID_BUFFER = 27, + NNRT_INVALID_BUFFER_SIZE = 28, + NNRT_INVALID_PERFORMANCE_MODE = 29, + NNRT_INVALID_PRIORITY = 30, + NNRT_INVALID_MODEL = 31, + NNRT_INVALID_MODEL_CACHE = 32, + NNRT_UNSUPPORTED_OP = 33 +}; \ No newline at end of file diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl new file mode 100644 index 00000000..c6962ecf --- /dev/null +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -0,0 +1,429 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; + +struct Abs +{ +}; + +struct Activation +{ + enum ActivationType activationType; + float alpha; + float minVal; + float maxVal; + boolean approximate; +}; + +struct AddFusion +{ + enum ActivationType activationType; +}; + +struct ArgMaxFusion +{ + long axis; + long topK; + boolean keepDims; + boolean outMaxValue; +}; + +struct AvgPoolFusion +{ + long[] kernelSize; + long[] strides; + long[] pad; + enum PadMode padMode; + enum RoundMode roundMode; + enum Format format; + boolean global; + enum ActivationType activationType; +}; + +struct BatchToSpaceND +{ + long[] blockShape; + long[][] crops; +}; + +struct BiasAdd +{ +}; + +struct BroadcastTo +{ + long[] shape; +}; + +struct Cast +{ +}; + +struct Clip +{ + float max; + float min; +}; + +struct Concat +{ + long axis; +}; + +struct Conv2DFusion +{ + long[] kernelSize; + long[] stride; + long[] dilation; + enum PadMode padMode; + long[] padList; + long group; + long inChannel; + long outChannel; + enum ActivationType activationType; +}; + +struct Conv2dTransposeFusion +{ + long[] kernelSize; + long[] stride; + long[] dilation; + enum PadMode padMode; + long[] padList; + long group; + long inChannel; + long outChannel; + enum ActivationType activationType; + long[] outputPaddings; +}; + +struct ConstantOfShape +{ + long data_type; + float[] value; +}; + +struct DepthToSpace +{ + long block_size; + enum Format format; + String mode; +}; + +struct DivFusion +{ + enum ActivationType activationType; +}; + +struct Eltwise +{ + enum EltwiseMode mode; +}; + +struct Equal +{ +}; + +struct ExpFusion +{ + float base; + float scale; + float shift; +}; + +struct ExpandDims +{ +}; + +struct Flatten +{ + long axis; +}; + +struct Fill +{ +}; + +struct FullConnection +{ + boolean hasBias; + boolean useAxis; + long axis; + enum ActivationType activationType; +}; + +struct FusedBatchNorm +{ + float epsilon; +}; + +struct Gather +{ +}; + +struct Greater +{ +}; + +struct GreaterEqual +{ +}; + +struct InstanceNorm +{ + float epsilon; +}; + +struct LayerNormFusion +{ + long beginNormAxis; + float epsilon; + boolean elementwiseAffine; + long beginParamsAxis; +}; + +struct LeakyRelu +{ + float negative_slope; +}; + +struct Less +{ +}; + +struct LessEqual +{ +}; + +struct LSTM +{ + boolean bidirectional; + boolean has_bias; + long input_size; + long hidden_size; + long num_layers; + long num_directions; + float dropout; + float zoneout_cell; + float zoneout_hidden; + long proj_size; +}; + +struct MatMulFusion +{ + boolean transposeA; + boolean transposeB; + enum ActivationType activationType; +}; + +struct Maximum +{ +}; + +struct MaxPoolFusion +{ + long[] kernelSize; + long[] strides; + long[] pad; + enum PadMode padMode; + enum Format format; + enum RoundMode roundMode; + boolean global; + enum ActivationType activationType; +}; + +struct MulFusion +{ + enum ActivationType activationType; +}; + +struct NotEqual +{ +}; + +struct OneHot +{ + long axis; +}; + +struct PadFusion +{ + long[][] paddings; + enum PaddingMode paddingMode; + float constantValue; +}; + +struct PowFusion +{ + float scale; + float shift; +}; + +struct PReLUFusion +{ + boolean channelShared; +}; + +struct QuantDTypeCast +{ + long srcT; + long dstT; +}; + +struct Range +{ + long d_type; + long start; + long limit; + long delta; +}; + +struct RealDiv +{ +}; + +struct ReduceFusion +{ + boolean keepDims; + enum ReduceMode mode; + boolean reduceToEnd; + float coeff; +}; + +struct Reshape +{ +}; + +struct Resize +{ + enum ResizeMethod method; + long newHeight; + long newWidth; + boolean preserveAspectRatio; + enum CoordinateTransformMode coordinateTransformMode; + float cubicCoeff; + long excludeOutside; + float extrapolationValue; + enum NearestMode nearestMode; +}; + +struct Rsqrt +{ +}; + +struct ScaleFusion +{ + long axis; + enum ActivationType activationType; +}; + +struct Shape +{ +}; + +struct SliceFusion +{ + long[] axes; +}; + +struct Softmax +{ + long[] axis; +}; + +struct SpaceToBatchND +{ + long[] blockShape; + long[][] paddings; +}; + +struct Split +{ + long outputNum; + long[] sizeSplits; + long axis; +}; + +struct Sqrt +{ +}; + +struct Square +{ +}; + +struct SquaredDifference +{ +}; + +struct Squeeze +{ + long[] axis; +}; + +struct Stack +{ + long axis; +}; + +struct StridedSlice +{ + long beginMask; + long endMask; + long ellipsisMask; + long newAxisMask; + long shrinkAxisMask; +}; + +struct SubFusion +{ + enum ActivationType activationType; +}; + +struct TileFusion +{ + long[] dims; +}; + +struct TopKFusion +{ + boolean sorted; + long axis; +}; + +struct Transpose +{ +}; + +struct Unsqueeze +{ + long[] axis; +}; + +struct Unstack +{ + long axis; +}; + +struct Select +{ +}; + +struct Erf +{ +}; \ No newline at end of file -- Gitee From a7ac69ecaa6e49fe36c93cd26cadbf1ccc2f1461 Mon Sep 17 00:00:00 2001 From: maoyong Date: Sun, 4 Feb 2024 11:20:46 +0800 Subject: [PATCH 009/210] update copyright date Signed-off-by: maoyong --- nnrt/v2_1/INnrtDevice.idl | 2 +- nnrt/v2_1/IPreparedModel.idl | 2 +- nnrt/v2_1/ModelTypes.idl | 2 +- nnrt/v2_1/NnrtTypes.idl | 2 +- nnrt/v2_1/NodeAttrTypes.idl | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl index 46450cda..ed45e918 100644 --- a/nnrt/v2_1/INnrtDevice.idl +++ b/nnrt/v2_1/INnrtDevice.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl index b568b4fe..98643e38 100644 --- a/nnrt/v2_1/IPreparedModel.idl +++ b/nnrt/v2_1/IPreparedModel.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl index e463cf6b..cb20b456 100644 --- a/nnrt/v2_1/ModelTypes.idl +++ b/nnrt/v2_1/ModelTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index a270e842..cc28a7a0 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index c6962ecf..9269731b 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From 039f42fe9067641aaa5c35df1a9b069a928c7b3d Mon Sep 17 00:00:00 2001 From: AnXiang Date: Sun, 4 Feb 2024 06:43:47 +0000 Subject: [PATCH 010/210] update bluetooth/a2dp/v1_1/BUILD.gn. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/a2dp/v1_1/BUILD.gn b/bluetooth/a2dp/v1_1/BUILD.gn index f47fa4cb..8de0f223 100644 --- a/bluetooth/a2dp/v1_1/BUILD.gn +++ b/bluetooth/a2dp/v1_1/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 -- Gitee From e19d33931c088d4db3003be06e36c330f32effae Mon Sep 17 00:00:00 2001 From: AnXiang Date: Sun, 4 Feb 2024 06:44:47 +0000 Subject: [PATCH 011/210] update bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl index 7ccad563..eaf47aea 100644 --- a/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl +++ b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From 72166211fb3418514d2c7e6425cd6324d41671c5 Mon Sep 17 00:00:00 2001 From: AnXiang Date: Sun, 4 Feb 2024 06:45:16 +0000 Subject: [PATCH 012/210] update bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl index 1f722432..2469c08e 100644 --- a/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl +++ b/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From a0fbff798a0779c6578dc680863768f7c9a964b5 Mon Sep 17 00:00:00 2001 From: AnXiang Date: Sun, 4 Feb 2024 06:46:18 +0000 Subject: [PATCH 013/210] update bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl index 24ad30c0..2e33a5d6 100644 --- a/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl +++ b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From dad6d9ba663984e95706590ae1c587c2f9c3ef25 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Mon, 5 Feb 2024 09:40:08 +0800 Subject: [PATCH 014/210] =?UTF-8?q?fix:=20=E6=9E=84=E9=80=A0=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=B8=AD=E9=9C=80=E8=A6=81=E9=87=8D=E7=BD=AEVSYNC?= =?UTF-8?q?=E4=BD=BF=E8=83=BD=E8=AE=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fan-jingle --- .../v1_0/hdi_impl/display_composer_hdi_impl.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 6b524d63..8ac590e3 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -76,7 +76,9 @@ public: vBlankCb_(nullptr), hotPlugCbData_(nullptr), vBlankCbData_(nullptr), - recipient_(nullptr) {} + recipient_(nullptr) { + vsyncEnableCount_.clear(); + } virtual ~DisplayComposerHdiImpl() { @@ -213,11 +215,11 @@ public: virtual int32_t SetDisplayVsyncEnabled(uint32_t devId, bool enabled) override { COMPOSER_CHECK_NULLPTR(hdi_); - static std::unordered_map vsyncEnableCount; /* Already enabled, return success */ - if (enabled && vsyncEnableCount[devId] > 0) { - ++vsyncEnableCount[devId]; + if (enabled && vsyncEnableCount_[devId] > 0) { + HDF_LOGD("%{public}s: Count[%{public}u] = %{public}u, Skip", __func__, devId, vsyncEnableCount_[devId]); + ++vsyncEnableCount_[devId]; return DISPLAY_SUCCESS; } @@ -226,7 +228,7 @@ public: return ret; } - vsyncEnableCount[devId] = enabled ? 1 : 0; + vsyncEnableCount_[devId] = enabled ? 1 : 0; return ret; } @@ -569,6 +571,7 @@ protected: void *hotPlugCbData_; void *vBlankCbData_; sptr recipient_; + std::unordered_map vsyncEnableCount_; }; using HdiDisplayComposer = DisplayComposerHdiImpl; } // namespace V1_0 -- Gitee From fd52522f07d76c9282a483b67bcc773958f13d13 Mon Sep 17 00:00:00 2001 From: zhanghang133 Date: Mon, 5 Feb 2024 10:01:52 +0800 Subject: [PATCH 015/210] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E4=B9=89met?= =?UTF-8?q?adata=E6=94=AF=E6=8C=81=E7=9A=84=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghang133 --- camera/metadata/src/metadata_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index cf0b5ff3..8791a44d 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -24,7 +24,7 @@ if (cond) { \ } static constexpr uint32_t MAX_SUPPORTED_TAGS = 1000; -static constexpr uint32_t MAX_SUPPORTED_ITEMS = 6000; +static constexpr uint32_t MAX_SUPPORTED_ITEMS = 12000; static constexpr uint32_t MAX_ITEM_CAPACITY = (1000 * 10); static constexpr uint32_t MAX_DATA_CAPACITY = (1000 * 10 * 10); -- Gitee From e31346c119e4a228f887cbfb6af39a281584f60e Mon Sep 17 00:00:00 2001 From: maoyong Date: Mon, 5 Feb 2024 11:32:29 +0800 Subject: [PATCH 016/210] update v2_1 nnrt definition Signed-off-by: maoyong --- nnrt/v2_1/BUILD.gn | 6 +- nnrt/v2_1/INnrtDevice.idl | 40 ----- nnrt/v2_1/IPreparedModel.idl | 24 --- nnrt/v2_1/ModelTypes.idl | 52 ------ nnrt/v2_1/NnrtTypes.idl | 254 +---------------------------- nnrt/v2_1/NodeAttrTypes.idl | 299 +---------------------------------- 6 files changed, 6 insertions(+), 669 deletions(-) delete mode 100644 nnrt/v2_1/INnrtDevice.idl delete mode 100644 nnrt/v2_1/IPreparedModel.idl delete mode 100644 nnrt/v2_1/ModelTypes.idl diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index 17f1dc57..3e2e4914 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -14,10 +14,10 @@ import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("nnrt") { module_name = "nnrt" + imports = [ + "ohos.hdi.nnrt.v2_0:nnrt" + ] sources = [ - "INnrtDevice.idl", - "IPreparedModel.idl", - "ModelTypes.idl", "NnrtTypes.idl", "NodeAttrTypes.idl", ] diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl deleted file mode 100644 index ed45e918..00000000 --- a/nnrt/v2_1/INnrtDevice.idl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2024 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.nnrt.v2_1; - -import ohos.hdi.nnrt.v2_1.NnrtTypes; -import ohos.hdi.nnrt.v2_1.ModelTypes; -import ohos.hdi.nnrt.v2_1.IPreparedModel; - -interface INnrtDevice { - GetDeviceName([out] String name); - GetVendorName([out] String name); - GetDeviceType([out] enum DeviceType deviceType); - GetDeviceStatus([out] enum DeviceStatus status); - GetSupportedOperation([in] struct Model model, [out] boolean[] ops); - IsFloat16PrecisionSupported([out] boolean isSupported); - IsPerformanceModeSupported([out] boolean isSupported); - IsPrioritySupported([out] boolean isSupported); - IsDynamicInputSupported([out] boolean isSupported); - PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); - IsModelCacheSupported([out] boolean isSupported); - PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, - [out] IPreparedModel preparedModel); - PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, - [out] IPreparedModel preparedModel); - AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); - ReleaseBuffer([in] struct SharedBuffer buffer); -} \ No newline at end of file diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl deleted file mode 100644 index 98643e38..00000000 --- a/nnrt/v2_1/IPreparedModel.idl +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2024 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.nnrt.v2_1; - -import ohos.hdi.nnrt.v2_1.NnrtTypes; - -interface IPreparedModel { - ExportModelCache([out] struct SharedBuffer[] modelCache); - GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); - Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); -} \ No newline at end of file diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl deleted file mode 100644 index cb20b456..00000000 --- a/nnrt/v2_1/ModelTypes.idl +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2024 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.nnrt.v2_1; - -import ohos.hdi.nnrt.v2_1.NnrtTypes; - -struct Tensor { - String name; - enum DataType dataType; - int[] dims; - enum Format format; - struct SharedBuffer data; - struct QuantParam[] quantParams; -}; - -struct Node { - String name; - enum NodeType nodeType; - byte[] nodeAttr; - unsigned int[] inputIndex; - unsigned int[] outputIndex; - enum QuantType quantType; -}; - -struct SubGraph { - String name; - unsigned int[] inputIndices; - unsigned int[] outputIndices; - unsigned int[] nodeIndices; -}; - -struct Model { - String name; - unsigned int[] inputIndex; - unsigned int[] outputIndex; - struct Node[] nodes; - struct Tensor[] allTensors; - struct SubGraph[] subGraph; -}; \ No newline at end of file diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index cc28a7a0..433492f9 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -14,281 +14,31 @@ */ package ohos.hdi.nnrt.v2_1; - -struct SharedBuffer { - FileDescriptor fd; - unsigned int bufferSize; - unsigned int offset; - unsigned int dataSize; -}; - -enum DeviceType: int { - OTHER, - CPU, - GPU, - ACCELERATOR -}; - -enum DeviceStatus: int { - AVAILABLE, - BUSY, - OFFLINE, - UNKNOWN -}; - -enum PerformanceMode: int { - PERFORMANCE_NONE, - PERFORMANCE_LOW, - PERFORMANCE_MEDIUM, - PERFORMANCE_HIGH, - PERFORMANCE_EXTREME -}; - -enum Priority: int { - PRIORITY_NONE, - PRIORITY_LOW, - PRIORITY_MEDIUM, - PRIORITY_HIGH -}; - -struct ModelConfig { - boolean enableFloat16; - enum PerformanceMode mode; - enum Priority priority; - Map extensions; -}; - -enum Format : byte { - FORMAT_NONE = -1, - FORMAT_NCHW = 0, - FORMAT_NHWC = 1 -}; - -struct QuantParam { - int numBits; - int zeroPoint; - double scale; -}; - -enum DataType : byte { - DATA_TYPE_UNKNOWN = 0, - DATA_TYPE_BOOL = 30, - DATA_TYPE_INT8 = 32, - DATA_TYPE_INT16 = 33, - DATA_TYPE_INT32 = 34, - DATA_TYPE_INT64 = 35, - DATA_TYPE_UINT8 = 37, - DATA_TYPE_UINT16 = 38, - DATA_TYPE_UINT32 = 39, - DATA_TYPE_UINT64 = 40, - DATA_TYPE_FLOAT16 = 42, - DATA_TYPE_FLOAT32 = 43, - DATA_TYPE_FLOAT64 = 44, -}; - -struct IOTensor { - String name; - enum DataType dataType; - int[] dimensions; - enum Format format; - struct SharedBuffer data; -}; - -enum QuantType: byte { - QUANT_TYPE_NONE, - QUANT_TYPE_ALL, -}; +import ohos.hdi.nnrt.v2_0.NnrtTypes; /** * @brief Enumerates types of the extended stream information. */ -enum NodeType : unsigned int { - NODE_TYPE_NONE = 0, +enum NodeType : ohos.hdi.nnrt.v2_0.NodeType { NODE_TYPE_ABS = 1, - NODE_TYPE_ACTIVATION = 2, - NODE_TYPE_ADD_FUSION = 5, - NODE_TYPE_ARGMAX_FUSION = 11, - NODE_TYPE_AVGPOOL_FUSION = 17, - NODE_TYPE_BATCH_TO_SPACE_ND = 22, - NODE_TYPE_BIAS_ADD = 23, NODE_TYPE_BROADCAST_TO = 27, - NODE_TYPE_CAST = 28, NODE_TYPE_CLIP = 30, - NODE_TYPE_CONCAT = 31, - NODE_TYPE_CONV2D_FUSION = 35, - NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, NODE_TYPE_CONSTANT_OF_SHAPE = 38, NODE_TYPE_DEPTH_TO_SPACE = 45, - NODE_TYPE_DIV_FUSION = 47, - NODE_TYPE_ELTWISE = 52, NODE_TYPE_EQUAL = 53, NODE_TYPE_EXPFUSION = 55, - NODE_TYPE_EXPAND_DIMS = 56, NODE_TYPE_FLATTEN = 61, - NODE_TYPE_FILL = 66, - NODE_TYPE_FULL_CONNECTION = 67, - NODE_TYPE_FUSED_BATCH_NORM = 68, - NODE_TYPE_GATHER = 69, NODE_TYPE_GREATER = 71, NODE_TYPE_GREATER_EQUAL = 72, NODE_TYPE_INSTANCE_NORM = 74, - NODE_TYPE_LAYER_NORM_FUSION = 75, NODE_TYPE_LEAKY_RELU = 76, NODE_TYPE_LESS = 77, - NODE_TYPE_LESS_EQUAL = 78, NODE_TYPE_LSTM = 87, - NODE_TYPE_MATMUL_FUSION = 89, - NODE_TYPE_MAXIMUM = 90, - NODE_TYPE_MAX_POOL_FUSION = 92, - NODE_TYPE_MUL_FUSION = 99, NODE_TYPE_NOT_EQUAL = 103, - NODE_TYPE_ONE_HOT = 105, - NODE_TYPE_PAD_FUSION = 107, - NODE_TYPE_POW_FUSION = 110, - NODE_TYPE_PRELU_FUSION = 112, - NODE_TYPE_QUANT_DTYPE_CAST = 113, NODE_TYPE_RANGE = 115, NODE_TYPE_REAL_DIV = 117, - NODE_TYPE_REDUCE_FUSION = 118, - NODE_TYPE_RESHAPE = 119, - NODE_TYPE_RESIZE = 120, - NODE_TYPE_RSQRT = 126, - NODE_TYPE_SCALE_FUSION = 127, - NODE_TYPE_SHAPE = 130, - NODE_TYPE_SLICE_FUSION = 135, - NODE_TYPE_SOFTMAX = 138, - NODE_TYPE_SPACE_TO_BATCH_ND = 141, - NODE_TYPE_SPLIT = 145, - NODE_TYPE_SQRT = 146, - NODE_TYPE_SQUEEZE = 147, NODE_TYPE_SQUARE = 148, - NODE_TYPE_SQUARED_DIFFERENCE = 149, - NODE_TYPE_STACK = 150, - NODE_TYPE_STRIDED_SLICE = 151, - NODE_TYPE_SUB_FUSION = 152, - NODE_TYPE_TILE_FUSION = 160, - NODE_TYPE_TOPK_FUSION = 161, - NODE_TYPE_TRANSPOSE = 162, - NODE_TYPE_UNSQUEEZE = 165, NODE_TYPE_UNSTACK = 166, NODE_TYPE_SELECT = 170, NODE_TYPE_ERF = 178, }; - -enum ResizeMethod : byte { - RESIZE_METHOD_UNKNOWN = -1, - RESIZE_METHOD_LINEAR = 0, - RESIZE_METHOD_NEAREST = 1, - RESIZE_METHOD_CUBIC = 2 -}; - -enum CoordinateTransformMode : byte { - COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, - COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, - COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 -}; - -enum NearestMode : byte { - NEAREST_MODE_NORMAL = 0, - NEAREST_MODE_ROUND_HALF_DOWN = 1, - NEAREST_MODE_ROUND_HALF_UP = 2, - NEAREST_MODE_FLOOR = 3, - NEAREST_MODE_CEIL = 4 -}; - -enum ActivationType : byte { - ACTIVATION_TYPE_NO_ACTIVATION = 0, - ACTIVATION_TYPE_RELU = 1, - ACTIVATION_TYPE_SIGMOID = 2, - ACTIVATION_TYPE_RELU6 = 3, - ACTIVATION_TYPE_ELU = 4, - ACTIVATION_TYPE_LEAKY_RELU = 5, - ACTIVATION_TYPE_ABS = 6, - ACTIVATION_TYPE_RELU1 = 7, - ACTIVATION_TYPE_SOFTSIGN = 8, - ACTIVATION_TYPE_SOFTPLUS = 9, - ACTIVATION_TYPE_TANH = 10, - ACTIVATION_TYPE_SELU = 11, - ACTIVATION_TYPE_HSWISH = 12, - ACTIVATION_TYPE_HSIGMOID = 13, - ACTIVATION_TYPE_THRESHOLDRELU = 14, - ACTIVATION_TYPE_LINEAR = 15, - ACTIVATION_TYPE_HARD_TANH = 16, - ACTIVATION_TYPE_SIGN = 17, - ACTIVATION_TYPE_SWISH = 18, - ACTIVATION_TYPE_GELU = 19, - ACTIVATION_TYPE_UNKNOWN = 20 -}; - -enum ReduceMode : byte { - REDUCE_MODE_MEAN = 0, - REDUCE_MODE_MAX = 1, - REDUCE_MODE_MIN = 2, - REDUCE_MODE_PROD = 3, - REDUCE_MODE_SUM = 4, - REDUCE_MODE_SUM_SQUARE = 5, - REDUCE_MODE_ASUM = 6, - REDUCE_MODE_ALL = 7 -}; - -enum EltwiseMode : byte { - ELTWISE_MODE_PROD = 0, - ELTWISE_MODE_SUM = 1, - ELTWISE_MODE_MAXIMUM = 2, - ELTWISE_MODE_UNKNOWN = 3 -}; - -enum PadMode : byte { - PAD_MODE_PAD = 0, - PAD_MODE_SAME = 1, - PAD_MODE_VALID = 2, -}; - -enum RoundMode : byte { - ROUND_MODE_FLOOR = 0, - ROUND_MODE_CEIL = 1 -}; - -enum PaddingMode : byte { - PADDING_MODE_CONSTANT = 0, - PADDING_MODE_REFLECT = 1, - PADDING_MODE_SYMMETRIC = 2, - PADDING_MODE_RESERVED = 3 -}; - -enum NNRT_ReturnCode : unsigned int { - NNRT_SUCCESS = 0, - NNRT_FAILED = 1, - NNRT_NULL_PTR = 2, - NNRT_INVALID_PARAMETER = 3, - NNRT_MEMORY_ERROR = 4, - NNRT_OUT_OF_MEMORY = 5, - NNRT_OPERATION_FORBIDDEN = 6, - NNRT_INVALID_FILE = 7, - NNRT_INVALID_PATH = 8, - NNRT_INSUFFICIENT_BUFFER = 9, - NNRT_NO_CHANGE = 10, - NNRT_NOT_SUPPORT = 11, - NNRT_SERVICE_ERROR = 12, - NNRT_DEVICE_ERROR = 13, - NNRT_DEVICE_BUSY = 14, - NNRT_CANCELLED = 15, - NNRT_PERMISSION_DENIED = 16, - NNRT_TIME_OUT = 17, - NNRT_INVALID_TENSOR = 18, - NNRT_INVALID_NODE = 19, - NNRT_INVALID_INPUT = 20, - NNRT_INVALID_OUTPUT = 21, - NNRT_INVALID_DATATYPE = 22, - NNRT_INVALID_FORMAT = 23, - NNRT_INVALID_TENSOR_NAME = 24, - NNRT_INVALID_SHAPE = 25, - NNRT_OUT_OF_DIMENTION_RANGES = 26, - NNRT_INVALID_BUFFER = 27, - NNRT_INVALID_BUFFER_SIZE = 28, - NNRT_INVALID_PERFORMANCE_MODE = 29, - NNRT_INVALID_PRIORITY = 30, - NNRT_INVALID_MODEL = 31, - NNRT_INVALID_MODEL_CACHE = 32, - NNRT_UNSUPPORTED_OP = 33 -}; \ No newline at end of file diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 9269731b..7d2dd7a9 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -16,102 +16,23 @@ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; +import ohos.hdi.nnrt.v2_0.NodeAttrTypes; struct Abs { }; -struct Activation -{ - enum ActivationType activationType; - float alpha; - float minVal; - float maxVal; - boolean approximate; -}; - -struct AddFusion -{ - enum ActivationType activationType; -}; - -struct ArgMaxFusion -{ - long axis; - long topK; - boolean keepDims; - boolean outMaxValue; -}; - -struct AvgPoolFusion -{ - long[] kernelSize; - long[] strides; - long[] pad; - enum PadMode padMode; - enum RoundMode roundMode; - enum Format format; - boolean global; - enum ActivationType activationType; -}; - -struct BatchToSpaceND -{ - long[] blockShape; - long[][] crops; -}; - -struct BiasAdd -{ -}; - struct BroadcastTo { long[] shape; }; -struct Cast -{ -}; - struct Clip { float max; float min; }; -struct Concat -{ - long axis; -}; - -struct Conv2DFusion -{ - long[] kernelSize; - long[] stride; - long[] dilation; - enum PadMode padMode; - long[] padList; - long group; - long inChannel; - long outChannel; - enum ActivationType activationType; -}; - -struct Conv2dTransposeFusion -{ - long[] kernelSize; - long[] stride; - long[] dilation; - enum PadMode padMode; - long[] padList; - long group; - long inChannel; - long outChannel; - enum ActivationType activationType; - long[] outputPaddings; -}; - struct ConstantOfShape { long data_type; @@ -125,16 +46,6 @@ struct DepthToSpace String mode; }; -struct DivFusion -{ - enum ActivationType activationType; -}; - -struct Eltwise -{ - enum EltwiseMode mode; -}; - struct Equal { }; @@ -146,36 +57,11 @@ struct ExpFusion float shift; }; -struct ExpandDims -{ -}; - struct Flatten { long axis; }; -struct Fill -{ -}; - -struct FullConnection -{ - boolean hasBias; - boolean useAxis; - long axis; - enum ActivationType activationType; -}; - -struct FusedBatchNorm -{ - float epsilon; -}; - -struct Gather -{ -}; - struct Greater { }; @@ -189,14 +75,6 @@ struct InstanceNorm float epsilon; }; -struct LayerNormFusion -{ - long beginNormAxis; - float epsilon; - boolean elementwiseAffine; - long beginParamsAxis; -}; - struct LeakyRelu { float negative_slope; @@ -206,10 +84,6 @@ struct Less { }; -struct LessEqual -{ -}; - struct LSTM { boolean bidirectional; @@ -224,67 +98,10 @@ struct LSTM long proj_size; }; -struct MatMulFusion -{ - boolean transposeA; - boolean transposeB; - enum ActivationType activationType; -}; - -struct Maximum -{ -}; - -struct MaxPoolFusion -{ - long[] kernelSize; - long[] strides; - long[] pad; - enum PadMode padMode; - enum Format format; - enum RoundMode roundMode; - boolean global; - enum ActivationType activationType; -}; - -struct MulFusion -{ - enum ActivationType activationType; -}; - struct NotEqual { }; -struct OneHot -{ - long axis; -}; - -struct PadFusion -{ - long[][] paddings; - enum PaddingMode paddingMode; - float constantValue; -}; - -struct PowFusion -{ - float scale; - float shift; -}; - -struct PReLUFusion -{ - boolean channelShared; -}; - -struct QuantDTypeCast -{ - long srcT; - long dstT; -}; - struct Range { long d_type; @@ -297,124 +114,10 @@ struct RealDiv { }; -struct ReduceFusion -{ - boolean keepDims; - enum ReduceMode mode; - boolean reduceToEnd; - float coeff; -}; - -struct Reshape -{ -}; - -struct Resize -{ - enum ResizeMethod method; - long newHeight; - long newWidth; - boolean preserveAspectRatio; - enum CoordinateTransformMode coordinateTransformMode; - float cubicCoeff; - long excludeOutside; - float extrapolationValue; - enum NearestMode nearestMode; -}; - -struct Rsqrt -{ -}; - -struct ScaleFusion -{ - long axis; - enum ActivationType activationType; -}; - -struct Shape -{ -}; - -struct SliceFusion -{ - long[] axes; -}; - -struct Softmax -{ - long[] axis; -}; - -struct SpaceToBatchND -{ - long[] blockShape; - long[][] paddings; -}; - -struct Split -{ - long outputNum; - long[] sizeSplits; - long axis; -}; - -struct Sqrt -{ -}; - struct Square { }; -struct SquaredDifference -{ -}; - -struct Squeeze -{ - long[] axis; -}; - -struct Stack -{ - long axis; -}; - -struct StridedSlice -{ - long beginMask; - long endMask; - long ellipsisMask; - long newAxisMask; - long shrinkAxisMask; -}; - -struct SubFusion -{ - enum ActivationType activationType; -}; - -struct TileFusion -{ - long[] dims; -}; - -struct TopKFusion -{ - boolean sorted; - long axis; -}; - -struct Transpose -{ -}; - -struct Unsqueeze -{ - long[] axis; -}; - struct Unstack { long axis; -- Gitee From 14090c76dc35eed45b25cb899292c74f1adb3962 Mon Sep 17 00:00:00 2001 From: maoyong Date: Mon, 5 Feb 2024 17:00:54 +0800 Subject: [PATCH 017/210] update nnrt v2_1 definition Signed-off-by: maoyong --- nnrt/v2_1/BUILD.gn | 8 +- nnrt/v2_1/INnrtDevice.idl | 40 +++++ nnrt/v2_1/IPreparedModel.idl | 24 +++ nnrt/v2_1/ModelTypes.idl | 52 ++++++ nnrt/v2_1/NnrtTypes.idl | 256 ++++++++++++++++++++++++++++- nnrt/v2_1/NodeAttrTypes.idl | 301 ++++++++++++++++++++++++++++++++++- 6 files changed, 672 insertions(+), 9 deletions(-) create mode 100644 nnrt/v2_1/INnrtDevice.idl create mode 100644 nnrt/v2_1/IPreparedModel.idl create mode 100644 nnrt/v2_1/ModelTypes.idl diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index 3e2e4914..b7ea7990 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2023 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 @@ -14,10 +14,10 @@ import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("nnrt") { module_name = "nnrt" - imports = [ - "ohos.hdi.nnrt.v2_0:nnrt" - ] sources = [ + "INnrtDevice.idl", + "IPreparedModel.idl", + "ModelTypes.idl", "NnrtTypes.idl", "NodeAttrTypes.idl", ] diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl new file mode 100644 index 00000000..46450cda --- /dev/null +++ b/nnrt/v2_1/INnrtDevice.idl @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; +import ohos.hdi.nnrt.v2_1.ModelTypes; +import ohos.hdi.nnrt.v2_1.IPreparedModel; + +interface INnrtDevice { + GetDeviceName([out] String name); + GetVendorName([out] String name); + GetDeviceType([out] enum DeviceType deviceType); + GetDeviceStatus([out] enum DeviceStatus status); + GetSupportedOperation([in] struct Model model, [out] boolean[] ops); + IsFloat16PrecisionSupported([out] boolean isSupported); + IsPerformanceModeSupported([out] boolean isSupported); + IsPrioritySupported([out] boolean isSupported); + IsDynamicInputSupported([out] boolean isSupported); + PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + IsModelCacheSupported([out] boolean isSupported); + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); + ReleaseBuffer([in] struct SharedBuffer buffer); +} \ No newline at end of file diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl new file mode 100644 index 00000000..b568b4fe --- /dev/null +++ b/nnrt/v2_1/IPreparedModel.idl @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; + +interface IPreparedModel { + ExportModelCache([out] struct SharedBuffer[] modelCache); + GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); + Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); +} \ No newline at end of file diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl new file mode 100644 index 00000000..e463cf6b --- /dev/null +++ b/nnrt/v2_1/ModelTypes.idl @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 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.nnrt.v2_1; + +import ohos.hdi.nnrt.v2_1.NnrtTypes; + +struct Tensor { + String name; + enum DataType dataType; + int[] dims; + enum Format format; + struct SharedBuffer data; + struct QuantParam[] quantParams; +}; + +struct Node { + String name; + enum NodeType nodeType; + byte[] nodeAttr; + unsigned int[] inputIndex; + unsigned int[] outputIndex; + enum QuantType quantType; +}; + +struct SubGraph { + String name; + unsigned int[] inputIndices; + unsigned int[] outputIndices; + unsigned int[] nodeIndices; +}; + +struct Model { + String name; + unsigned int[] inputIndex; + unsigned int[] outputIndex; + struct Node[] nodes; + struct Tensor[] allTensors; + struct SubGraph[] subGraph; +}; \ No newline at end of file diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index 433492f9..a270e842 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2023 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 @@ -14,31 +14,281 @@ */ package ohos.hdi.nnrt.v2_1; -import ohos.hdi.nnrt.v2_0.NnrtTypes; + +struct SharedBuffer { + FileDescriptor fd; + unsigned int bufferSize; + unsigned int offset; + unsigned int dataSize; +}; + +enum DeviceType: int { + OTHER, + CPU, + GPU, + ACCELERATOR +}; + +enum DeviceStatus: int { + AVAILABLE, + BUSY, + OFFLINE, + UNKNOWN +}; + +enum PerformanceMode: int { + PERFORMANCE_NONE, + PERFORMANCE_LOW, + PERFORMANCE_MEDIUM, + PERFORMANCE_HIGH, + PERFORMANCE_EXTREME +}; + +enum Priority: int { + PRIORITY_NONE, + PRIORITY_LOW, + PRIORITY_MEDIUM, + PRIORITY_HIGH +}; + +struct ModelConfig { + boolean enableFloat16; + enum PerformanceMode mode; + enum Priority priority; + Map extensions; +}; + +enum Format : byte { + FORMAT_NONE = -1, + FORMAT_NCHW = 0, + FORMAT_NHWC = 1 +}; + +struct QuantParam { + int numBits; + int zeroPoint; + double scale; +}; + +enum DataType : byte { + DATA_TYPE_UNKNOWN = 0, + DATA_TYPE_BOOL = 30, + DATA_TYPE_INT8 = 32, + DATA_TYPE_INT16 = 33, + DATA_TYPE_INT32 = 34, + DATA_TYPE_INT64 = 35, + DATA_TYPE_UINT8 = 37, + DATA_TYPE_UINT16 = 38, + DATA_TYPE_UINT32 = 39, + DATA_TYPE_UINT64 = 40, + DATA_TYPE_FLOAT16 = 42, + DATA_TYPE_FLOAT32 = 43, + DATA_TYPE_FLOAT64 = 44, +}; + +struct IOTensor { + String name; + enum DataType dataType; + int[] dimensions; + enum Format format; + struct SharedBuffer data; +}; + +enum QuantType: byte { + QUANT_TYPE_NONE, + QUANT_TYPE_ALL, +}; /** * @brief Enumerates types of the extended stream information. */ -enum NodeType : ohos.hdi.nnrt.v2_0.NodeType { +enum NodeType : unsigned int { + NODE_TYPE_NONE = 0, NODE_TYPE_ABS = 1, + NODE_TYPE_ACTIVATION = 2, + NODE_TYPE_ADD_FUSION = 5, + NODE_TYPE_ARGMAX_FUSION = 11, + NODE_TYPE_AVGPOOL_FUSION = 17, + NODE_TYPE_BATCH_TO_SPACE_ND = 22, + NODE_TYPE_BIAS_ADD = 23, NODE_TYPE_BROADCAST_TO = 27, + NODE_TYPE_CAST = 28, NODE_TYPE_CLIP = 30, + NODE_TYPE_CONCAT = 31, + NODE_TYPE_CONV2D_FUSION = 35, + NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, NODE_TYPE_CONSTANT_OF_SHAPE = 38, NODE_TYPE_DEPTH_TO_SPACE = 45, + NODE_TYPE_DIV_FUSION = 47, + NODE_TYPE_ELTWISE = 52, NODE_TYPE_EQUAL = 53, NODE_TYPE_EXPFUSION = 55, + NODE_TYPE_EXPAND_DIMS = 56, NODE_TYPE_FLATTEN = 61, + NODE_TYPE_FILL = 66, + NODE_TYPE_FULL_CONNECTION = 67, + NODE_TYPE_FUSED_BATCH_NORM = 68, + NODE_TYPE_GATHER = 69, NODE_TYPE_GREATER = 71, NODE_TYPE_GREATER_EQUAL = 72, NODE_TYPE_INSTANCE_NORM = 74, + NODE_TYPE_LAYER_NORM_FUSION = 75, NODE_TYPE_LEAKY_RELU = 76, NODE_TYPE_LESS = 77, + NODE_TYPE_LESS_EQUAL = 78, NODE_TYPE_LSTM = 87, + NODE_TYPE_MATMUL_FUSION = 89, + NODE_TYPE_MAXIMUM = 90, + NODE_TYPE_MAX_POOL_FUSION = 92, + NODE_TYPE_MUL_FUSION = 99, NODE_TYPE_NOT_EQUAL = 103, + NODE_TYPE_ONE_HOT = 105, + NODE_TYPE_PAD_FUSION = 107, + NODE_TYPE_POW_FUSION = 110, + NODE_TYPE_PRELU_FUSION = 112, + NODE_TYPE_QUANT_DTYPE_CAST = 113, NODE_TYPE_RANGE = 115, NODE_TYPE_REAL_DIV = 117, + NODE_TYPE_REDUCE_FUSION = 118, + NODE_TYPE_RESHAPE = 119, + NODE_TYPE_RESIZE = 120, + NODE_TYPE_RSQRT = 126, + NODE_TYPE_SCALE_FUSION = 127, + NODE_TYPE_SHAPE = 130, + NODE_TYPE_SLICE_FUSION = 135, + NODE_TYPE_SOFTMAX = 138, + NODE_TYPE_SPACE_TO_BATCH_ND = 141, + NODE_TYPE_SPLIT = 145, + NODE_TYPE_SQRT = 146, + NODE_TYPE_SQUEEZE = 147, NODE_TYPE_SQUARE = 148, + NODE_TYPE_SQUARED_DIFFERENCE = 149, + NODE_TYPE_STACK = 150, + NODE_TYPE_STRIDED_SLICE = 151, + NODE_TYPE_SUB_FUSION = 152, + NODE_TYPE_TILE_FUSION = 160, + NODE_TYPE_TOPK_FUSION = 161, + NODE_TYPE_TRANSPOSE = 162, + NODE_TYPE_UNSQUEEZE = 165, NODE_TYPE_UNSTACK = 166, NODE_TYPE_SELECT = 170, NODE_TYPE_ERF = 178, }; + +enum ResizeMethod : byte { + RESIZE_METHOD_UNKNOWN = -1, + RESIZE_METHOD_LINEAR = 0, + RESIZE_METHOD_NEAREST = 1, + RESIZE_METHOD_CUBIC = 2 +}; + +enum CoordinateTransformMode : byte { + COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, + COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, + COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 +}; + +enum NearestMode : byte { + NEAREST_MODE_NORMAL = 0, + NEAREST_MODE_ROUND_HALF_DOWN = 1, + NEAREST_MODE_ROUND_HALF_UP = 2, + NEAREST_MODE_FLOOR = 3, + NEAREST_MODE_CEIL = 4 +}; + +enum ActivationType : byte { + ACTIVATION_TYPE_NO_ACTIVATION = 0, + ACTIVATION_TYPE_RELU = 1, + ACTIVATION_TYPE_SIGMOID = 2, + ACTIVATION_TYPE_RELU6 = 3, + ACTIVATION_TYPE_ELU = 4, + ACTIVATION_TYPE_LEAKY_RELU = 5, + ACTIVATION_TYPE_ABS = 6, + ACTIVATION_TYPE_RELU1 = 7, + ACTIVATION_TYPE_SOFTSIGN = 8, + ACTIVATION_TYPE_SOFTPLUS = 9, + ACTIVATION_TYPE_TANH = 10, + ACTIVATION_TYPE_SELU = 11, + ACTIVATION_TYPE_HSWISH = 12, + ACTIVATION_TYPE_HSIGMOID = 13, + ACTIVATION_TYPE_THRESHOLDRELU = 14, + ACTIVATION_TYPE_LINEAR = 15, + ACTIVATION_TYPE_HARD_TANH = 16, + ACTIVATION_TYPE_SIGN = 17, + ACTIVATION_TYPE_SWISH = 18, + ACTIVATION_TYPE_GELU = 19, + ACTIVATION_TYPE_UNKNOWN = 20 +}; + +enum ReduceMode : byte { + REDUCE_MODE_MEAN = 0, + REDUCE_MODE_MAX = 1, + REDUCE_MODE_MIN = 2, + REDUCE_MODE_PROD = 3, + REDUCE_MODE_SUM = 4, + REDUCE_MODE_SUM_SQUARE = 5, + REDUCE_MODE_ASUM = 6, + REDUCE_MODE_ALL = 7 +}; + +enum EltwiseMode : byte { + ELTWISE_MODE_PROD = 0, + ELTWISE_MODE_SUM = 1, + ELTWISE_MODE_MAXIMUM = 2, + ELTWISE_MODE_UNKNOWN = 3 +}; + +enum PadMode : byte { + PAD_MODE_PAD = 0, + PAD_MODE_SAME = 1, + PAD_MODE_VALID = 2, +}; + +enum RoundMode : byte { + ROUND_MODE_FLOOR = 0, + ROUND_MODE_CEIL = 1 +}; + +enum PaddingMode : byte { + PADDING_MODE_CONSTANT = 0, + PADDING_MODE_REFLECT = 1, + PADDING_MODE_SYMMETRIC = 2, + PADDING_MODE_RESERVED = 3 +}; + +enum NNRT_ReturnCode : unsigned int { + NNRT_SUCCESS = 0, + NNRT_FAILED = 1, + NNRT_NULL_PTR = 2, + NNRT_INVALID_PARAMETER = 3, + NNRT_MEMORY_ERROR = 4, + NNRT_OUT_OF_MEMORY = 5, + NNRT_OPERATION_FORBIDDEN = 6, + NNRT_INVALID_FILE = 7, + NNRT_INVALID_PATH = 8, + NNRT_INSUFFICIENT_BUFFER = 9, + NNRT_NO_CHANGE = 10, + NNRT_NOT_SUPPORT = 11, + NNRT_SERVICE_ERROR = 12, + NNRT_DEVICE_ERROR = 13, + NNRT_DEVICE_BUSY = 14, + NNRT_CANCELLED = 15, + NNRT_PERMISSION_DENIED = 16, + NNRT_TIME_OUT = 17, + NNRT_INVALID_TENSOR = 18, + NNRT_INVALID_NODE = 19, + NNRT_INVALID_INPUT = 20, + NNRT_INVALID_OUTPUT = 21, + NNRT_INVALID_DATATYPE = 22, + NNRT_INVALID_FORMAT = 23, + NNRT_INVALID_TENSOR_NAME = 24, + NNRT_INVALID_SHAPE = 25, + NNRT_OUT_OF_DIMENTION_RANGES = 26, + NNRT_INVALID_BUFFER = 27, + NNRT_INVALID_BUFFER_SIZE = 28, + NNRT_INVALID_PERFORMANCE_MODE = 29, + NNRT_INVALID_PRIORITY = 30, + NNRT_INVALID_MODEL = 31, + NNRT_INVALID_MODEL_CACHE = 32, + NNRT_UNSUPPORTED_OP = 33 +}; \ No newline at end of file diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 7d2dd7a9..c6962ecf 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2023 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 @@ -16,23 +16,102 @@ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; -import ohos.hdi.nnrt.v2_0.NodeAttrTypes; struct Abs { }; +struct Activation +{ + enum ActivationType activationType; + float alpha; + float minVal; + float maxVal; + boolean approximate; +}; + +struct AddFusion +{ + enum ActivationType activationType; +}; + +struct ArgMaxFusion +{ + long axis; + long topK; + boolean keepDims; + boolean outMaxValue; +}; + +struct AvgPoolFusion +{ + long[] kernelSize; + long[] strides; + long[] pad; + enum PadMode padMode; + enum RoundMode roundMode; + enum Format format; + boolean global; + enum ActivationType activationType; +}; + +struct BatchToSpaceND +{ + long[] blockShape; + long[][] crops; +}; + +struct BiasAdd +{ +}; + struct BroadcastTo { long[] shape; }; +struct Cast +{ +}; + struct Clip { float max; float min; }; +struct Concat +{ + long axis; +}; + +struct Conv2DFusion +{ + long[] kernelSize; + long[] stride; + long[] dilation; + enum PadMode padMode; + long[] padList; + long group; + long inChannel; + long outChannel; + enum ActivationType activationType; +}; + +struct Conv2dTransposeFusion +{ + long[] kernelSize; + long[] stride; + long[] dilation; + enum PadMode padMode; + long[] padList; + long group; + long inChannel; + long outChannel; + enum ActivationType activationType; + long[] outputPaddings; +}; + struct ConstantOfShape { long data_type; @@ -46,6 +125,16 @@ struct DepthToSpace String mode; }; +struct DivFusion +{ + enum ActivationType activationType; +}; + +struct Eltwise +{ + enum EltwiseMode mode; +}; + struct Equal { }; @@ -57,11 +146,36 @@ struct ExpFusion float shift; }; +struct ExpandDims +{ +}; + struct Flatten { long axis; }; +struct Fill +{ +}; + +struct FullConnection +{ + boolean hasBias; + boolean useAxis; + long axis; + enum ActivationType activationType; +}; + +struct FusedBatchNorm +{ + float epsilon; +}; + +struct Gather +{ +}; + struct Greater { }; @@ -75,6 +189,14 @@ struct InstanceNorm float epsilon; }; +struct LayerNormFusion +{ + long beginNormAxis; + float epsilon; + boolean elementwiseAffine; + long beginParamsAxis; +}; + struct LeakyRelu { float negative_slope; @@ -84,6 +206,10 @@ struct Less { }; +struct LessEqual +{ +}; + struct LSTM { boolean bidirectional; @@ -98,10 +224,67 @@ struct LSTM long proj_size; }; +struct MatMulFusion +{ + boolean transposeA; + boolean transposeB; + enum ActivationType activationType; +}; + +struct Maximum +{ +}; + +struct MaxPoolFusion +{ + long[] kernelSize; + long[] strides; + long[] pad; + enum PadMode padMode; + enum Format format; + enum RoundMode roundMode; + boolean global; + enum ActivationType activationType; +}; + +struct MulFusion +{ + enum ActivationType activationType; +}; + struct NotEqual { }; +struct OneHot +{ + long axis; +}; + +struct PadFusion +{ + long[][] paddings; + enum PaddingMode paddingMode; + float constantValue; +}; + +struct PowFusion +{ + float scale; + float shift; +}; + +struct PReLUFusion +{ + boolean channelShared; +}; + +struct QuantDTypeCast +{ + long srcT; + long dstT; +}; + struct Range { long d_type; @@ -114,10 +297,124 @@ struct RealDiv { }; +struct ReduceFusion +{ + boolean keepDims; + enum ReduceMode mode; + boolean reduceToEnd; + float coeff; +}; + +struct Reshape +{ +}; + +struct Resize +{ + enum ResizeMethod method; + long newHeight; + long newWidth; + boolean preserveAspectRatio; + enum CoordinateTransformMode coordinateTransformMode; + float cubicCoeff; + long excludeOutside; + float extrapolationValue; + enum NearestMode nearestMode; +}; + +struct Rsqrt +{ +}; + +struct ScaleFusion +{ + long axis; + enum ActivationType activationType; +}; + +struct Shape +{ +}; + +struct SliceFusion +{ + long[] axes; +}; + +struct Softmax +{ + long[] axis; +}; + +struct SpaceToBatchND +{ + long[] blockShape; + long[][] paddings; +}; + +struct Split +{ + long outputNum; + long[] sizeSplits; + long axis; +}; + +struct Sqrt +{ +}; + struct Square { }; +struct SquaredDifference +{ +}; + +struct Squeeze +{ + long[] axis; +}; + +struct Stack +{ + long axis; +}; + +struct StridedSlice +{ + long beginMask; + long endMask; + long ellipsisMask; + long newAxisMask; + long shrinkAxisMask; +}; + +struct SubFusion +{ + enum ActivationType activationType; +}; + +struct TileFusion +{ + long[] dims; +}; + +struct TopKFusion +{ + boolean sorted; + long axis; +}; + +struct Transpose +{ +}; + +struct Unsqueeze +{ + long[] axis; +}; + struct Unstack { long axis; -- Gitee From 54bbda41167e2214187274693e8b2ff7d3f13e04 Mon Sep 17 00:00:00 2001 From: AnXiang Date: Mon, 5 Feb 2024 09:42:29 +0000 Subject: [PATCH 018/210] update bluetooth/a2dp/v1_1/BUILD.gn. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth/a2dp/v1_1/BUILD.gn b/bluetooth/a2dp/v1_1/BUILD.gn index 8de0f223..1981bc3f 100644 --- a/bluetooth/a2dp/v1_1/BUILD.gn +++ b/bluetooth/a2dp/v1_1/BUILD.gn @@ -14,10 +14,10 @@ import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("bluetooth_a2dp") { module_name = "bluetooth_a2dp" + imports = [ "ohos.hdi.bluetooth.a2dp.v1_0:bluetooth_a2dp" ] sources = [ "BluetoothAudioTypes.idl", - "IBluetoothAudioCallback.idl", "IBluetoothAudioSession.idl", ] -- Gitee From f6acc87e45cd86782c8ceafa6f885ad3b15b3b69 Mon Sep 17 00:00:00 2001 From: AnXiang Date: Mon, 5 Feb 2024 09:44:28 +0000 Subject: [PATCH 019/210] update bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl. Signed-off-by: AnXiang --- bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl | 35 ++------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl index eaf47aea..b72f490e 100644 --- a/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl +++ b/bluetooth/a2dp/v1_1/BluetoothAudioTypes.idl @@ -22,7 +22,7 @@ * The Host can use the interface provided by the module to create an audio session, * and exchange data with the audio subsystem. * - * @since 4.0 + * @since 4.1 */ /* @@ -30,42 +30,13 @@ * * @brief Defines the data structure. * - * @since 4.0 + * @since 4.1 * @version 1.1 */ package ohos.hdi.bluetooth.a2dp.v1_1; -/* - * @brief Defines the operation. - * - * @since 4.0 - */ -enum Operation { - SUSPEND_RENDER = 0, - START_RENDER = 1, -}; - -/* - * @brief Defines the operation result of the interface. - * - * @since 4.0 - */ -enum Status { - SUCCESS = 0, - FAILURE = 1, -}; - -/* - * @brief Defines the type of audio session. - * - * @since 4.0 - */ -enum SessionType { - UNKNOWN_TYPE, - SOFTWARE_ENCODING, - HARDWARE_ENCODING, -}; +import ohos.hdi.bluetooth.a2dp.v1_0.BluetoothAudioTypes; /** * @brief Defines the start session parameters information. -- Gitee From f69e7a2e5d1f296b2696e0709794f485edcce147 Mon Sep 17 00:00:00 2001 From: AnXiang Date: Mon, 5 Feb 2024 09:45:52 +0000 Subject: [PATCH 020/210] update bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl. Signed-off-by: AnXiang deleted: bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl --- .../a2dp/v1_1/IBluetoothAudioCallback.idl | 74 ------------------- .../a2dp/v1_1/IBluetoothAudioSession.idl | 55 +++----------- 2 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl deleted file mode 100644 index 2469c08e..00000000 --- a/bluetooth/a2dp/v1_1/IBluetoothAudioCallback.idl +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2024 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 HdiA2dp - * @{ - * - * @brief Provides unified APIs for the A2DP service. - * - * The Host can use the interface provided by the module to create an audio session, - * and exchange data with the audio subsystem. - * - * @since 4.0 - */ - -/** - * @file IBluetoothAudioCallback.idl - * - * @brief Defines the callback function, including the start, suspend, stop operations from audio. - * - * @since 4.0 - * @version 1.1 - */ - -package ohos.hdi.bluetooth.a2dp.v1_1; - -/** - * @brief Defines the callback function to start, suspend, stop audio render. - * - * @since 4.0 - */ -[callback] interface IBluetoothAudioCallback { - /** - * @brief Start audio render callback function. - * - * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - StartRender(); - - /** - * @brief Suspend audio render callback function. - * - * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - SuspendRender(); - - /** - * @brief Stop audio render callback function. - * - * @return Returns 0 if the result is returned successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - StopRender(); -} diff --git a/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl index 2e33a5d6..c1e69a6c 100644 --- a/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl +++ b/bluetooth/a2dp/v1_1/IBluetoothAudioSession.idl @@ -22,45 +22,33 @@ * The Host can use the interface provided by the module to create an audio session, * and exchange data with the audio. * - * @since 4.0 + * @since 4.1 */ /** * @file IBluetoothAudioSession.idl * - * @brief Defines the interfaces to start audio session, send render operation result, + * @brief Defines the interfaces to start audio session with parameters, send render operation result, * and stop the audio session. * - * @since 4.0 + * @since 4.1 * @version 1.1 */ package ohos.hdi.bluetooth.a2dp.v1_1; -import ohos.hdi.bluetooth.a2dp.v1_1.IBluetoothAudioCallback; import ohos.hdi.bluetooth.a2dp.v1_1.BluetoothAudioTypes; +import ohos.hdi.bluetooth.a2dp.v1_0.IBluetoothAudioCallback; +import ohos.hdi.bluetooth.a2dp.v1_0.IBluetoothAudioSession; /** - * @brief Defines the interfaces to start audio session, send render operation result, + * @brief Defines the interfaces to start audio session with parameters, send render operation result, * and stop the audio session. * - * @since 4.0 + * @since 4.1 + * @version 1.1 */ -interface IBluetoothAudioSession { - /** - * @brief Start audio session and register the callback function. - * - * @param sessionType Indicates the session type. - * @param callbackObj Indicates the callback function. For details, see {@link IBluetoothAudioCallback}. - * @param queue Returns sharedMemQueue for audio data. - * @return Returns 0 if the operation is successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - StartSession([in] enum SessionType sessionType, [in] IBluetoothAudioCallback callbackObj, - [out] SharedMemQueue queue); - +interface IBluetoothAudioSession extends ohos.hdi.bluetooth.a2dp.v1_0.IBluetoothAudioSession { /** * @brief Start audio session and register the callback function. * @@ -74,27 +62,4 @@ interface IBluetoothAudioSession { */ StartSessionWithParams([in] struct StartSessionParams params, [in] IBluetoothAudioCallback callbackObj, [out] SharedMemQueue queue); - - /** - * @brief Stop audio session. - * - * @param sessionType Indicates the session type. - * @return Returns 0 if the operation is successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - StopSession([in] enum SessionType sessionType); - - /** - * @brief send the render operation result. - * - * @param operation Indicates the render operation. - * @param Status SUCCESS or FAILURE for operation. - * @return Returns 0 if the operation is successfully; returns a negative value otherwise. - * - * @since 4.0 - * @version 1.1 - */ - RenderOperationResult([in] enum Operation operation, [in] enum Status status); -} +} \ No newline at end of file -- Gitee From 441a0905d4715d7c1094bce8d27a4fe6e1f936d3 Mon Sep 17 00:00:00 2001 From: maoyong Date: Mon, 5 Feb 2024 21:18:00 +0800 Subject: [PATCH 021/210] update copyright Signed-off-by: maoyong --- nnrt/v2_1/BUILD.gn | 2 +- nnrt/v2_1/INnrtDevice.idl | 2 +- nnrt/v2_1/IPreparedModel.idl | 2 +- nnrt/v2_1/ModelTypes.idl | 2 +- nnrt/v2_1/NnrtTypes.idl | 2 +- nnrt/v2_1/NodeAttrTypes.idl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index b7ea7990..17f1dc57 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl index 46450cda..ed45e918 100644 --- a/nnrt/v2_1/INnrtDevice.idl +++ b/nnrt/v2_1/INnrtDevice.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl index b568b4fe..98643e38 100644 --- a/nnrt/v2_1/IPreparedModel.idl +++ b/nnrt/v2_1/IPreparedModel.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl index e463cf6b..cb20b456 100644 --- a/nnrt/v2_1/ModelTypes.idl +++ b/nnrt/v2_1/ModelTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index a270e842..cc28a7a0 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index c6962ecf..9269731b 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From 4ad45ad0e76ea0b88acd1989814e443f685fbebf Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 6 Feb 2024 11:06:48 +0800 Subject: [PATCH 022/210] upload v1_0 interface description Signed-off-by: maoyong --- nnrt/v1_0/INnrtDevice.idl | 184 +++++- nnrt/v1_0/IPreparedModel.idl | 56 +- nnrt/v1_0/ModelTypes.idl | 118 +++- nnrt/v1_0/NnrtTypes.idl | 585 +++++++++++++++++- nnrt/v1_0/NodeAttrTypes.idl | 1077 +++++++++++++++++++++++++++++++++- 5 files changed, 2013 insertions(+), 7 deletions(-) diff --git a/nnrt/v1_0/INnrtDevice.idl b/nnrt/v1_0/INnrtDevice.idl index 8590ad7b..c23a3726 100644 --- a/nnrt/v1_0/INnrtDevice.idl +++ b/nnrt/v1_0/INnrtDevice.idl @@ -13,26 +13,204 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * It serves as a bridge between the upper-layer AI inference framework and the underlying acceleration chip to implement cross-chip inference computing of AI models. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file INnrtDevice.idl + * + * @brief Defines methods related to chip devices. + * + * You can use the methods to query chip device information and build AI models. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nnrt.v1_0; import ohos.hdi.nnrt.v1_0.NnrtTypes; import ohos.hdi.nnrt.v1_0.ModelTypes; import ohos.hdi.nnrt.v1_0.IPreparedModel; +/** + * @brief Provides methods for device management and model building. + * + * When multiple devices are registered, ensure that the combination of the device name and vendor name is globally unique. + * + * @since 3.2 + * @version 1.0 + */ interface INnrtDevice { + /** + * @brief Obtains the device name. + * + * @param name Indicates the device name obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ GetDeviceName([out] String name); + + /** + * @brief Obtains the device vendor name. + * + * @param name Indicates the device vendor name obtained. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ GetVendorName([out] String name); + + /** + * @brief Obtains the device type. + * + * @param deviceType Indicates the device type obtained. For details, see {@link DeviceType}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ GetDeviceType([out] enum DeviceType deviceType); + + /** + * @brief Obtains the device status. + * + * @param deviceType Indicates the device status obtained. For details, see {@link DeviceStatus}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ GetDeviceStatus([out] enum DeviceStatus status); + + /** + * @brief Obtains the device's support for the operators of the specified AI model. + * + * @param model Indicates the AI model. For details, see {@link Model}. + * @param ops Indicates the operators supported and not supported by the device. The operators are listed in the same sequence as they listed in the API model. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ GetSupportedOperation([in] struct Model model, [out] boolean[] ops); + + /** + * @brief Checks whether the device supports the Float32 model with the Float16 precision. + * + * @param isSupported Indicates whether the Float16 precision is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ IsFloat16PrecisionSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports performance preference settings. For details about the performance preference, see {@link PerformanceMode}. + * + * @param isSupported Indicates whether the device supports performance preference settings. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ IsPerformanceModeSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports task priority settings. For details about the priority, see {@link Priority}. + * + * @param isSupported Indicates whether the device supports task priority settings. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ IsPrioritySupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports dynamic input, which allows a model of different shapes to be used for different operations. + * + * If dynamic input is supported, -1 is added in the shape of the input tensor. + * + * @param isSupported Indicates whether dynamic input is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ IsDynamicInputSupported([out] boolean isSupported); - PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Builds a model. + * + * If the AI model supports dynamic input, at least one dimension of the input tensor contains -1. + * + * @param model indicates the module to build. For details, see {@link Model}. + * @param config Indicates the module configuration. For details, see {@link ModelConfig}. + * @param preparedModel Indicates the model object built. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ + PrepareModel([in] struct Model model, + [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + + /** + * @brief Checks whether the device supports caching of the AI models built. + * + * If yes, PrepareModelFromModelCache() and ExportModelCache() need to be implemented. + * + * @param isSupported Indicates whether the device supports caching of the AI models built. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ IsModelCacheSupported([out] boolean isSupported); - PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, + + /** + * @brief Loads an AI model from the cache. The AI model is exported by using ExportModelCache(). + * + * @param modelCache Indicates an array of the model files, which are in the same sequence as they exported. For details, see {@link SharedBuffer}. + * @param config Indicates the configuration for loading the model. For details, see {@link ModelConfig}. + * @param preparedModel Indicates the model object obtained. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, + [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Allocates the shared memory for the device. The shared memory allows quick access to the input and output data for AI inference. + * + * @param length Indicates the shared memory to allocate, in bytes. + * @param buffer Indicates the information about the shared memory allocated, including the file descriptor and size of the shared memory. For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); + + /** + * @brief Releases the shared memory. + * + * @param buffer Indicates the shared memory to release. For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ ReleaseBuffer([in] struct SharedBuffer buffer); -} \ No newline at end of file +} + +/** @} */ diff --git a/nnrt/v1_0/IPreparedModel.idl b/nnrt/v1_0/IPreparedModel.idl index 0343251c..e90ceb8e 100644 --- a/nnrt/v1_0/IPreparedModel.idl +++ b/nnrt/v1_0/IPreparedModel.idl @@ -13,12 +13,66 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * It serves as a bridge between the upper-layer AI inference framework and the underlying acceleration chip to implement cross-chip inference computing of AI models. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IPreparedModel.idl + * + * @brief Defines the APIs for exporting AI models and performing AI model inference. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nnrt.v1_0; import ohos.hdi.nnrt.v1_0.NnrtTypes; +/** + * @brief Provides the APIs for exporting AI models and performing AI model inference. + * + * @since 3.2 + * @version 1.0 + */ interface IPreparedModel { + /** + * @brief Exports an AI model from the cache. + * + * @param modelCache Indicates an array of model files to export. For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ ExportModelCache([out] struct SharedBuffer[] modelCache); + + /** + * @brief Performs AI model inference. + * + * @param inputs Indicates the input data for AI model inference. The data is input in the sequence defined by the model. For details about the input data type, see {@link IOTensor}. + * @param outputs Indicates the output data of AI model inference. After inference, the output data is written to the shared buffer. For details about the output data type, see {@link IOTensor}. + * @param outputsDims Indicates the dimensions of the output data. The output sequence is the same as that of outputs. + * @param isOutputBufferEnough Indicates whether the shared buffer space is sufficient for the output data. The value true means the shared buffer space is sufficient; the value false means the opposite. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative number if the operation fails. + */ Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputsDims, [out] boolean[] isOutputBufferEnough); -} \ No newline at end of file +} + +/** @} */ diff --git a/nnrt/v1_0/ModelTypes.idl b/nnrt/v1_0/ModelTypes.idl index bc7040e5..35065dbe 100644 --- a/nnrt/v1_0/ModelTypes.idl +++ b/nnrt/v1_0/ModelTypes.idl @@ -13,40 +13,156 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * It serves as a bridge between the upper-layer AI inference framework and the underlying acceleration chip to implement cross-chip inference computing of AI models. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file ModelTypes.idl + * + * @brief Defines AI model structures. + * + * In {@link PrepareModel}, the AI model is parsed and converted into the structure for inference. Then, model inference is performed in {@link Run}. The process is as follows. + * - 1. Write the functions for each operator in the {@link NodeAttrTypes.idl} file and associate each function with a {@link NodeType}. + * - 2. The subGraph parameter of {@link Model} is traversed to obtain the operator nodes contained in the subgraph, the input and output tensors of the operator, and the input and output tensors of the entire {@link Model} from nodeIndecies of the subgraph. + * - 3. The operator functions are located based on the nodeType parameter of {@link Node} to build the model structure for runtime. + * - 4. When the tensors input by the user are passed to the model, model inference is performed. The model inference result is output. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nnrt.v1_0; import ohos.hdi.nnrt.v1_0.NnrtTypes; +/** + * @brief Defines the tensor structure. + * + * @since 3.2 + * @version 1.0 + */ struct Tensor { + /** Tensor name. */ String name; + /** Tensor data type. For details, see {@link DataType}. */ enum DataType dataType; + /** Tensor dimensions. */ int[] dims; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** Structure used for passing the tensor data during process communication. For details, see {@link SharedBuffer}. */ struct SharedBuffer data; + /** + * Array of quantization parameters of the tensor. For details, see {@link QuantParam}. + * If the length is 1, all axes share one quantization parameter. + * If the length is not 1, each quantization parameter in the array corresponds to an axis. + */ struct QuantParam[] quantParams; }; +/** + * @brief Defines the operator node structure. + * + * nodeAttr is a segment of serialized data. Specific parameters can be obtained only by using the deserialization interface of OpenHarmony HDI. + The process is as follows: + * - Define the operator parameter structure OP op{}, where OP can be replaced with the operator parameter structure defined in {@link NodeAttrTypes.idl} and op is a variable name. + * - Declare `OHOS::MessageParcel data;`, the MessageParcle object, which is used to store deserialized data. + * - Use data.WriteBuffer (nodeAttr.data(),nodeAttr.size()); to write nodeAttr to data. + * - Use (void)OPBlockUnmarshalling(data, op); to deserialize data to the op structure.
+ * Then, you can view the parameter values of the operator in op. + * + * Example: + * If nodeType of an operator is NODE_TYPE_FULL_CONNECTION, the corresponding operator parameter structure is {@link FullConnection}. + * The operator has four parameters: hasBias, useAxis, axis, and activationType.
+ * The invoking process is as follows:
+ * FullConnection full_connection{};
+ * OHOS::MessageParcel data;
+ * data.WriteBuffer(nodeAttr.data(),nodeAttr.size());
+ * (void)FullConnectionBlockUnmarshalling(data, full_connection);
+ * The four parameters are written into full_connection. + * + * @since 3.2 + * @version 1.0 + */ struct Node { + /** Operator node name. */ String name; + /** Operator node type. For details, see {@link NodeType}. */ enum NodeType nodeType; + /** + * Array of the serialized data corresponding to the operator node parameters. + */ byte[] nodeAttr; + /** Subscript of the input node of the operator node. */ unsigned int[] inputIndex; + /** Subscript of the output node of the operator node. */ unsigned int[] outputIndex; + /** Quantization parameter of the operator node. For details, see {@link QuantType}. */ enum QuantType quantType; }; +/** + * @brief Defines the subgraph structure. + * + * @since 3.2 + * @version 1.0 + */ struct SubGraph { + /** Subgraph name. */ String name; + /** Indices of the input subgraphs in subGraph of {@link Model}. */ unsigned int[] inputIndices; + /** Indices of the output subgraphs in subGraph of {@link Model}. */ unsigned int[] outputIndices; + /** Indices of the operator nodes related to the subgraph in the nodes array of {@link Model}. */ unsigned int[] nodeIndices; }; +/** + * @brief Defines the model structure. + * + * This structure stores all information required for model inference. Subgraph 0 of each model is the main subgraph. Generally, a model has only one subGraph. + * + * @since 3.2 + * @version 1.0 + */ struct Model { + /** Model name. */ String name; + /** + * Index of the input tensor of the model in allTensors. + */ unsigned int[] inputIndex; + /** + * Index of the output tensor of the model in allTensors. + */ unsigned int[] outputIndex; + /** + * Array of all operator nodes in the model. For details, see {@link Node}. + */ struct Node[] nodes; + /** + * Array of all tensors in the model. The array contains input tensors, output tensors, and constant tensors. For details, see {@link Tensor}. + */ struct Tensor[] allTensors; + /** + * Array of all subgraphs in the model. For details, see {@link SubGraph}. + */ struct SubGraph[] subGraph; -}; \ No newline at end of file +}; + +/** @} */ diff --git a/nnrt/v1_0/NnrtTypes.idl b/nnrt/v1_0/NnrtTypes.idl index 6e6afee2..e8d22177 100644 --- a/nnrt/v1_0/NnrtTypes.idl +++ b/nnrt/v1_0/NnrtTypes.idl @@ -13,220 +13,803 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * It serves as a bridge between the upper-layer AI inference framework and the underlying acceleration chip to implement cross-chip inference computing of AI models. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file NnrtTypes.idl + * + * @brief Defines the types used in the HDI methods. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nnrt.v1_0; +/** + * @brief Defines the shared memory data structure. + * + * @since 3.2 + * @version 1.0 + */ struct SharedBuffer { + /** File descriptor of the shared memory. */ FileDescriptor fd; + /** Size of the shared memory, in bytes. */ unsigned int bufferSize; + /** Offset of the start address of the valid data in the shared memory. */ unsigned int offset; + /** Space occupied by the valid data, in bytes. */ unsigned int dataSize; }; +/** + * @brief Enumerates the AI chip types. + * + * @since 3.2 + * @version 1.0 + */ enum DeviceType: int { + /** Other type */ OTHER, + /** CPU chip */ CPU, + /** GPU chip */ GPU, + /** AI acceleration chip, such as NPU chip and DSP chip */ ACCELERATOR }; +/** + * @brief Enumerates the AI chip states. + * + * @since 3.2 + * @version 1.0 + */ enum DeviceStatus: int { + /** Available. */ AVAILABLE, + /** Busy. The chip in this state may not respond to computing tasks in a timely manner. */ BUSY, + /** Offline. The chip in this state cannot respond to computing tasks. */ OFFLINE, + /** Unknown state. */ UNKNOWN }; +/** + * @brief Enumerates the performance modes for a chip to perform AI computing. + * + * @since 3.2 + * @version 1.0 + */ enum PerformanceMode: int { + /** No performance mode is specified. The specific running mode is defined by the chip. */ PERFORMANCE_NONE, + /** Low-performance mode, which provides slow AI computing but low power consumption. */ PERFORMANCE_LOW, + /** Medium-performance mode, which provides moderate computing speed and power consumption. */ PERFORMANCE_MEDIUM, + /** High-performance mode, which provides fast AI computing but high power consumption. */ PERFORMANCE_HIGH, + /** Extreme-performance mode, which provides the fastest AI computing but highest power consumption. */ PERFORMANCE_EXTREME }; +/** + * @brief Enumerates the AI computing task priorities. + * + * @since 3.2 + * @version 1.0 + */ enum Priority: int { + /** No task priority is specified. The specific execution policy is defined by the chip. */ PRIORITY_NONE, + /** Low priority. A task with a higher priority will be executed first. */ PRIORITY_LOW, + /** Medium priority. A task with a higher priority will be executed first. */ PRIORITY_MEDIUM, + /** High priority. High-priority tasks are executed first. */ PRIORITY_HIGH }; +/** + * @brief Defines the parameters required for model building. + * + * @since 3.2 + * @version 1.0 + */ struct ModelConfig { + /** Whether to run a Float32 model in Float16 precision. */ boolean enableFloat16; + /** Performance mode of the computing task. For details, see {@link PerformanceMode}. */ enum PerformanceMode mode; + /** Priority of the computing task. For details, see {@link Priority}. */ enum Priority priority; }; +/** + * @brief Enumerates the operator data formats. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 1.0 + */ enum Format : byte { + /** Format initial value. */ FORMAT_NONE = -1, + /** NCHW, which indicates the number of data samples, image channels, image height, and image width in sequence. */ FORMAT_NCHW = 0, + /** NHWC. */ FORMAT_NHWC = 1 }; +/** + * @brief Defines the quantization parameter structure. + * + * In the following formula, q is a quantized parameter, r is a real parameter, \f$ r_{max} \f$ is the maximum value of the data to be quantized, \f$ r_{min} \f$ is the minimum value of the data to be quantized, and round(x) means to round off x to an integer. + \f[ + \text{clamp}(x,min,max) = + \begin{cases} + \text{max} & \text{ if } x > \text{ max } \\ + \text{min} & \text{ if } x < \text{ min } \\ + x & \text{ otherwise } \\ + \end{cases} + \f] + * Formula for transforming a real number from a floating-point representation to a fixed-point representation: + \f[ + \text{q}(x_i) = clamp(round(\frac{r}{scale}+zeroPoint), min , max) + \f] + * Formula for transforming a real number from a fixed-point representation to a floating-point representation: + \f[ + \text{r}= (q-zeroPoint)*scale + \f] + * scale is calculated by using the following formula: + \f[ + scale = \frac{r_{max}-r_{min}}{q_{max}-q_{min}} + \f] + * zeroPoint is calculated by using the following formula: + \f[ + zeroPoint = round(q_{min}-\frac{r_{min}}{scale}) + \f] + * \f$ q_{min},q_{max} \f$ is calculated by using the following formula: + \f[ + q_{min} = -(1<<(numBits-1)) + \f] + \f[ + q_{max} = (1<<(numBits-1))-1 + \f] + * When \f$ r_{min} \f$ and \f$ r_{max} \f$ are 0, scale and zeroPoint must be 0. + * + * @since 3.2 + * @version 1.0 + */ struct QuantParam { + /** Number of quantized bits */ int numBits; + /** Zero value */ int zeroPoint; + /** Step of the quantizer. */ double scale; }; +/** + * @brief Enumerates the tensor data types. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 1.0 + */ enum DataType : byte { + /** Unknown type. */ DATA_TYPE_UNKNOWN = 0, + /** Boolean. */ DATA_TYPE_BOOL = 30, + /** INT8. */ DATA_TYPE_INT8 = 32, + /** INT16. */ DATA_TYPE_INT16 = 33, + /** INT32. */ DATA_TYPE_INT32 = 34, + /** INT64. */ DATA_TYPE_INT64 = 35, + /** UINT8. */ DATA_TYPE_UINT8 = 37, + /** UINT16. */ DATA_TYPE_UINT16 = 38, + /** UINT32. */ DATA_TYPE_UINT32 = 39, + /** UINT64. */ DATA_TYPE_UINT64 = 40, + /** FLOAT16. */ DATA_TYPE_FLOAT16 = 42, + /** FLOAT32. */ DATA_TYPE_FLOAT32 = 43, + /** FLOAT64. */ DATA_TYPE_FLOAT64 = 44, }; +/** + * @brief Defines the input and output tensors of an AI model. + * + * @since 3.2 + * @version 1.0 + */ struct IOTensor { + /** Tensor name. */ String name; + /** Data type of the tensor. For details, see {@link DataType}. */ enum DataType dataType; + /** Dimensions of the tensor. */ int[] dimensions; + /** Format of the tensor. For details, see {@link Format}. */ enum Format format; + /** Tensor data, which is stored in the shared memory. For details about the shared memory, see {@link SharedBuffer}. */ struct SharedBuffer data; }; +/** + * @brief Enumerates the quantization types. This parameter must be used together with {@link Node}. + * + * @since 3.2 + * @version 1.0 + */ enum QuantType: byte { + /** Do not use quantification. */ QUANT_TYPE_NONE, + /** INT8 quantization. */ QUANT_TYPE_ALL, }; +/** + * @brief Enumerates the operator types. + * + * @since 3.2 + * @version 1.0 + */ enum NodeType : unsigned int { + /** None. */ NODE_TYPE_NONE = 0, + /** Activation function */ NODE_TYPE_ACTIVATION = 2, + /** ADD operator */ NODE_TYPE_ADD_FUSION = 5, + /** ArgMax operator */ NODE_TYPE_ARGMAX_FUSION = 11, + /** AVGPOOL operator */ NODE_TYPE_AVGPOOL_FUSION = 17, + /** BatchToSpaceND operator */ NODE_TYPE_BATCH_TO_SPACE_ND = 22, + /** BiasAdd operator */ NODE_TYPE_BIAS_ADD = 23, + /** Cast operator */ NODE_TYPE_CAST = 28, + /** Concat operator */ NODE_TYPE_CONCAT = 31, + /** Conv2D operator, including common convolution, separable convolution, and group convolution */ NODE_TYPE_CONV2D_FUSION = 35, + /** Two-dimensional deconvolution operator */ NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, + /** Div operator */ NODE_TYPE_DIV_FUSION = 47, + /** Element-level operator */ NODE_TYPE_ELTWISE = 52, + /** ExpandDims operator */ NODE_TYPE_EXPAND_DIMS = 56, + /** Fill operator */ NODE_TYPE_FILL = 66, + /** FullConnection operator */ NODE_TYPE_FULL_CONNECTION = 67, + /** BatchNorm operator */ NODE_TYPE_FUSED_BATCH_NORM = 68, + /** Gather operator */ NODE_TYPE_GATHER = 69, + /** LayerNorm operator */ NODE_TYPE_LAYER_NORM_FUSION = 75, + /** LessEqual operator */ NODE_TYPE_LESS_EQUAL = 78, + /** MatMul operator */ NODE_TYPE_MATMUL_FUSION = 89, + /** Maximum operator */ NODE_TYPE_MAXIMUM = 90, + /** MaxPool operator */ NODE_TYPE_MAX_POOL_FUSION = 92, + /** Mul operator */ NODE_TYPE_MUL_FUSION = 99, + /** OneHot operator */ NODE_TYPE_ONE_HOT = 105, + /** Pad operator */ NODE_TYPE_PAD_FUSION = 107, + /** Pow operator */ NODE_TYPE_POW_FUSION = 110, + /** PReLU operator */ NODE_TYPE_PRELU_FUSION = 112, + /** QuantDTypeCast operator */ NODE_TYPE_QUANT_DTYPE_CAST = 113, + /** Reduce operator */ NODE_TYPE_REDUCE_FUSION = 118, + /** Reshape operator */ NODE_TYPE_RESHAPE = 119, + /** Resize operator */ NODE_TYPE_RESIZE = 120, + /** Rsqrt operator */ NODE_TYPE_RSQRT = 126, + /** Scale operator */ NODE_TYPE_SCALE_FUSION = 127, + /** Shape operator */ NODE_TYPE_SHAPE = 130, + /** Slice operator */ NODE_TYPE_SLICE_FUSION = 135, + /** Softmax operator */ NODE_TYPE_SOFTMAX = 138, + /** SpaceToBatchND operator */ NODE_TYPE_SPACE_TO_BATCH_ND = 141, + /** Split operator */ NODE_TYPE_SPLIT = 145, + /** Sqrt operator */ NODE_TYPE_SQRT = 146, + /** SquaredDifference operator */ NODE_TYPE_SQUEEZE = 147, + /** Squeeze operator */ NODE_TYPE_SQUARED_DIFFERENCE = 149, + /** Stack operator */ NODE_TYPE_STACK = 150, + /** StridedSlice operator */ NODE_TYPE_STRIDED_SLICE = 151, + /** Sub operator */ NODE_TYPE_SUB_FUSION = 152, + /** Tile operator */ NODE_TYPE_TILE_FUSION = 160, + /** TopK operator */ NODE_TYPE_TOPK_FUSION = 161, + /** Transpose operator */ NODE_TYPE_TRANSPOSE = 162, + /** Unsqueeze operator */ NODE_TYPE_UNSQUEEZE = 165, }; +/** + * @brief Enumerates the resize methods. It must be used together with the {@link Resize} operator. + * + * @since 3.2 + * @version 1.0 + */ enum ResizeMethod : byte { + /** Unknown. This is the default value. */ RESIZE_METHOD_UNKNOWN = -1, + /** Bilinear interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2), Q_{21} = (x_2, y_1), and Q_{22} = (x_2, y_2) \f$. + * \f$f(Q_{11}), f(Q_{12}), f(Q_{21}), and f(Q_{22}) \f$ represent the values of the four points. The value of \f$ f(x,y) \f$ can be calculated by using the following formula: + \f[ + f(x,y_1) = \frac{x_2-x}{x_2-x_1}f(Q_{11})+\frac{x-x_1}{x_2-x_1}f(Q_{21}) + \f] + + \f[ + f(x,y_2) = \frac{x_2-x}{x_2-x_1}f(Q_{12})+\frac{x-x_1}{x_2-x_1}f(Q_{22}) + \f] + + \f[ + f(x,y) = \frac{y_2-y}{y_2-y_1}f(x,y_1)+\frac{y-y_1}{y_2-y_1}f(x,y_2) + \f] + */ RESIZE_METHOD_LINEAR = 0, + /** Nearest neighbor interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2), Q_{21} = (x_2, y_1), and Q_{22} = (x_2, y_2) \f$. + * Then, the value of the point closest to the point \f$(x,y) \f$ is the value of \f$ f(x,y) \f$. + */ RESIZE_METHOD_NEAREST = 1, + /** Bicubic interpolation. + * Bicubic interpolation obtains the value of a sampling point by calculating the weighted average of the values of 16 points around the sampling point. This parameter must be used together with cubicCoeff and coordinateTransformMode of {@link Resize}. + * When coordinateTransformMode==COORDINATE_TRANSFORM_MODE_HALF_PIXEL, cubicCoeff is -0.5. In other cases, cubicCoeff is -0.75. The weight function of the interpolation is as follows: + \f[ + W(x) = + \begin{cases} + (cubicCoeff+2)|x|^3 - (cubicCoeff+3)|x|^2 +1 , &\text{if } |x| \leq 1; \cr + cubicCoeff|x|^3 - 5cubicCoeff|x|^2 + 8cubicCoeff|x| - 4a, &\text{if } 1 \lt |x| \leq 2; \cr + 0, &\text{otherwise.} + \end{cases} + \f] + */ RESIZE_METHOD_CUBIC = 2 }; +/** + * @brief Enumerates the coordinate transformation modes. Only the {@link Resize} operator uses this parameter. + * For example, the width coordinates are transformed, where: + * new_i is the ith coordinate of the resized tensor along the x axis. + * old_i is the coordinate of the input tensor along the x axis. + * newWidth is the length of the resized tensor along the x axis. + * oldWidth is the length of the input tensor along the x axis. + * old_i can be calculated by using the following formula: + * + * COORDINATE_TRANSFORM_MODE_ASYMMETRIC: \f$ old_i = newWidth != 0 ? new_i * oldWidth / newWidth : 0 \f$
+ * COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS: \f$ old_i = newWidth != 1 ? new_i * (oldWidth - 1) / (newWidth - 1) \f$
+ * COORDINATE_TRANSFORM_MODE_HALF_PIXEL: \f$ old_i = newWidth > 1 ? (new_x + 0.5) * oldWidth / newWidth - 0.5 : 0 \f$
+ * + * @since 3.2 + * @version 1.0 + */ enum CoordinateTransformMode : byte { + /** Scale based on the ratio without alignment. */ COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, + /** Align the four corners of the image. */ COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, + /** Align with the pixel center. */ COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 }; +/** + * @brief Enumerates the nearest neighbor interpolation types. It must be used together with the {@link Resize} operator. + * + * @since 3.2 + * @version 1.0 + */ enum NearestMode : byte { + /** Round off. */ NEAREST_MODE_NORMAL = 0, + /** Round toward negative infinity. For example, 23.5 is rounded to 23, and −23.5 is rounded to −24. */ NEAREST_MODE_ROUND_HALF_DOWN = 1, + /** Round toward positive infinity. For example, 23.5 is rounded to 24, and −23.5 is rounded to −23. */ NEAREST_MODE_ROUND_HALF_UP = 2, + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down to −24. */ NEAREST_MODE_FLOOR = 3, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ NEAREST_MODE_CEIL = 4 }; +/** + * @brief Enumerates the activation function types. Activation functions introduce nonlinearity to neural networks. This allows the use of neural network models in nonlinear models. + * If an operator in the {@link NodeAttrTypes.idl} file has ActivationType parameters, the corresponding activation function will be called after the operator calculation is complete. + * + * @since 3.2 + * @version 1.0 + */ enum ActivationType : byte { + /** No activation function. */ ACTIVATION_TYPE_NO_ACTIVATION = 0, + /** + * ReLU activation function. + * ReLU calculates \f$ max(x_i, 0) \f$ element by element. It outputs the value directly if it is positive; otherwise, it outputs 0. + \f[ + \text{ReLU}(x_i) = (x_i)^+ = \max(x_i, 0), + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU = 1, + /** + * Sigmoid activation function. + * Execute the sigmoid activation function element-wise. + * The sigmoid function is defined as follows: + \f[ + \text{Sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SIGMOID = 2, + /** + * ReLU6 activation function. + * ReLU6 is similar to ReLU. The difference is ReLU6 has an upper limit of 6. If the input is greater than 6, the output is limited to 6. + * The ReLU6 function is defined as follows: + \f[ + \text{ReLU6}(x_i) = \min(\max(0, x_i), 6) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU6 = 3, + /** + * Exponential Linear Unit (ELU) activation function. + * ELU calculates the ELU for each input element. + * The ELU function is defined as follows: + \f[ + ELU(x_{i}) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + \alpha * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter, which is set by {@link Activation}. + */ ACTIVATION_TYPE_ELU = 4, + /** + * LeakyReLU activation function. + * The LeakyReLU function is defined as follows: + \f[ + \text{LeakyReLU}(x_i) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + {\alpha} * x_i, &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter, which is set by {@link Activation}. + */ ACTIVATION_TYPE_LEAKY_RELU = 5, + /** + * Activation function for calculating the absolute value. + * The function is defined as follows: + \f[ + \text{abs}(x_i) = |x_i| + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_ABS = 6, + /** + * ReLU1 activation function. + * The ReLU1 function is defined as follows: + \f[ + \text{ReLU1}(x_i)= \min(\max(0, x_i), 1) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU1 = 7, + /** + * SoftSign activation function. + * The SoftSign function is defined as follows: + \f[ + \text{SoftSign}(x_i) = \frac{x_i}{1 + |x_i|} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SOFTSIGN = 8, + /** + * Softplus activation function. + * Softplus is a smooth approximation to ReLU. It can be used to constrain the output to always be positive. + * The Softplus function is defined as follows: + \f[ + \text{Softplus}(x_i) = \log(1 + \exp(x_i)) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SOFTPLUS = 9, + /** + * Tanh activation function. + * The Tanh function is defined as follows: + \f[ + tanh(x) = \frac{\exp(x_i) - \exp(-x_i)}{\exp(x_i) + \exp(-x_i)} = \frac{\exp(2x_i) - 1}{\exp(2x_i) + 1} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_TANH = 10, + /** + * Scaled exponential Linear Unit (SELU) activation function. + * The SELU function is defined as follows: + \f[ + SELU(x_{i}) = + scale * + \begin{cases} + x_{i}, &\text{if } x_{i} \geq 0; \cr + \text{alpha} * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ is the input element, and \f$ \alpha \f$ and \f$ scale \f$ are predefined constants (\f$ \alpha = 1.67326324 \f$, \f$ scale = 1.05070098 \f$). + */ ACTIVATION_TYPE_SELU = 11, + /** + * Hard Swish activation function. + * + \f[ + \text{Hardswish}(x_{i}) = x_{i} * \frac{ReLU6(x_{i} + 3)}{6} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSWISH = 12, + /** + * Hard sigmoid activation function. + * The hard sigmoid function is defined as follows: + \f[ + \text{Hardsigmoid}(x_{i}) = max(0, min(1, \frac{x_{i} + 3}{6})) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSIGMOID = 13, + /** + * ThresholdedReLU activation function. + * ThresholdedReLU is similar to ReLU. The ThresholdedReLU function is defined as follows: + \f[ + \text{ThresholdedReLU}(x_i) = \min(\max(0, x_i), t) + \f] + * \f$ x_i \f$ is the input element, and \f$ t \f$ is the maximum value. + */ ACTIVATION_TYPE_THRESHOLDRELU = 14, + /** + * Linear activation function. + * The Linear function is defined as follows: + \f[ + \text{Linear}(x_i) = x_i + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_LINEAR = 15, + /** + * HardTanh activation function. + * The HardTanh function is defined as follows: + \f[ + \text{HardTanh}(x_i) = + \begin{cases} + \text{max_val} & \text{ if } x_i > \text{ max_val } \\ + \text{min_val} & \text{ if } x_i < \text{ min_val } \\ + x_i & \text{ otherwise } \\ + \end{cases} + \f] + * \f$ x_i \f$ is the input, \f$ max\_val \f$ is the maximum value, and \f$ min\_val \f$ is the minimum value. The two parameters are set by {@link Activation}. + */ ACTIVATION_TYPE_HARD_TANH = 16, + /** + * Sign activation function. + * The Sign function is defined as follows: + \f[ + Sign(x_i) = \begin{cases} -1, &if\ x_i < 0 \cr + 0, &if\ x_i = 0 \cr + 1, &if\ x_i > 0\end{cases} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SIGN = 17, + /** + * Swish activation function. + * The Swish function is defined as follows: + \f[ + \text{Swish}(x_i) = x_i * Sigmoid(x_i) + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SWISH = 18, + /** + * Gaussian error linear unit (GELU) activation function. + * The GELU function is defined as follows: + \f[ + GELU(x_i) = x_i*P(X < x_i) + \f] + * \f$ x_i \f$ is the input element, and \f$ P \f$ is a cumulative distribution function of the standard Gaussian distribution. + * You need to use the approximate parameter of {@link Activation} to specify whether to use approximation. + */ ACTIVATION_TYPE_GELU = 19, + /** Unknown */ ACTIVATION_TYPE_UNKNOWN = 20 }; +/** + * @brief Enumerates the modes for removing dimensions. It must be used together with the {@link ReduceFusion} operator. + * + * @since 3.2 + * @version 1.0 + */ enum ReduceMode : byte { + /** Use the average value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MEAN = 0, + /** Use the maximum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MAX = 1, + /** Use the minimum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MIN = 2, + /** Use the product of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_PROD = 3, + /** Use the sum of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM = 4, + /** Use the sum of squares of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM_SQUARE = 5, + /** Use the sum of absolute values of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ASUM = 6, + /** Use the logical AND of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ALL = 7 }; +/** + * @brief Enumerates the calculation types supported by elements. It must be used together with the {@link Eltwise} operator. + * + * @since 3.2 + * @version 1.0 + */ enum EltwiseMode : byte { + /** Product of the elements of two tensors */ ELTWISE_MODE_PROD = 0, + /** Difference between the elements of two tensors */ ELTWISE_MODE_SUM = 1, + /** Maximum value of the elements of two tensors */ ELTWISE_MODE_MAXIMUM = 2, + /** Unknown type */ ELTWISE_MODE_UNKNOWN = 3 }; +/** + * @brief Enumerates the padding types. It must be used together with {@link AvgPoolFusion}, {@link AvgPoolFusion}, {@link Conv2DFusion}, and {@link MaxPoolFusion}. + * + * @since 3.2 + * @version 1.0 + */ enum PadMode : byte { + /** + * Adds 0s in the input height and width directions. + * If this mode is used, the padding parameter of the operator must be greater than or equal to 0. + */ PAD_MODE_PAD = 0, + /** + * The output height and width are obtained by dividing the input height and width by a stride and rounding off the quotient to an integer. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_SAME = 1, + /** + * Return the output of a valid calculation without padding. Pixels that do not meet the calculation requirements will be discarded. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_VALID = 2, }; +/** + * @brief Enumerates the algorithms for rounding off decimals. It must be used together with the {@link AvgPoolFusion} operator. + * + * @since 3.2 + * @version 1.0 + */ enum RoundMode : byte { + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down to −24. */ ROUND_MODE_FLOOR = 0, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ ROUND_MODE_CEIL = 1 }; +/** + * @brief Enumerates the padding modes. It must be used together with the {@link PadFusion} operator. + * + * When x is \f$[[1,2,3],[4,5,6],[7,8,9]]\f$ and paddingsis \f$[[2,2], [2,2]] \f$, the effect is as follows:
+ * If paddingMode==PADDING_MODE_CONSTANT and constantValue = 0, the output is as follows: + * + \f$[[0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 1. 2. 3. 0. 0.],\\ + [0. 0. 4. 5. 6. 0. 0.],\\ + [0. 0. 7. 8. 9. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_REFLECT, the output is as follows: + * + \f$[[9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_SYMMETRIC, the output is as follows: + * + \f$[[5. 4. 4. 5. 6. 6. 5.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [5. 4. 4. 5. 6. 6. 5.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [5. 4. 4. 5. 6. 6. 5.]]\\ \f$ + * + * + * + * @since 3.2 + * @version 1.0 + */ + enum PaddingMode : byte { + /** Constant (0 by default) padding. */ PADDING_MODE_CONSTANT = 0, + /** Reflection padding, which uses the content next to the input data to pad the values directly next to it. */ PADDING_MODE_REFLECT = 1, + /** Symmetric padding, which is similar to {@link PADDING_MODE_REFLECT}. Symmetric padding makes a copy of the input. */ PADDING_MODE_SYMMETRIC = 2, + /** Reserved. */ PADDING_MODE_RESERVED = 3 -}; \ No newline at end of file +}; + +/** @} */ diff --git a/nnrt/v1_0/NodeAttrTypes.idl b/nnrt/v1_0/NodeAttrTypes.idl index 658d45ef..9d694649 100644 --- a/nnrt/v1_0/NodeAttrTypes.idl +++ b/nnrt/v1_0/NodeAttrTypes.idl @@ -13,303 +13,1378 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. * Neural Network Runtime (NNRt) is cross-chip inference computing runtime oriented to the AI field. + * It serves as a bridge between the upper-layer AI inference framework and the underlying acceleration chip to implement cross-chip inference computing of AI models. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file NodeAttrTypes.idl + * + * @brief Defines the parameters and functions of AI model operators. + * + * All structures in this file declare only operator attributes and do not contain the interfaces for executing operator functions. + * - 1. The operators in the file are in one-to-one correspondence with a {@link NodeType}. In model inference, {@link NodeType} is stored in nodeType of {@link Node}. + * - 2. Each operator has at least one input and one output. The input is the tensor received by the operator, and the output is the tensor obtained after the operator operation. The relationship between the input, operator, and output is determined by inputIndex and outIndex of the {@link Node} structure. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 1.0 + */ package ohos.hdi.nnrt.v1_0; import ohos.hdi.nnrt.v1_0.NnrtTypes; +/** + * @brief Defines the operator of the activation type. All activation functions belong to this operator. The specific activation function type is determined by the parameters. + * + * The {@link NodeType} of this operator is NODE_TYPE_ACTIVATION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * A tensor returned after the activation function is executed. + * + * @since 3.2 + * @version 1.0 + */ struct Activation { + /** Activation function type. */ enum ActivationType activationType; + /** Size factor, used for LeakyReLU and ELU activation functions. */ float alpha; + /** Minimum value, used for the HardTanh activation function. */ float minVal; + /** Maximum value, used for the HardTanh activation function. */ float maxVal; + /** Whether to use the approximation algorithm. It is used for the GRLU activation function. */ boolean approximate; }; +/** + * @brief Adds tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_ADD_FUSION. + * + * Inputs: + * + * * x, the first input tensor. + * * y, the second input tensor. The data type must be the same as that of the first tensor. + * + * * Outputs: + * + * * Sum of the elements of x and y. The data shape is the same as the one after broadcasting, and the data type is the one with higher precision of the two inputs. + * If activationType is configured, the specified activation function will be called before the output is returned. + * + * @since 3.2 + * @version 1.0 + */ struct AddFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Returns the first K indices or values of a cross-axis tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_ARGMAX_FUSION. + * + * + * Inputs: + * + * * x, a tensor of shape (N,*), where * indicates any number of additional dimensions. + * + * Outputs: + * + * * First K indices or values before the maximum input tensor on the axis. + * + * @since 3.2 + * @version 1.0 + */ struct ArgMaxFusion { + /** Target axis where the maximum indices or values are obtained. */ long axis; + /** First K maximum values on the axis. */ long topK; + /** Whether to keep the output dimensions the same as the input dimensions. */ boolean keepDims; + /** Return the index if the value is false. Return the value if the value is true. The default value is false. */ boolean outMaxValue; }; +/** + * @brief Applies a 2D average pooling on the input tensor. The int8 quantization input is supported. + * + * The {@link NodeType} of this operator is NODE_TYPE_AVGPOOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. In other cases, padding must be 0. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * Tensor after average pooling. + * + * @since 3.2 + * @version 1.0 + */ struct AvgPoolFusion { + /** + * Kernel size used to obtain the average value. It is an int array [kernel_height, kernel_weight] with length of 2. + * The first number indicates the kernel height, and the second number indicates the kernel width. + */ long[] kernelSize; + /** + * Distance of kernel moving. The value is an int array [stride_height, stride_weight] with length of 2. + * The first number indicates the moving size in height, and the second number indicates the moving size in width. + */ long[] strides; + /** x is padded with an int array [top, bottom, left, right] with length of 4, and the nearest neighbor values are used for padding. */ long[] pad; + /** Padding method */ enum PadMode padMode; + /** Numerical operation mode of the output tensor */ enum RoundMode roundMode; + /** Format of the data during calculation. For details, see {@link Format}. */ enum Format format; + /** Whether to do global pooling */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks back into the spatial dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_BATCH_TO_SPACE_ND. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * Output tensor. Assume that the shape of x is (n,h,w,c) and the shape of output is (n',h',w',c'): + * \f$ n' = n / (block_shape[0] * block_shape[1])\f$
+ * \f$ h' = h * block_shape[0] - crops[0][0] - crops[0][1] \f$
+ * \f$ w' = w * block_shape[1] - crops[1][0] - crops[1][1] \f$
+ * \f$ c'= c \f$ + * + * @since 3.2 + * @version 1.0 + */ struct BatchToSpaceND { + /** Block size, which is an array [height_block, weight_block] with length of 2. */ long[] blockShape; + /** + * Crop values for the spatial dimension. + * It is a 2D array [crop0_start, crop0_end], [crop1_start, crop1_end] with the shape of (2, 2). + */ long[][] crops; }; +/** + * @brief Offsets the data in each dimension of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_BIAS_ADD. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * bias, the bias tensor. + * + * Outputs: + * + * * Output tensor, which is the sum of the input tensor and the bias in each dimension. + * + * @since 3.2 + * @version 1.0 + */ struct BiasAdd { }; +/** + * @brief Converts the tensor data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_CAST. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * type, the target type of the data. + * + * Outputs: + * + * * A tensor with the specified data type. + * + * @since 3.2 + * @version 1.0 + */ struct Cast { }; +/** + * @brief Connects tensors in the specified axis or connects input tensors along with the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONCAT. + * + * Inputs: + * + * * Tensors with the same dimension. + * + * Outputs: + * + * * Result of the tensors connected. + * + * @since 3.2 + * @version 1.0 + */ struct Concat { + /** Axis specified. The value must be less than the number of dimensions of the input tensor. */ long axis; }; +/** + * @brief Calculates the 2D convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. In other cases, padding must be 0. + * + * Inputs: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with length of [outChannel]. In the quantization scenario, bias does not need to be quantized. + * If quantization is required, the input data must be of the int32 type. The actual quantization parameter is determined by x and weight. + * + * Outputs: + * + * * Convolution output. + * + * @since 3.2 + * @version 1.0 + */ struct Conv2DFusion { + /** Size (height and width) of the convolution kernel */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight. It is an int array [strideHeight, strideWidth] with length of 2. */ long[] stride; + /** + * Dilation size of the convolution kernel in height and weight. It is an int array [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around x in the height and width directions. It is an int array [top, bottom, left, right] with length of 4. */ long[] padList; + /** + * Splits x into groups by inChannel. The group value is of the int type. + * If group is 1, it is a conventional convolution. + * If group is inChannel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. + * If group is greater than 1 and less than inChannel, it is group convolution. In this case, out_channel==group. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates a 2D transposed convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_TRANSPOSE_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. In other cases, padding must be 0. + * + * Inputs: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with length of [outChannel]. In the quantization scenario, bias does not need to be quantized. + * If quantization is required, the input data must be of the int32 type. The actual quantization parameter is determined by x and weight. + * + * Outputs: + * + * * N-dimensional tensor. + * + * @since 3.2 + * @version 1.0 + */ struct Conv2dTransposeFusion { + /** Size (height and width) of the convolution kernel */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight. It is an int array [strideHeight, strideWidth] with length of 2. */ long[] stride; + /** Dilation size of the convolution kernel in height and weight. It is an int array [dilationHeight, dilationWidth] with length of 2. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around the input x in the height and width directions. It is an int array [top, bottom, left, right] with length of 4. */ long[] padList; + /** + * Splits x into groups by inChannel. + * If group is 1, it is a conventional convolution. + * If group is greater than 1 and less than or equal to inChannel, this is a group convolution. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; + /** + * A list of integer array with two elements, specifying the paddings along the height and width of the output tensor. + */ long[] outputPaddings; }; +/** + * @brief Divides the first tensor by the second tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_DIV_FUSION. + * + * Inputs: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Outputs: + * + * * Quotient of the two inputs. + * + * @since 3.2 + * @version 1.0 + */ struct DivFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs an element-wise operation. + * + * The {@link NodeType} of this operator is NODE_TYPE_ELTWISE. + * + * Inputs: + * + * * x1, the first input tensor. + * * x2, the second input tensor. + * + * Outputs: + * + * * A tensor with the same data type and shape as x1. + * + * @since 3.2 + * @version 1.0 + */ struct Eltwise { + /** Element-wise operation type. For details, see {@link EltwiseMode}. */ enum EltwiseMode mode; }; +/** + * @brief Adds an additional dimension to a tensor at the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_EXPAND_DIMS. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * axis, index of the dimension to add. The value is of the int32_t type and must be a constant in the range [-dim-1, dim]. + * + * Outputs: + * + * * Operator with an additional dimension at the given axis. + * + * @since 3.2 + * @version 1.0 + */ struct ExpandDims { }; +/** + * @brief Creates a tensor of the specified dimensions and fills it with a scalar. + * + * The {@link NodeType} of this operator is NODE_TYPE_FILL. + * + * Inputs: + * + * * value, a scalar used to fill the tensor. + * * shape, which specifies the dimensions of the tensor to create. + * Outputs: + * + * *Tensor filled by the scaler. + * + * @since 3.2 + * @version 1.0 + */ struct Fill { }; +/** + * @brief Applies full connection for the input data. + * + * The {@link NodeType} of this operator is NODE_TYPE_FULL_CONNECTION. + * + * When useAxis is true, axis must be set. When useAxis is false, axis is 0. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * weight, a weight tensor for a full connection. + * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required. If quantization is required, the data must be of the int32 type. The actual quantization parameter is determined by x and weight. + * * + * Outputs: + * + * * Normalized tensor. + * + * @since 3.2 + * @version 1.0 + */ struct FullConnection { + /** Whether to use the bias. */ boolean hasBias; + /** Whether to use the axis. */ boolean useAxis; + /** Axis specified for the full connection. The specified axis and its following axes are converted into a 1D tensor and then apply the full connection. */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs batch normalization for a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_FUSED_BATCH_NORM. + * + * Inputs: + * + * * x: a tensor of shape [N, ..., C], that is, the nth dimension is the number of channels. + * * scale, a 1D tensor of the scaling factor used to scale the first normalized tensor. + * * offset, a 1D tensor used to move to the first normalized tensor. + * * mean, a 1D tensor of the overall mean value. It is used only for inference. In case of training, this parameter must be left empty. + * * variance, a 1D tensor used for the overall variance. It is used only for inference. In case of training, this parameter must be left empty. + * + * Outputs: + * + * * Normalized tensor. + * + * @since 3.2 + * @version 1.0 + */ struct FusedBatchNorm { + /** A small value close to zero. It is used to ensure that the divisor is not 0. */ float epsilon; }; +/** + * @brief Returns the slice of the input tensor based on the specified index and axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_GATHER. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * inputIndices, indices of elements of the original tensor. The value is an array of the int type and must be in the range [0, x.shape[axis]). + * * axis, the axis on which x is sliced. The value is an array with one element of the int32_t type. + * + * Outputs: + * + * * Sliced tensor. + * + * @since 3.2 + * @version 1.0 + */ struct Gather { }; +/** + * @brief Applies layer normalization for a tensor from the specified axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_LAYER_NORM_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * gamma, an m-dimensional tensor. The dimensions of gamma must be the same as the shape of the part of the input tensor to normalize. + * * beta, an m-dimensional tensor with the same shape as gamma. + * + * Outputs: + * + * * An n-dimensional tensor, with the same data type and shape as the input tensor. + * + * @since 3.2 + * @version 1.0 + */ struct LayerNormFusion { + /** Start axis of x to apply layer normalization. */ long beginNormAxis; + /** A value added to the denominator for numerical stability. */ float epsilon; + /** Whether to perform an element-wise operation. */ boolean elementwiseAffine; + /** Start axis of the parameter input (gamma, beta) to apply layer normalization. The value must be in the range [-n, n). */ long beginParamsAxis; }; +/** + * @brief Calculates the result of x1 <= x2 element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LESS_EQUAL. + * + * Inputs: + * + * * x1, which can be a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * x2, which can be a number or a Boolean value if x1 is a tensor; or a tensor with the data type of number or Boolean if x1 is not a tensor. + * + * Outputs: + * + * * A tensor with the data type of Boolean. When a quantization model is used, the quantization parameters of the output cannot be omitted. However, values of the quantization parameters do not affect the result. + * + * @since 3.2 + * @version 1.0 + */ struct LessEqual { }; +/** + * @brief Calculates the matrix product of x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_MATMUL_FUSION. + * + * Inputs: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Outputs: + * + * * Matrix product of the inputs. When type! When = DATA_TYPE_UNKNOWN, the data type of the output is determined by type. When type==DATA_TYPE_UNKNOWN, + * the data type of the output depends on the data type converted during the calculation of x1 and x2. + * + * @since 3.2 + * @version 1.0 + */ struct MatMulFusion { + /** Whether to transpose the x1 matrix. */ boolean transposeA; + /** Whether to transpose the x2 matrix. */ boolean transposeB; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates the maximum of x1 and x2 element-wise. The inputs of x1 and x2 comply with the implicit type conversion rules to make the data types are consistent. + * + * The inputs must be two tensors or one tensor and one scalar. When the input is two tensors, the data types cannot be Boolean at the same time, and their shapes + * can be broadcast to the same. When the inputs are one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAXIMUM. + * + * Inputs: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Outputs: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 1.0 + */ struct Maximum { }; +/** + * @brief Applies a 2D maximum pooling over an input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAX_POOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. In other cases, padding must be 0. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 1.0 + */ struct MaxPoolFusion { + /** Size of the kernel used to take the maximum value. It is an int array [kernel_height, kernel_weight] with length of 2. */ long[] kernelSize; + /** Distance of kernel moving. It is an int array with two elements. */ long[] strides; + /** Array to pad. */ long[] pad; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** Whether to do global pooling */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Multiplies the elements in the same position of x1 and x2 to obtain output. + * + * If the shapes of x1 and x2 are different, expand x1 and x2 to the same shape through broadcast and then perform the multiplication. + * The {@link NodeType} of this operator is NODE_TYPE_MUL_FUSION. + * + * Inputs: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Outputs: + * + * * Product of each element of x1 and x2. + * + * @since 3.2 + * @version 1.0 + */ struct MulFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Generates a one-hot tensor based on the specified locations. + * + * The locations specified by indices are determined by on_value, and other locations are determined by off_value. + * + * The {@link NodeType} of this operator is NODE_TYPE_ONE_HOT. + * + * Inputs: + * + * * indices, an n-dimensional tensor. Each element in indices determines the location of on_value in each one-hot vector. + * * depth, an integer scalar that determines the depth of the one-hot vector. The value of depth must be greater than 0. + * * on_value, a scalar that specifies a valid value in the one-hot vector. + * * off_value, a scalar that specifies the values of other locations in the one-hot vector except the valid value. + * + * Outputs: + * + * * An (n+1)-dimensional tensor if indices is an n-dimensional tensor. The output shape is determined by indices and axis. + * + * @since 3.2 + * @version 1.0 + */ struct OneHot { + /** + * An integer scalar that specifies the dimension for inserting the one-hot. Assume that the shape of indices is [N, C], and the value of depth is D. + * When axis is 0, the shape of the output is [D, N, C]. + * When axis is -1, the shape of the output is [N, C, D]. + * When axis is -1, the shape of the output is [N, D, C]. + * + */ long axis; }; +/** + * @brief Pads the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_PAD_FUSION. + * + * When paddingMode==PADDING_MODE_CONSTANT, constantValue must be set. The default value of constantValue is 0. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * paddings, a 2D tensor that specifies the length to add in each dimension. The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input tensor in ith dimension. + * paddings[i][1] indicates the number of paddings to add after the input tensor in ith dimension. + * + * Outputs: + * + * * An n-dimensional tensor after padding, with the same dimensions and data type as x. The shape is determined by x and paddings. + * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1]. + * + * @since 3.2 + * @version 1.0 + */ struct PadFusion { + /** + * A 2D tensor, specifying the length to add in each dimension. The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input x in the ith dimension. + * paddings[i][1] indicates the number of paddings to add after the input x in the ith dimension. + * The meaning of this parameter is the same as that of paddings input. + */ long[][] paddings; + /** + * Padding mode. + * For details, see {@link PaddingMode}. + */ enum PaddingMode paddingMode; + /** + * A constant with the same data type as x. It specifies the value to add in the pad operation. + * This parameter is valid only when paddingMode==PADDING_MODE_CONSTANT. The default value is 0. + */ float constantValue; }; +/** + * @brief Calculates the y power of each element in x. The inputs must be two tensors or one tensor and one scalar. + * + * When the inputs are two tensors, their data types cannot be Boolean at the same time, and their shapes must be the same. When the inputs are one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_POW_FUSION. + * + * The x' = scale*x+shift operation is performed for each element of x, and then the y power of x' is calculated. + * + * Inputs: + * + * * x, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * y, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * + * Outputs: + * + * * A tensor, whose shape is determined by the shape of x and y after broadcasting. + * + * @since 3.2 + * @version 1.0 + */ struct PowFusion { + /** Scale the value of x. */ float scale; + /** Increase or decrease the value of x after scaling. */ float shift; }; +/** + * @brief Applies the PReLU activation of x and weight. + * + * The {@link NodeType} of this operator is NODE_TYPE_PRELU_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. If n is greater than or equal to 2, x must be [BatchSize, ..., Channels]. The second dimension is the number of channels. + * * weight, a 1D tensor. The length of weight must be 1 or equal to the number of channels. If the length of weight is 1, all channels share the same weight. + * If the length of weight is equal to the number of channels, each channel exclusively has a weight. If n of x is less than 2, the weight length must be 1. + * + * Outputs: + * + * * PReLU activation value of x, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct PReLUFusion { + /** + * Whether to enable weight sharing for the parameter validity check. + * If the length of weight is 1, channelShared must be true. Otherwise, channelShared is false. + */ boolean channelShared; }; +/** + * @brief Converts the data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * Tensor after the data type conversion. + * + * @since 3.2 + * @version 1.0 + */ struct QuantDTypeCast { + /** Data type of the input tensor. */ long srcT; + /** Data type of the output tensor. */ long dstT; }; +/** + * @brief Reduces the dimensions of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_REDUCE_FUSION. + * + If mode is REDUCE_ALL, REDUCE_PROD, or REDUCE_MEAN and reduce_to_end is true, the output is the reduced value multiplied by coeff. + * + * Inputs: + * + * * x, an n-dimensional tensor, where n is less than 8. + * * axis, a 1D tensor that specifies the dimension to reduce. The value range of each element in axis is [–n, n). + * + * Outputs: + * + * * An m-dimensional tensor, with the same data type as x. If keepDims is false, m < n. If keepDims is true, m==n. + * + * @since 3.2 + * @version 1.0 + */ struct ReduceFusion { + /** Whether to keep the dimensions remain unchanged. */ boolean keepDims; + /** Algorithm used to reduce the tensor dimensions. For details, see {@link ReduceMode}. */ enum ReduceMode mode; + /** + * If this parameter is set to true, the first element is obtained from axis and set to i, + * and then axis will be changed to [i,i+1, ...,n-1,n]. + * For example, if reduceToEnd is true, axis is [2,4], and the number of dimensions of x is 7, then axis will be [2,3,4,5,6]. + */ boolean reduceToEnd; + /** Coefficient. */ float coeff; }; +/** + * @brief Reshapes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESHAPE. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * InputShape, a 1D tensor that specifies the shape of the output tensor. It must be a constant. + * + * Outputs: + * + * * A tensor of the specified shape. The data type is the same as that of x. + * + * @since 3.2 + * @version 1.0 + */ struct Reshape { }; +/** + * @brief Resizes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESIZE. + * + * The parameter combination of this operator can implement the Resize function. + * For example, to implement bilinear interpolation on the four corners of an image that is precisely aligned, set: + * method = RESIZE_METHOD_LINEAR + * coordinateTransformMode = COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS + * + * Inputs: + * + * * x, a 4D tensor in the [batchSize, height, width, channels] (NHWC) format. + * + * Outputs: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct Resize { + /** Method used for resizing. For details, see {@link ResizeMethod}. */ enum ResizeMethod method; + /** Height of the 4D tensor after resizing. */ long newHeight; + /** Width of the 4D tensor after resizing. */ long newWidth; + /** Whether to maintain the height/width ratio of x after resizing. */ boolean preserveAspectRatio; + /** + * Coordinate transformation method. For details, see {@link CoordinateTransformMode}. + */ enum CoordinateTransformMode coordinateTransformMode; + /** Cubic coefficient, used when method is RESIZE_METHOD_CUBIC. */ float cubicCoeff; + /** When excludeOutside==1, the sampling weight that exceeds the boundary of x is set to 0, and other weights are normalized. */ long excludeOutside; + /** Value to interpolate, which is used only when x is cropped. The sampling weight that exceeds the boundary is set to extrapolationValue. */ float extrapolationValue; + /** Nearest neighbor interpolation algorithm, used when method is RESIZE_METHOD_NEAREST. For details, see {@link NearestMode}. */ enum NearestMode nearestMode; }; +/** + * @brief Calculates the reciprocal of the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RSQRT. + * + * Inputs: + * + * *x, an n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be less than 0. + * + * Outputs: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct Rsqrt { }; +/** + * @brief Scales a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SCALE_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * scale, the scaling tensor. + * * bias, the bias tensor. + * + * Outputs: + * + * * An n-dimensional tensor scaled, whose data type is the same as that of xx and shape is determined by axis. + * + * @since 3.2 + * @version 1.0 + */ struct ScaleFusion { + /** Dimensions to scale. */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Returns the share of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SHAPE. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * An integer array representing the dimensions of x. + * + * @since 3.2 + * @version 1.0 + */ struct Shape { }; +/** + * @brief Slices a tensor of the specified size. + * + * The {@link NodeType} of this operator is NODE_TYPE_SLICE_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * begin, an array of integers greater than or equal to 0, specifying the start of the slice. + * * size, an array of integers greater than or equal to 0, specifying the length of the slice. Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. + * + * Outputs: + * + * * An n-dimensional tensor obtained. + * + * @since 3.2 + * @version 1.0 + */ struct SliceFusion { + /** Dimensions on which the tensor is sliced. */ long[] axes; }; +/** + * @brief Applies the softmax operation on a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SOFTMAX. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * Result of the softmax operation. It is an n-dimensional tensor with the same data type and shape as x. + * + * @since 3.2 + * @version 1.0 + */ struct Softmax { + /** Dimensions on which the softmax operation is performed. It is an integer in the range [-n, n). */ long[] axis; }; +/** + * @brief Splits a 4D tensor into multiple blocks in the spatial dimension and then concatenates these blocks in the batch dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPACE_TO_BATCH_ND. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * A 4D tensor with the same data type as x. The shape is determined by input, blockShape, and paddings. Assume that the input shape is [n,c,h,w], then: + * \f$ output.shape[0] = n * blockShape[0] * blockShape[1]\f$
+ * \f$ output.shape[1] = c \f$
+ * \f$ output.shape[2] = (h + paddings[0][0] + paddings[0][1]) / blockShape[0] \f$
+ * \f$ output.shape[3] = (w + paddings[1][0] + paddings[1][1]) / blockShape[1] \f$
+ * \f$ (h + paddings[0][0] + paddings[0][1]) must be an integer multiple of \f$ blockShape[0]\f$, and (w + paddings[1][0] + paddings[1][1]) \f$ must be an integer multiple of \f$ blockShape[1] \f$. + * + * @since 3.2 + * @version 1.0 + */ struct SpaceToBatchND { + /** Number of blocks. The value must be greater than 1. */ long[] blockShape; + /** Padding size for spatial dimensions. */ long[][] paddings; }; +/** + * @brief Splits a tensor into multiple tensors along the axis dimension. The number of tensors is specified by outputNum. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPLIT. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * An array of n-dimensional tensors, with the same data type and dimensions. The data type of each tensor is the same as that of x. + * + * @since 3.2 + * @version 1.0 + */ struct Split { + /** Number of output sensors. */ long outputNum; + /** + * Size of each tensor to output. + * If size_splits is empty, x will be evenly split into tensors of the same size. In this case, x.shape[axis] must be an integer multiple of outputNum. + * If size_splits is not empty, the sum of all elements must be equal to x.shape[axis]. + */ long[] sizeSplits; + /** Target axis on which x is split. The data type is int. */ long axis; }; +/** + * @brief Calculates the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQRT. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * An n-dimensional tensor, with the same data type and shape as x. + * + * @since 3.2 + * @version 1.0 + */ struct Sqrt { }; +/** + * @brief Calculates the square of the difference between two tensors. The SquaredDifference operator supports subtraction between tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUEEZE. + * + * Inputs: + * + * * x, a tensor representing the minuend, which can be a number or a Boolean value. + * * x, a tensor representing the subtrahend, which can be a number or a Boolean value. + * + * Outputs: + * + * * A tensor obtained. The shape of the output is determined by x and y. If x and y are of the same shape, + * the shape of the output is the same as that of x and y. If x and y are of different types, you need to perform the broadcast operation on x and y first. + * The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 1.0 + */ struct SquaredDifference { }; +/** + * @brief Removes the dimension with length of 1 from the specified axis. The int8 quantization input is supported. + * + * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor must be [2, 1, 2, 2]. That is, the dimension with one element between the 0th and 1st dimensions is removed. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUARED_DIFFERENCE. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * *Tensor obtained. + * + * @since 3.2 + * @version 1.0 + */ struct Squeeze { + /** Axis on which the dimension of length 1 is to be removed. The value can be an integer or an array. The value range of the integer is [-n, n). */ long[] axis; }; +/** + * @brief Stacks multiple tensors along the specified axis. If the number of dimensions of each tensor is n before stacking, the number of dimensions of the output tensor is n+1. + * + * The {@link NodeType} of this operator is NODE_TYPE_STACK. + * + * Inputs: + * + * * Multiple n-dimensional tensors, which are of the same data type and shape. + * + * Outputs: + * + * * An n+1D tensor along the specified axis, with the same data type and precision as the input tensors. + * + * @since 3.2 + * @version 1.0 + */ struct Stack { + /** An integer that specifies the dimension for tensor stacking. The value range is [-(n+1),(n+1)), which means a negative number is allowed. */ long axis; }; +/** + * @brief Slices a tensor at the specified intervals. + * + * The {@link NodeType} of this operator is NODE_TYPE_STRIDED_SLICE. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * begin, a 1D tensor that specifies the position from which the tensor is sliced. The length of begin is n. begin[i] specifies the start point to slice in the ith dimension. + * * end, a 1D tensor that specifies the end to which the tensor is sliced. The length of end is n. end[i] specifies the end point to slice in the ith dimension. + * * strides, a 1D tensor that specifies the intervals for slicing. The length of strides is n. strides[i] specifies the intervals at which the tensor is sliced in the ith dimension. Negative values are allowed. + * + * For the input tensor, the shapes of begin, end, and strides must be the same. The indices of begin and end start from 0. The elements of strides cannot be 0. + * + * Outputs: + * + * * A tensor, with the same data type as x. The number of dimensions of the output tensor is rank (x[0])+1. + * + * @since 3.2 + * @version 1.0 + */ struct StridedSlice { + /** + * Mask of begin. + * beginMask identifies different dimensions of x in binary code. For example, if bit i of beginMask is set to 1, the setting of begin in the ith dimension will be invalid, which means the start index of that dimension is 0. The default value is 0. + */ long beginMask; + /** + * Mask of end. The parameter is similar to begin_mask. + * endMask identifies different dimensions of x in binary code. For example, if bit i of endMask is set to 1, the setting of end in the ith dimension will be invalid, which means the tensor will be sliced till the end in that dimension. The default value is 0. + */ long endMask; + /** + * An integer used to mask begin and end. + * The tensor does not need to be sliced in the non-zero dimensions. + * ellipsisMask is represented in binary code. If bit i of ellipsisMask is 1, elements are sliced from the first element at strides[i] in the ith dimension until the tensor boundary. + */ long ellipsisMask; + /** + * Used to add a dimension. + * newAxisMask identifies different dimensions of x in binary code. If bit i is 1, the settings of begin, end, and strides are invalid for all dimensions, and a dimension with size of 1 is added to bit i. + */ long newAxisMask; + /** + * Used to shrink the specified dimension. + * shrinkAxisMask is represented in binary code. If the ith bit of the shrinkAxisMask is 1, all elements in the ith dimension will be discarded, and the length of the ith dimension is shrunk to 1. + */ long shrinkAxisMask; }; +/** + * @brief Calculates the difference between two tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SUB_FUSION. + * + * Inputs: + * + * * x, the minuend, which is a tensor of the int or float type. + * * y, the subtrahend, which is a tensor of the int or float type. + * + * Outputs: + * + * * Difference between the two tensors. The output shape is determined byx and y. If x and y are of the same shape, the output tensor has the same shape as x and y. + * If x and y are of different shapes, perform the broadcast operation on x or y first. The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 1.0 + */ struct SubFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Copies a tensor by the specified times. + * + * The {@link NodeType} of this operator is NODE_TYPE_TILE_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * * multiples, a 1D tensor that specifies the number of times that the input tensor is copied in each dimension. The length m is not less than the number of dimensions of x. + * + * Outputs: + * + * * An m-dimensional tensor, with the same data type as x. If the length of x is the same as that of multiples, + * the number of dimensions of the output tensor is the same as that of the x, that is, an n-dimensional tensor is output. If the length of multiples is greater than n, 1s are used to pad the dimensions of x. + * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. + * + * @since 3.2 + * @version 1.0 + */ struct TileFusion { + /** A 1D tensor that specifies the number of times that data is copied in each dimension. The length m is not less than the number of dimensions of x. */ long[] dims; }; +/** + * @brief Obtains the first K maximum values along the axis and their indices. + * + * The {@link NodeType} of this operator is NODE_TYPE_TOPK_FUSION. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * output0, the first K maximum values in the axis dimension. + * * output1, indices of the first K maximum values. + * + * @since 3.2 + * @version 1.0 + */ struct TopKFusion { + /** The value true means to sort the elements in descending order; the value false means the opposite. */ boolean sorted; + /** Specified axis. */ long axis; }; +/** + * @brief Transposes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_TRANSPOSE. + * + * Inputs: + * + * * x, an n-dimensional tensor to transpose. + * * perm, a 1D tensor that specifies the permutation. Its length is the same as the number of dimensions of x. + * + * Outputs: + * + * * An n-dimensional tensor, which has the same data type and quantization parameters as x. The shape is determined by the shape of x and perm. + * + * @since 3.2 + * @version 1.0 + */ struct Transpose { }; +/** + * @brief Adds a dimension based on the value of axis. * + * + * The {@link NodeType} of this operator is NODE_TYPE_UNSQUEEZE. + * + * Inputs: + * + * * x, an n-dimensional tensor. + * + * Outputs: + * + * * Tensor output. + * + * @since 3.2 + * @version 1.0 + */ struct Unsqueeze { + /** Dimension to add. The value of axis can be an integer or an array of integers. The value range of the integer is [-n, n). */ long[] axis; -}; \ No newline at end of file +}; + +/** @} */ -- Gitee From 107b22345097afacb52dec877304defd9451ba3e Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 6 Feb 2024 11:16:54 +0800 Subject: [PATCH 023/210] upload nnrt v2_0 interface description Signed-off-by: maoyong --- nnrt/v2_0/INnrtDevice.idl | 225 ++++++- nnrt/v2_0/IPreparedModel.idl | 79 ++- nnrt/v2_0/ModelTypes.idl | 131 +++- nnrt/v2_0/NnrtTypes.idl | 658 ++++++++++++++++++- nnrt/v2_0/NodeAttrTypes.idl | 1203 +++++++++++++++++++++++++++++++++- 5 files changed, 2285 insertions(+), 11 deletions(-) diff --git a/nnrt/v2_0/INnrtDevice.idl b/nnrt/v2_0/INnrtDevice.idl index 01e07296..c7e2d683 100644 --- a/nnrt/v2_0/INnrtDevice.idl +++ b/nnrt/v2_0/INnrtDevice.idl @@ -13,28 +13,245 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment\n + * oriented to the AI field. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @file INnrtDevice.idl + * + * @brief Defines methods related to chip devices. + * + * You can use the methods to query chip device information and build AI models. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.0 + */ package ohos.hdi.nnrt.v2_0; import ohos.hdi.nnrt.v2_0.NnrtTypes; import ohos.hdi.nnrt.v2_0.ModelTypes; import ohos.hdi.nnrt.v2_0.IPreparedModel; +/** + * @brief Provides methods for device management and model building. + * + * When multiple devices are registered, ensure that the combination of the device name\n + * and vendor name is globally unique. + * + * @since 3.2 + * @version 2.0 + */ interface INnrtDevice { + /** + * @brief Obtains the device name. + * + * @param name Device name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceName([out] String name); + + /** + * @brief Obtains the device vendor name. + * + * @param name Device vendor name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetVendorName([out] String name); + + /** + * @brief Obtains the device type. + * + * @param deviceType Device type. For details, see {@link DeviceType}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceType([out] enum DeviceType deviceType); + + /** + * @brief Obtains the device status. + * + * @param deviceType Device status. For details, see {@link DeviceStatus}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceStatus([out] enum DeviceStatus status); + + /** + * @brief Obtains the device's support for the operators of the specified AI model. + * + * @param model AI model. For details, see {@link Model}. + * @param ops Operators supported and not supported by the device. The operators are listed in the same\n + * sequence as they listed in the API model. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetSupportedOperation([in] struct Model model, [out] boolean[] ops); + + /** + * @brief Checks whether the device supports the Float32 model with the Float16 precision. + * + * @param isSupported Whether the Float16 precision is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsFloat16PrecisionSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports performance preference settings. For details about the performance\n + * preference, see {@link PerformanceMode}. + * + * @param isSupported Whether performance preference settings are supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsPerformanceModeSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports task priority settings. For details about the priority,\n + * see {@link Priority}. + * + * @param isSupported Whether task priority settings are supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsPrioritySupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports dynamic input, which allows a model of different shapes\n + * to be used for different operations. + * + * If dynamic input is supported, -1 is added in the shape of the input tensor. + * + * @param isSupported Whether dynamic input is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsDynamicInputSupported([out] boolean isSupported); - PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Builds a model. + * + * If the AI model supports dynamic input, at least one dimension of the input tensor contains -1. + * + * @param model Module to build. For details, see {@link Model}. + * @param config Model configuration. For details, see {@link ModelConfig}. + * @param preparedModel Model object built. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ + PrepareModel([in] struct Model model, + [in] struct ModelConfig config, + [out] IPreparedModel preparedModel); + + /** + * @brief Checks whether the device supports caching of the AI models built. + * + * If yes, PrepareModelFromModelCache() and ExportModelCache() need to be implemented. + * + * @param isSupported Whether caching of the AI models built is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsModelCacheSupported([out] boolean isSupported); - PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, + + /** + * @brief Loads an AI model from the cache. The AI model is exported by using ExportModelCache(). + * + * @param modelCache Array of the model files, which are in the same sequence as they exported. For details,\n + * see {@link SharedBuffer}. + * @param config Configuration for loading the model. For details, see {@link ModelConfig}. + * @param preparedModel Model object. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, + [in] struct ModelConfig config, [out] IPreparedModel preparedModel); - PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, + + /** + * @brief Loads offline model files from the cache. The offline model is obtained after offline model files\n + * are passed by the inference framework to the NNRt module and then parsed by the NNRt module. + * + * @param modelCache Array of offline model files. The sequence of array elements depends on the format of\n + * the input offline model. For details about the element types, see the definition of SharedBuffer {@link SharedBuffer}. + * @param config Configuration for loading the offline model files. For details, see {@link ModelConfig}. + * @param preparedModel Model object obtained. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ + PrepareOfflineModel([in] struct SharedBuffer[] modelCache, + [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Allocates the shared memory for the device. The shared memory allows quick access to the input\n + * and output data for AI inference. + * + * @param length Length of the shared memory to allocate, in bytes. + * @param buffer Information about the shared memory allocated, including the file descriptor and size.\n + * For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); + + /** + * @brief Releases the shared memory. + * + * @param buffer Information about the shared memory allocated, including the file descriptor and size.\n + * For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ ReleaseBuffer([in] struct SharedBuffer buffer); -} \ No newline at end of file +} + +/** @} */ diff --git a/nnrt/v2_0/IPreparedModel.idl b/nnrt/v2_0/IPreparedModel.idl index 7228ae1b..48f95dd4 100644 --- a/nnrt/v2_0/IPreparedModel.idl +++ b/nnrt/v2_0/IPreparedModel.idl @@ -13,12 +13,87 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @file IPreparedModel.idl + * + * @brief Defines the APIs for AI model inference, obtaining the input tensor dimension range,\n + * and exporting the AI model built. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.0 + */ package ohos.hdi.nnrt.v2_0; import ohos.hdi.nnrt.v2_0.NnrtTypes; +/** + * @brief Provides the APIs for exporting AI models and performing AI model inference. + * + * @since 3.2 + * @version 2.0 + */ interface IPreparedModel { + /** + * @brief Exports an AI model from the cache. + * + * @param modelCache Array of the model files, which are in the same sequence as they exported.\n + *For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ ExportModelCache([out] struct SharedBuffer[] modelCache); + + /** + * @brief Obtains the tensor dimension range supported by AI model. If a fixed dimension is used,\n + *the maximum dimension value is the same as the minimum dimension value. + * + * @param minInputDims Two-dimensional array that stores the minimum dimension of the model input data.\n + *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * @param maxInputDims Two-dimensional array that stores the maximum dimension of the model input data.\n + *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); - Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); -} \ No newline at end of file + + /** + * @brief Performs AI model inference. + * + * @param inputs Input data for AI model inference. The data is input in the sequence defined by the model.\n + *For details about the input data type, see {@link IOTensor}. + * @param outputs Output data of AI model inference. After inference, the output data is written to the\n + *shared buffer. For details about the output data type, see {@link IOTensor}. + * @param outputsDims Dimensions of the output data. The output sequence is the same as that of outputs. + * @param isOutputBufferEnough Whether the shared buffer space is sufficient for the output data.\n + *The value true means the shared buffer space is sufficient; the value false means the opposite. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ + Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputsDims); +} + +/** @} */ diff --git a/nnrt/v2_0/ModelTypes.idl b/nnrt/v2_0/ModelTypes.idl index d1f9f9a6..2b02e96c 100644 --- a/nnrt/v2_0/ModelTypes.idl +++ b/nnrt/v2_0/ModelTypes.idl @@ -13,40 +13,169 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @file ModelTypes.idl + * + * @brief Defines AI model structures. + * + * In {@link PrepareModel}, the AI model is parsed and converted into the structure for inference.\n + * Then, model inference is performed in {@link Run}. The process is as follows. + * - 1. Write the functions for each operator in the {@link NodeAttrTypes.idl} file and associate\n + * each function with a {@link NodeType}. + * - 2. The subGraph parameter of {@link Model} is traversed to obtain the operator nodes\n + * contained in the subgraph, the input and output tensors of the operator, and the input and output tensors\n + * of the entire {@link Model} from nodeIndecies of the subgraph. + * - 3. The operator functions are located based on the nodeType parameter of {@link Node} to\n + * build the model structure for runtime. + * - 4. When the tensors input by the user are passed to the model, the NNRt module performs model inference\n + * and the outputs the model inference result. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.0 + */ package ohos.hdi.nnrt.v2_0; import ohos.hdi.nnrt.v2_0.NnrtTypes; +/** + * @brief Defines the tensor structure. + * + * @since 3.2 + * @version 1.0 + */ struct Tensor { + /** Tensor name. */ String name; + /** Tensor data type. For details, see {@link DataType}. */ enum DataType dataType; + /** Tensor dimensions. */ int[] dims; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** Structure used for passing the tensor data during process communication.\n + * For details, see {@link SharedBuffer}. + */ struct SharedBuffer data; + /** + * Array of quantization parameters of the tensor. For details, see {@link QuantParam}. + * If the length is 1, all axes share one quantization parameter. + * If the length is not 1, each quantization parameter in the array corresponds to an axis. + */ struct QuantParam[] quantParams; }; +/** + * @brief Defines the operator node structure. + * + * nodeAttr is a segment of serialized data. Specific parameters can be obtained only by using + * the deserialization interface of OpenHarmony HDI. + * The process is as follows: + * - Define the operator parameter structure OP op{}, where OP can be replaced with + * the operator parameter structure defined in {@link NodeAttrTypes.idl} and op is a variable name. + * - Declare `OHOS::MessageParcel data;`, that is, the MessageParcle object used to store deserialized data. + * - Use data.WriteBuffer (nodeAttr.data(),nodeAttr.size()); to write nodeAttr to data. + * - Use (void)OPBlockUnmarshalling(data, op); to deserialize data to the op structure.
+ * Then, you can view the parameter values of the operator in op. + * + * Example: + * If nodeType of an operator is NODE_TYPE_FULL_CONNECTION, the corresponding operator + * parameter structure is {@link FullConnection}. + * The operator has four parameters: hasBias, useAxis, axis, and activationType.
+ * The invoking process is as follows:
+ * FullConnection full_connection{};
+ * OHOS::MessageParcel data;
+ * data.WriteBuffer(nodeAttr.data(),nodeAttr.size());
+ * (void)FullConnectionBlockUnmarshalling(data, full_connection);
+ * Up to now, the four parameters are written into full_connection. + * + * @since 3.2 + * @version 1.0 + */ struct Node { + /** Operator node name. */ String name; + /** Operator node type. For details, see {@link NodeType}. */ enum NodeType nodeType; + /** + * Array of the serialized data corresponding to the operator node parameters. + */ byte[] nodeAttr; + /** Subscript of the input node of the operator node. */ unsigned int[] inputIndex; + /** Subscript of the output node of the operator node. */ unsigned int[] outputIndex; + /** Quantization parameter of the operator node. For details, see {@link QuantType}. */ enum QuantType quantType; }; +/** + * @brief Defines the subgraph structure. + * + * @since 3.2 + * @version 1.0 + */ struct SubGraph { + /** Subgraph name. */ String name; + /** Indices of the input subgraphs in subGraph of {@link Model}. */ unsigned int[] inputIndices; + /** Indices of the output subgraphs in subGraph of {@link Model}. */ unsigned int[] outputIndices; + /** Indices of the operator nodes related to the subgraph in the nodes array of {@link Model}. */ unsigned int[] nodeIndices; }; +/** + * @brief Defines the model structure. + * + * This structure stores all information required for model inference. Subgraph 0 of each model is the main subgraph.\n + * Generally, a model has only one subGraph. + * + * @since 3.2 + * @version 1.0 + */ struct Model { + /** Model name. */ String name; + /** + * Index of the input tensor of the model in allTensors. + */ unsigned int[] inputIndex; + /** + * Index of the output tensor of the model in allTensors. + */ unsigned int[] outputIndex; + /** + * Array of all operator nodes in the model. For details, see {@link Node}. + */ struct Node[] nodes; + /** + * Array of all tensors in the model. The array contains input tensors, output tensors, and constant tensors.\n + * For details, see {@link Tensor}. + */ struct Tensor[] allTensors; + /** + * Array of all subgraphs in the model. For details, see {@link SubGraph}. + */ struct SubGraph[] subGraph; -}; \ No newline at end of file +}; + +/** @} */ diff --git a/nnrt/v2_0/NnrtTypes.idl b/nnrt/v2_0/NnrtTypes.idl index d6aabbf5..7ad2e271 100644 --- a/nnrt/v2_0/NnrtTypes.idl +++ b/nnrt/v2_0/NnrtTypes.idl @@ -13,258 +13,912 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @file NnrtTypes.idl + * + * @brief Defines the types used in the HDI methods. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.0 + */ package ohos.hdi.nnrt.v2_0; +/** + * @brief Defines the shared memory data structure. + * + * @since 3.2 + * @version 1.0 + */ struct SharedBuffer { + /** File descriptor of the shared memory. */ FileDescriptor fd; + /** Size of the shared memory, in bytes. */ unsigned int bufferSize; + /** Offset of the start address of the valid data in the shared memory. */ unsigned int offset; + /** Space occupied by the valid data, in bytes. */ unsigned int dataSize; }; +/** + * @brief Enumerates the AI chip types. + * + * @since 3.2 + * @version 1.0 + */ enum DeviceType: int { + /** Other types. */ OTHER, + /** CPU chip. */ CPU, + /** GPU chip. */ GPU, + /** AI acceleration chip, such as NPU chip and DSP chip. */ ACCELERATOR }; +/** + * @brief Enumerates the AI chip states. + * + * @since 3.2 + * @version 1.0 + */ enum DeviceStatus: int { + /** Available. */ AVAILABLE, + /** Busy. The chip in this state may not respond to computing tasks in a timely manner. */ BUSY, + /** Offline. The chip in this state cannot respond to computing tasks. */ OFFLINE, + /** Unknown state. */ UNKNOWN }; +/** + * @brief Enumerates the performance modes for a chip to perform AI computing. + * + * @since 3.2 + * @version 1.0 + */ enum PerformanceMode: int { + /** No performance mode is specified. The specific running mode is defined by the chip. */ PERFORMANCE_NONE, + /** Low-performance mode, which provides slow AI computing but low power consumption. */ PERFORMANCE_LOW, + /** Medium-performance mode, which provides moderate computing speed and power consumption. */ PERFORMANCE_MEDIUM, + /** High-performance mode, which provides fast AI computing but high power consumption. */ PERFORMANCE_HIGH, + /** Extreme-performance mode, which provides the fastest AI computing but highest power consumption. */ PERFORMANCE_EXTREME }; +/** + * @brief Enumerates the AI computing task priorities. + * + * @since 3.2 + * @version 1.0 + */ enum Priority: int { + /** No task priority is specified. The specific execution policy is defined by the chip. */ PRIORITY_NONE, + /** Low priority. A task with a higher priority will be executed first. */ PRIORITY_LOW, + /** Medium priority. A task with a higher priority will be executed first. */ PRIORITY_MEDIUM, + /** High priority. High-priority tasks are executed first. */ PRIORITY_HIGH }; +/** + * @brief Defines the parameters required for model building. + * + * @since 3.2 + * @version 2.0 + */ struct ModelConfig { + /** Whether to run a Float32 model in Float16 precision. */ boolean enableFloat16; + /** Performance mode of the computing task. For details, see {@link PerformanceMode}. */ enum PerformanceMode mode; + /** Priority of the computing task. For details, see {@link Priority}. */ enum Priority priority; + /** Custom attributes of the underlying hardware. They stored in the format of name:binary value + * and parsed by the HDI service. + */ Map extensions; }; +/** + * @brief Enumerates the operator data formats. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 1.0 + */ enum Format : byte { + /** Format initial value. */ FORMAT_NONE = -1, + /** NCHW, which indicates the number of data samples, image channels, image height, and image width in sequence. */ FORMAT_NCHW = 0, + /** NHWC. */ FORMAT_NHWC = 1 }; +/** + * @brief Defines the quantization parameter structure. + * + * In the following formula, q is a quantized parameter, r is a real parameter, \f$ r_{max} \f$\n + * is the maximum value of the data to be quantized, \f$ r_{min} \f$ is the minimum value of the data + * to be quantized, and round(x) means to round off x to an integer. + \f[ + \text{clamp}(x,min,max) = + \begin{cases} + \text{max} & \text{ if } x > \text{ max } \\ + \text{min} & \text{ if } x < \text{ min } \\ + x & \text{ otherwise } \\ + \end{cases} + \f] + * Formula for transforming a real number from a floating-point representation to a fixed-point representation: + \f[ + \text{q}(x_i) = clamp(round(\frac{r}{scale}+zeroPoint), min , max) + \f] + * Formula for transforming a real number from a fixed-point representation to a floating-point representation: + \f[ + \text{r}= (q-zeroPoint)*scale + \f] + * scale is calculated by using the following formula: + \f[ + scale = \frac{r_{max}-r_{min}}{q_{max}-q_{min}} + \f] + * zeroPoint is calculated by using the following formula: + \f[ + zeroPoint = round(q_{min}-\frac{r_{min}}{scale}) + \f] + * \f$ q_{min},q_{max} \f$ is calculated by using the following formula: + \f[ + q_{min} = -(1<<(numBits-1)) + \f] + \f[ + q_{max} = (1<<(numBits-1))-1 + \f] + * When \f$ r_{min} \f$ and \f$ r_{max} \f$ are 0, scale and zeroPoint must be 0. + * + * @since 3.2 + * @version 1.0 + */ struct QuantParam { + /** Number of quantized bits. */ int numBits; + /** Zero value. */ int zeroPoint; + /** Step of the quantizer. */ double scale; }; +/** + * @brief Enumerates the tensor data types. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 1.0 + */ enum DataType : byte { + /** Unknown type. */ DATA_TYPE_UNKNOWN = 0, + /** Boolean. */ DATA_TYPE_BOOL = 30, + /** INT8. */ DATA_TYPE_INT8 = 32, + /** INT16. */ DATA_TYPE_INT16 = 33, + /** INT32. */ DATA_TYPE_INT32 = 34, + /** INT64. */ DATA_TYPE_INT64 = 35, + /** UINT8. */ DATA_TYPE_UINT8 = 37, + /** UINT16. */ DATA_TYPE_UINT16 = 38, + /** UINT32. */ DATA_TYPE_UINT32 = 39, + /** UINT64. */ DATA_TYPE_UINT64 = 40, + /** FLOAT16. */ DATA_TYPE_FLOAT16 = 42, + /** FLOAT32. */ DATA_TYPE_FLOAT32 = 43, + /** FLOAT64. */ DATA_TYPE_FLOAT64 = 44, }; +/** + * @brief Defines the input and output tensors of an AI model. + * + * @since 3.2 + * @version 1.0 + */ struct IOTensor { + /** Tensor name. */ String name; + /** Data type of the tensor. For details, see {@link DataType}. */ enum DataType dataType; + /** Dimensions of the tensor. */ int[] dimensions; + /** Format of the tensor. For details, see {@link Format}. */ enum Format format; + /** Tensor data, which is stored in the shared memory. For details about the shared memory,\n + * see {@link SharedBuffer}. + */ struct SharedBuffer data; }; +/** + * @brief Enumerates the quantization types. This parameter must be used together with {@link Node}. + * + * @since 3.2 + * @version 1.0 + */ enum QuantType: byte { + /** Do not use quantification. */ QUANT_TYPE_NONE, + /** INT8 quantization. */ QUANT_TYPE_ALL, }; +/** + * @brief Enumerates the operator types. + * + * @since 3.2 + * @version 1.0 + */ enum NodeType : unsigned int { + /** None. */ NODE_TYPE_NONE = 0, + /** Activation function. */ NODE_TYPE_ACTIVATION = 2, + /** ADD operator. */ NODE_TYPE_ADD_FUSION = 5, + /** ArgMax operator. */ NODE_TYPE_ARGMAX_FUSION = 11, + /** AVGPOOL operator. */ NODE_TYPE_AVGPOOL_FUSION = 17, + /** BatchToSpaceND operator. */ NODE_TYPE_BATCH_TO_SPACE_ND = 22, + /** BiasAdd operator. */ NODE_TYPE_BIAS_ADD = 23, + /** Cast operator. */ NODE_TYPE_CAST = 28, + /** Concat operator. */ NODE_TYPE_CONCAT = 31, + /** Conv2D operator, including common convolution, separable convolution, and group convolution. */ NODE_TYPE_CONV2D_FUSION = 35, + /** Two-dimensional deconvolution operator. */ NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, + /** Div operator. */ NODE_TYPE_DIV_FUSION = 47, + /** Element-level operator. */ NODE_TYPE_ELTWISE = 52, + /** ExpandDims operator. */ NODE_TYPE_EXPAND_DIMS = 56, + /** Fill operator. */ NODE_TYPE_FILL = 66, + /** FullConnection operator. */ NODE_TYPE_FULL_CONNECTION = 67, + /** BatchNorm operator. */ NODE_TYPE_FUSED_BATCH_NORM = 68, + /** Gather operator. */ NODE_TYPE_GATHER = 69, + /** LayerNorm operator. */ NODE_TYPE_LAYER_NORM_FUSION = 75, + /** LessEqual operator. */ NODE_TYPE_LESS_EQUAL = 78, + /** MatMul operator. */ NODE_TYPE_MATMUL_FUSION = 89, + /** Maximum operator. */ NODE_TYPE_MAXIMUM = 90, + /** MaxPool operator. */ NODE_TYPE_MAX_POOL_FUSION = 92, + /** Mul operator. */ NODE_TYPE_MUL_FUSION = 99, + /** OneHot operator. */ NODE_TYPE_ONE_HOT = 105, + /** Pad operator. */ NODE_TYPE_PAD_FUSION = 107, + /** Pow operator. */ NODE_TYPE_POW_FUSION = 110, + /** PReLU operator. */ NODE_TYPE_PRELU_FUSION = 112, + /** QuantDTypeCast operator. */ NODE_TYPE_QUANT_DTYPE_CAST = 113, + /** Reduce operator. */ NODE_TYPE_REDUCE_FUSION = 118, + /** Reshape operator. */ NODE_TYPE_RESHAPE = 119, + /** Resize operator. */ NODE_TYPE_RESIZE = 120, + /** Rsqrt operator. */ NODE_TYPE_RSQRT = 126, + /** Scale operator. */ NODE_TYPE_SCALE_FUSION = 127, + /** Shape operator. */ NODE_TYPE_SHAPE = 130, + /** Slice operator. */ NODE_TYPE_SLICE_FUSION = 135, + /** Softmax operator. */ NODE_TYPE_SOFTMAX = 138, + /** SpaceToBatchND operator. */ NODE_TYPE_SPACE_TO_BATCH_ND = 141, + /** Split operator. */ NODE_TYPE_SPLIT = 145, + /** Sqrt operator. */ NODE_TYPE_SQRT = 146, + /** SquaredDifference operator. */ NODE_TYPE_SQUEEZE = 147, + /** Squeeze operator. */ NODE_TYPE_SQUARED_DIFFERENCE = 149, + /** Stack operator. */ NODE_TYPE_STACK = 150, + /** StridedSlice operator. */ NODE_TYPE_STRIDED_SLICE = 151, + /** Sub operator. */ NODE_TYPE_SUB_FUSION = 152, + /** Tile operator. */ NODE_TYPE_TILE_FUSION = 160, + /** TopK operator. */ NODE_TYPE_TOPK_FUSION = 161, + /** Transpose operator. */ NODE_TYPE_TRANSPOSE = 162, + /** Unsqueeze operator. */ NODE_TYPE_UNSQUEEZE = 165, }; +/** + * @brief Enumerates the resize methods. It must be used together with the {@link Resize} operator. + * + * @since 3.2 + * @version 1.0 + */ enum ResizeMethod : byte { + /** Unknown. This is the default value. */ RESIZE_METHOD_UNKNOWN = -1, + /** Bilinear interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where\n + * \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2), Q_{21} = (x_2, y_1),\n + * and Q_{22} = (x_2, y_2) \f$. + * \f$f(Q_{11}), f(Q_{12}), f(Q_{21}), and f(Q_{22}) \f$ represent the values of the four points.\n + * The value of \f$ f(x,y) \f$ can be calculated by using the following formula: + \f[ + f(x,y_1) = \frac{x_2-x}{x_2-x_1}f(Q_{11})+\frac{x-x_1}{x_2-x_1}f(Q_{21}) + \f] + + \f[ + f(x,y_2) = \frac{x_2-x}{x_2-x_1}f(Q_{12})+\frac{x-x_1}{x_2-x_1}f(Q_{22}) + \f] + + \f[ + f(x,y) = \frac{y_2-y}{y_2-y_1}f(x,y_1)+\frac{y-y_1}{y_2-y_1}f(x,y_2) + \f] + */ RESIZE_METHOD_LINEAR = 0, + /** Nearest neighbor interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where\n + * \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2),\n + * Q_{21} = (x_2, y_1), and Q_{22} = (x_2, y_2) \f$. + * Then, the value of the point closest to the point \f$(x,y) \f$ is the value of \f$ f(x,y) \f$. + */ RESIZE_METHOD_NEAREST = 1, + /** Bicubic interpolation. + * Bicubic interpolation obtains the value of a sampling point by calculating the weighted average of the\n + * values of 16 points around the sampling point. This parameter must be used together with cubicCoeff\n + * and coordinateTransformMode of {@link Resize}. + * When coordinateTransformMode==COORDINATE_TRANSFORM_MODE_HALF_PIXEL, cubicCoeff is -0.5.\n + * In other cases, cubicCoeff is -0.75. The weight function of the interpolation is as follows: + \f[ + W(x) = + \begin{cases} + (cubicCoeff+2)|x|^3 - (cubicCoeff+3)|x|^2 +1 , &\text{if } |x| \leq 1; \cr + cubicCoeff|x|^3 - 5cubicCoeff|x|^2 + 8cubicCoeff|x| - 4a, &\text{if } 1 \lt |x| \leq 2; \cr + 0, &\text{otherwise.} + \end{cases} + \f] + */ RESIZE_METHOD_CUBIC = 2 }; +/** + * @brief Enumerates the coordinate transformation modes. Only the {@link Resize} operator uses this parameter. + * For example, the width coordinates are transformed, where: + * new_i is the ith coordinate of the resized tensor along the x axis. + * old_i is the coordinate of the input tensor along the x axis. + * newWidth is the length of the resized tensor along the x axis. + * oldWidth is the length of the input tensor along the x axis. + * old_i can be calculated by using the following formula: + * + * COORDINATE_TRANSFORM_MODE_ASYMMETRIC: \f$ old_i = newWidth != 0 ? new_i * oldWidth / newWidth : 0 \f$
+ * COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS: \f$ old_i = newWidth != 1 ? new_i * (oldWidth - 1) / (newWidth - 1) \f$
+ * COORDINATE_TRANSFORM_MODE_HALF_PIXEL: \f$ old_i = newWidth > 1 ? (new_x + 0.5) * oldWidth / newWidth - 0.5 : 0 \f$
+ * + * @since 3.2 + * @version 1.0 + */ enum CoordinateTransformMode : byte { + /** Scale based on the ratio without alignment. */ COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, + /** Align the four corners of the image. */ COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, + /** Align with the pixel center. */ COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 }; +/** + * @brief Enumerates the nearest neighbor interpolation types. It must be used together with the + * {@link Resize} operator. + * + * @since 3.2 + * @version 1.0 + */ enum NearestMode : byte { + /** Round off. */ NEAREST_MODE_NORMAL = 0, + /** Round toward negative infinity. For example, 23.5 is rounded to 23, and −23.5 is rounded to −24. */ NEAREST_MODE_ROUND_HALF_DOWN = 1, + /** Round toward positive infinity. For example, 23.5 is rounded to 24, and −23.5 is rounded to −23. */ NEAREST_MODE_ROUND_HALF_UP = 2, + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down + * to −24. + */ NEAREST_MODE_FLOOR = 3, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ NEAREST_MODE_CEIL = 4 }; +/** + * @brief Enumerates the activation function types. Activation functions introduce nonlinearity to neural networks.\n + * This allows the use of neural network models in nonlinear models. + * If an operator in the {@link NodeAttrTypes.idl} file has ActivationType parameters,\n + * the corresponding activation function will be called after the operator calculation is complete. + * + * @since 3.2 + * @version 1.0 + */ enum ActivationType : byte { + /** No activation function. */ ACTIVATION_TYPE_NO_ACTIVATION = 0, + /** + * ReLU activation function. + * ReLU calculates \f$ max(x_i, 0) \f$ element by element. It outputs the value directly if it is positive;\n + * otherwise, it outputs 0. + \f[ + \text{ReLU}(x_i) = (x_i)^+ = \max(x_i, 0), + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU = 1, + /** + * Sigmoid activation function. + * Execute the sigmoid activation function element-wise. + * The sigmoid function is defined as follows: + \f[ + \text{Sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SIGMOID = 2, + /** + * ReLU6 activation function. + * ReLU6 is similar to ReLU. The difference is ReLU6 has an upper limit of 6. If the input is greater than 6,\n + * the output is limited to 6. + * The ReLU6 function is defined as follows: + \f[ + \text{ReLU6}(x_i) = \min(\max(0, x_i), 6) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU6 = 3, + /** + * Exponential Linear Unit (ELU) activation function. + * ELU calculates the ELU for each input element. + * The ELU function is defined as follows: + \f[ + ELU(x_{i}) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + \alpha * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter,\n + * which is set by {@link Activation}. + */ ACTIVATION_TYPE_ELU = 4, + /** + * LeakyReLU activation function. + * The LeakyReLU function is defined as follows: + \f[ + \text{LeakyReLU}(x_i) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + {\alpha} * x_i, &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter,\n + * which is set by {@link Activation}. + */ ACTIVATION_TYPE_LEAKY_RELU = 5, + /** + * Activation function for calculating the absolute value. + * The function is defined as follows: + \f[ + \text{abs}(x_i) = |x_i| + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_ABS = 6, + /** + * ReLU1 activation function. + * The ReLU1 function is defined as follows: + \f[ + \text{ReLU1}(x_i)= \min(\max(0, x_i), 1) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU1 = 7, + /** + * SoftSign activation function. + * The SoftSign function is defined as follows: + \f[ + \text{SoftSign}(x_i) = \frac{x_i}{1 + |x_i|} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SOFTSIGN = 8, + /** + * Softplus activation function. + * Softplus is a smooth approximation to ReLU. It can be used to constrain the output to always be positive. + * The Softplus function is defined as follows: + \f[ + \text{Softplus}(x_i) = \log(1 + \exp(x_i)) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SOFTPLUS = 9, + /** + * Tanh activation function. + * The Tanh function is defined as follows: + \f[ + tanh(x) = \frac{\exp(x_i) - \exp(-x_i)}{\exp(x_i) + \exp(-x_i)} = \frac{\exp(2x_i) - 1}{\exp(2x_i) + 1} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_TANH = 10, + /** + * Scaled exponential Linear Unit (SELU) activation function. + * The SELU function is defined as follows: + \f[ + SELU(x_{i}) = + scale * + \begin{cases} + x_{i}, &\text{if } x_{i} \geq 0; \cr + \text{alpha} * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ is the input element, and \f$ \alpha \f$ and \f$ scale \f$ are predefined\n + * constants (\f$ \alpha = 1.67326324 \f$, \f$ scale = 1.05070098 \f$). + */ ACTIVATION_TYPE_SELU = 11, + /** + * Hard Swish activation function. + * + \f[ + \text{Hardswish}(x_{i}) = x_{i} * \frac{ReLU6(x_{i} + 3)}{6} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSWISH = 12, + /** + * Hard sigmoid activation function. + * The hard sigmoid function is defined as follows: + \f[ + \text{Hardsigmoid}(x_{i}) = max(0, min(1, \frac{x_{i} + 3}{6})) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSIGMOID = 13, + /** + * ThresholdedReLU activation function. + * ThresholdedReLU is similar to ReLU. The ThresholdedReLU function is defined as follows: + \f[ + \text{ThresholdedReLU}(x_i) = \min(\max(0, x_i), t) + \f] + * \f$ x_i \f$ is the input element, and \f$ t \f$ is the maximum value. + */ ACTIVATION_TYPE_THRESHOLDRELU = 14, + /** + * Linear activation function. + * The Linear function is defined as follows: + \f[ + \text{Linear}(x_i) = x_i + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_LINEAR = 15, + /** + * HardTanh activation function. + * The HardTanh function is defined as follows: + \f[ + \text{HardTanh}(x_i) = + \begin{cases} + \text{max_val} & \text{ if } x_i > \text{ max_val } \\ + \text{min_val} & \text{ if } x_i < \text{ min_val } \\ + x_i & \text{ otherwise } \\ + \end{cases} + \f] + * \f$ x_i \f$ is the input, \f$ max\_val \f$ is the maximum value, and \f$ min\_val \f$\n + * is the minimum value. The two parameters are set by {@link Activation}. + */ ACTIVATION_TYPE_HARD_TANH = 16, + /** + * Sign activation function. + * The Sign function is defined as follows: + \f[ + Sign(x_i) = \begin{cases} -1, &if\ x_i < 0 \cr + 0, &if\ x_i = 0 \cr + 1, &if\ x_i > 0\end{cases} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SIGN = 17, + /** + * Swish activation function. + * The Swish function is defined as follows: + \f[ + \text{Swish}(x_i) = x_i * Sigmoid(x_i) + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SWISH = 18, + /** + * Gaussian error linear unit (GELU) activation function. + * The GELU function is defined as follows: + \f[ + GELU(x_i) = x_i*P(X < x_i) + \f] + * \f$ x_i \f$ is the input element, and \f$ P \f$ is a cumulative distribution function of\n + * the standard Gaussian distribution. + * You need to use the approximate parameter of {@link Activation} to specify whether to use approximation. + */ ACTIVATION_TYPE_GELU = 19, + /** Unknown. */ ACTIVATION_TYPE_UNKNOWN = 20 }; +/** + * @brief Enumerates the modes for removing dimensions. It must be used together with the {@link ReduceFusion} operator. + * + * @since 3.2 + * @version 1.0 + */ enum ReduceMode : byte { + /** Use the average value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MEAN = 0, + /** Use the maximum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MAX = 1, + /** Use the minimum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MIN = 2, + /** Use the product of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_PROD = 3, + /** Use the sum of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM = 4, + /** Use the sum of squares of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM_SQUARE = 5, + /** Use the sum of absolute values of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ASUM = 6, + /** Use the logical AND of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ALL = 7 }; +/** + * @brief Enumerates the calculation types supported by elements. It must be used together with the\n + * {@link Eltwise} operator. + * + * @since 3.2 + * @version 1.0 + */ enum EltwiseMode : byte { + /** Product of the elements of two tensors */ ELTWISE_MODE_PROD = 0, + /** Difference between the elements of two tensors */ ELTWISE_MODE_SUM = 1, + /** Maximum value of the elements of two tensors */ ELTWISE_MODE_MAXIMUM = 2, + /** Unknown type. */ ELTWISE_MODE_UNKNOWN = 3 }; +/** + * @brief Enumerates the padding types. It must be used together with {@link AvgPoolFusion}, {@link AvgPoolFusion},\n + * {@link Conv2DFusion}, and {@link MaxPoolFusion}. + * + * @since 3.2 + * @version 1.0 + */ enum PadMode : byte { + /** + * Adds 0s in the input height and width directions. + * If this mode is used, the padding parameter of the operator must be greater than or equal to 0. + */ PAD_MODE_PAD = 0, + /** + * The output height and width are obtained by dividing the input height and width by a stride and rounding off\n + * the quotient to an integer. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_SAME = 1, + /** + * Return the output of a valid calculation without padding. Pixels that do not meet the calculation requirements\n + * will be discarded. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_VALID = 2, }; +/** + * @brief Enumerates the algorithms for rounding off decimals. It must be used together with the\n + * {@link AvgPoolFusion} operator. + * + * @since 3.2 + * @version 1.0 + */ enum RoundMode : byte { + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down to −24. */ ROUND_MODE_FLOOR = 0, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ ROUND_MODE_CEIL = 1 }; +/** + * @brief Enumerates the padding modes. It must be used together with the {@link PadFusion} operator. + * + * When x is \f$[[1,2,3],[4,5,6],[7,8,9]]\f$ and paddingsis \f$[[2,2], [2,2]] \f$,\n + * the effect is as follows:
+ * If paddingMode==PADDING_MODE_CONSTANT and constantValue = 0, the output is as follows: + * + \f$[[0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 1. 2. 3. 0. 0.],\\ + [0. 0. 4. 5. 6. 0. 0.],\\ + [0. 0. 7. 8. 9. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_REFLECT, the output is as follows: + * + \f$[[9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_SYMMETRIC, the output is as follows: + * + \f$[[5. 4. 4. 5. 6. 6. 5.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [5. 4. 4. 5. 6. 6. 5.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [5. 4. 4. 5. 6. 6. 5.]]\\ \f$ + * + * + * @since 3.2 + * @version 1.0 + */ + enum PaddingMode : byte { + /** Constant (0 by default) padding. */ PADDING_MODE_CONSTANT = 0, + /** Reflection padding, which uses the content next to the input data to pad the values directly next to it. */ PADDING_MODE_REFLECT = 1, + /** Symmetric padding, which is similar to {@link PADDING_MODE_REFLECT}. Symmetric padding makes a copy of the input. */ PADDING_MODE_SYMMETRIC = 2, + /** Reserved. */ PADDING_MODE_RESERVED = 3 }; -enum NNRT_ReturnCode : unsigned int { +/** + * @brief Dedicated error codes defined by NNRt. They are used as the return values of HDIs. + * + * @since 4.0 + * @version 2.0 + */ +enum NNRT_ReturnCode : int { + /** Success. */ NNRT_SUCCESS = 0, + /** Failed. */ NNRT_FAILED = 1, + /** Null pointer. */ NNRT_NULL_PTR = 2, + /** Invalid parameter. */ NNRT_INVALID_PARAMETER = 3, + /** Memory error. */ NNRT_MEMORY_ERROR = 4, + /** Insufficient memory. */ NNRT_OUT_OF_MEMORY = 5, + /** Forbidden operation. */ NNRT_OPERATION_FORBIDDEN = 6, + /** Invalid file. */ NNRT_INVALID_FILE = 7, + /** Invalid path. */ NNRT_INVALID_PATH = 8, + /** Insufficient cache. */ NNRT_INSUFFICIENT_BUFFER = 9, + /** No change. */ NNRT_NO_CHANGE = 10, + /** Not supported. */ NNRT_NOT_SUPPORT = 11, + /** Service error. */ NNRT_SERVICE_ERROR = 12, + /** Device error. */ NNRT_DEVICE_ERROR = 13, + /** Device busy. */ NNRT_DEVICE_BUSY = 14, + /** Operation canceled. */ NNRT_CANCELLED = 15, + /** Access denied. */ NNRT_PERMISSION_DENIED = 16, + /** Timeout. */ NNRT_TIME_OUT = 17, + /** Invalid tensor. */ NNRT_INVALID_TENSOR = 18, + /** Invalid node. */ NNRT_INVALID_NODE = 19, + /** Invalid input. */ NNRT_INVALID_INPUT = 20, + /** Invalid output. */ NNRT_INVALID_OUTPUT = 21, + /** Invalid data type. */ NNRT_INVALID_DATATYPE = 22, + /** Invalid data layout. */ NNRT_INVALID_FORMAT = 23, + /** Invalid tensor name. */ NNRT_INVALID_TENSOR_NAME = 24, + /** Invalid shape. */ NNRT_INVALID_SHAPE = 25, + /** Dimension range exceeded. */ NNRT_OUT_OF_DIMENTION_RANGES = 26, + /** Invalid cache. */ NNRT_INVALID_BUFFER = 27, + /** Invalid cache size. */ NNRT_INVALID_BUFFER_SIZE = 28, + /** Invalid performance mode. */ NNRT_INVALID_PERFORMANCE_MODE = 29, + /** Invalid priority. */ NNRT_INVALID_PRIORITY = 30, + /** Invalid model. */ NNRT_INVALID_MODEL = 31, + /** Invalid model cache. */ NNRT_INVALID_MODEL_CACHE = 32, + /** Operator not supported. */ NNRT_UNSUPPORTED_OP = 33 -}; \ No newline at end of file +}; +/** @} */ diff --git a/nnrt/v2_0/NodeAttrTypes.idl b/nnrt/v2_0/NodeAttrTypes.idl index af6c607c..463be678 100644 --- a/nnrt/v2_0/NodeAttrTypes.idl +++ b/nnrt/v2_0/NodeAttrTypes.idl @@ -13,304 +13,1503 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.0 + */ + +/** + * @file NodeAttrTypes.idl + * + * @brief Defines the parameters and functionality of AI model operators. + * + * All structures in this file declare only operator attributes and do not contain the interfaces for executing\n + * operator functions. + * - 1. The operators in the file are in one-to-one correspondence with a {@link NodeType}. In model inference,\n + * {@link NodeType} is stored in nodeType of {@link Node}. + * - 2. Each operator has at least one input and one output. The input is the tensor received by the operator,\n + * and the output is the tensor produced after the operator operation. The relationship between the input, operator,\n + * and output is determined by inputIndex and outIndex of the {@link Node} structure. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.0 + */ package ohos.hdi.nnrt.v2_0; import ohos.hdi.nnrt.v2_0.NnrtTypes; +/** + * @brief Defines the operator of the activation type. All activation functions belong to this operator.\n + * The specific activation function type is determined by the parameters. + * + * The {@link NodeType} of this operator is NODE_TYPE_ACTIVATION. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * A tensor returned after the activation function is executed. + * + * @since 3.2 + * @version 1.0 + */ struct Activation { + /** Activation function type. */ enum ActivationType activationType; + /** Size factor, used for the LeakyReLU and ELU activation functions. */ float alpha; + /** Minimum value, used for the HardTanh activation function. */ float minVal; + /** Maximum value, used for the HardTanh activation function. */ float maxVal; + /** Whether to use the approximation algorithm. It is used for the GRLU activation function. */ boolean approximate; }; +/** + * @brief Adds tensors. The output shape is the same as the input one after broadcasting, and the data type\n + * is the one with higher precision of the two inputs. + * + * The {@link NodeType} of this operator is NODE_TYPE_ADD_FUSION. + * + * Input: + * + * * x, the first input tensor. + * * y, the second input tensor. The data type must be the same as that of the first tensor. + * + * * Output: + * + * * Sum of the elements of x and y. The data shape is the same as the one after broadcasting,\n + * and the data type is the one with higher precision of the two inputs. + * If activationType is configured, the specified activation function will be called before + * the output is returned. + * + * @since 3.2 + * @version 1.0 + */ struct AddFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Obtains the first K indices or values of a cross-axis tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_ARGMAX_FUSION. + * + * + * Input: + * + * * x, a tensor of shape (N,*), where * indicates any number of additional dimensions. + * + * Output: + * + * * First K indices or values before the maximum input tensor on the axis. + * + * @since 3.2 + * @version 1.0 + */ struct ArgMaxFusion { + /** Target axis where the maximum indices or values are obtained. */ long axis; + /** First K maximum values on the axis. */ long topK; + /** Whether to keep the output dimensions the same as the input dimensions. */ boolean keepDims; + /** Return the index if the value is false. Return the value if the value is true.\n + * The default value is false. + */ boolean outMaxValue; }; +/** + * @brief Applies a 2D average pooling on the input tensor. The int8 quantization input is supported. + * + * The {@link NodeType} of this operator is NODE_TYPE_AVGPOOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor after average pooling. + * + * @since 3.2 + * @version 1.0 + */ struct AvgPoolFusion { + /** + * Kernel size used to obtain the average value. It is an int array in the format of [kernel_height, kernel_weight]\n + * with length of 2. + * The first number indicates the kernel height, and the second number indicates the kernel width. + */ long[] kernelSize; + /** + * Distance of kernel moving. The value is an int array [stride_height, stride_weight] with length of 2.\n + * The first number indicates the moving size in height, and the second number indicates the moving size in width. + */ long[] strides; + /** x is padded with an int array [top, bottom, left, right] with length of 4, and the nearest neighbor values\n + * are used for padding. + */ long[] pad; + /** Padding method. */ enum PadMode padMode; + /** Numerical operation mode of the output tensor. */ enum RoundMode roundMode; + /** Format of the data during calculation. For details, see {@link Format}. */ enum Format format; + /** Whether to do global pooling. */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks\n + * back into the spatial dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_BATCH_TO_SPACE_ND. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Output tensor. Assume that the shape of x is (n,h,w,c) and the shape of output is (n',h',w',c'): + * \f$ n' = n / (block_shape[0] * block_shape[1])\f$
+ * \f$ h' = h * block_shape[0] - crops[0][0] - crops[0][1] \f$
+ * \f$ w' = w * block_shape[1] - crops[1][0] - crops[1][1] \f$
+ * \f$ c'= c \f$ + * + * @since 3.2 + * @version 1.0 + */ struct BatchToSpaceND { + /** Block size, which is an array [height_block, weight_block] with length of 2. */ long[] blockShape; + /** + * Crop values for the spatial dimension. + * It is a 2D array [crop0_start, crop0_end], [crop1_start, crop1_end] with the shape of (2, 2). + */ long[][] crops; }; +/** + * @brief Offsets the data in each dimension of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_BIAS_ADD. + * + * Input: + * + * * x, an n-dimensional tensor. + * * bias, the bias tensor. + * + * Output: + * + * * Output tensor, which is the sum of the input tensor and the bias in each dimension. + * + * @since 3.2 + * @version 1.0 + */ struct BiasAdd { }; +/** + * @brief Converts the tensor data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_CAST. + * + * Input: + * + * * x, an n-dimensional tensor. + * * type, the target type of the data. + * + * Output: + * + * * A tensor with the specified data type. + * + * @since 3.2 + * @version 1.0 + */ struct Cast { }; +/** + * @brief Connects tensors in the specified axis or connects input tensors along with the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONCAT. + * + * Input: + * + * * Tensors with the same dimension. + * + * Output: + * + * * Result of the tensors connected. + * + * @since 3.2 + * @version 1.0 + */ struct Concat { + /** Axis specified. The value must be less than the number of dimensions of the input tensor. */ long axis; }; +/** + * @brief Calculates the 2D convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. + * In other cases, padding must be 0. + * + * Input: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with a length of [outChannel].\n + * In the quantization scenario, bias does not need to be quantized. + * If quantization is required, the input data must be of the int32 type. + * The actual quantization parameter is determined by x and weight. + * + * Output: + * + * * Convolution output. + * + * @since 3.2 + * @version 1.0 + */ struct Conv2DFusion { + /** Size (height and width) of the convolution kernel. */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight.\n + * It is an int array [strideHeight, strideWidth] with length of 2. + */ long[] stride; + /** + * Dilation size of the convolution kernel in height and weight. It is an int array in the format of\n + * [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around x in the height and width directions. It is an int array [top, bottom, left, right]\n + * with length of 4. + */ long[] padList; + /** + * Splits x into groups by inChannel. The group value is of the int type. + * If group is 1, it is a conventional convolution. + * If group is inChannel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. + * If group is greater than 1 and less than inChannel, it is group convolution.\n + * In this case, out_channel==group. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates a 2D transposed convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_TRANSPOSE_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with a length of [outChannel].\n + * * In the quantization scenario, bias does not need to be quantized. + * * If quantization is required, the input data must be of the int32 type. + * * The actual quantization parameter is determined by x and weight. + * + * Output: + * + * * An n-dimensional tensor. + * + * @since 3.2 + * @version 1.0 + */ struct Conv2dTransposeFusion { + /** Size (height and width) of the convolution kernel. */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight. It is an int array [strideHeight, strideWidth]\n + * with length of 2. + */ long[] stride; + /** Dilation size of the convolution kernel in height and weight. It is an int array [dilationHeight, dilationWidth]\n + * with length of 2. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around the input x in the height and width directions. It is an int array [top, bottom, left, right]\n + * with length of 4. */ long[] padList; + /** + * Splits x into groups by inChannel. + * If group is 1, it is a conventional convolution. + * If group is greater than 1 and less than or equal to inChannel, this is a group convolution. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; + /** + * A list of integer array with two elements, specifying the paddings along the height and width of the output tensor. + */ long[] outputPaddings; }; +/** + * @brief Divides the first tensor by the second tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_DIV_FUSION. + * + * Input: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Output: + * + * * Quotient of the two inputs. + * + * @since 3.2 + * @version 1.0 + */ struct DivFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs an element-wise operation. + * + * The {@link NodeType} of this operator is NODE_TYPE_ELTWISE. + * + * Input: + * + * * x1, the first input tensor. + * * x2, the second input tensor. + * + * Output: + * + * * A tensor with the same data type and shape as x1. + * + * @since 3.2 + * @version 1.0 + */ struct Eltwise { + /** Element-wise operation type. For details, see {@link EltwiseMode}. */ enum EltwiseMode mode; }; +/** + * @brief Adds an additional dimension to a tensor at the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_EXPAND_DIMS. + * + * Input: + * + * * x, an n-dimensional tensor. + * * axis: index of the dimension to be added. The value is of the int32_t type and must be a constant\n + * in the range [-dim-1, dim]. + * + * Output: + * + * * Operator with an additional dimension at the given axis. + * + * @since 3.2 + * @version 1.0 + */ struct ExpandDims { }; +/** + * @brief Creates a tensor of the specified dimensions and fills it with a scalar. + * + * The {@link NodeType} of this operator is NODE_TYPE_FILL. + * + * Input: + * + * * value: scalar used to fill the tensor. + * * shape, which specifies the dimensions of the tensor to create. + * Output: + * + * *Tensor filled by the scaler. + * + * @since 3.2 + * @version 1.0 + */ struct Fill { }; +/** + * @brief Applies full connection for the input data. + * + * The {@link NodeType} of this operator is NODE_TYPE_FULL_CONNECTION. + * + * When useAxis is true, axis must be set. When useAxis is false,\n + * axis is 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * * weight: weight tensor for a full connection. + * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required.\n + * * If quantization is required, the data must be of the int32 type. The actual quantization parameter is\n + * * determined by x and weight. + * * + * Output: + * + * * output: computed tensor. + * + * @since 3.2 + * @version 1.0 + */ struct FullConnection { + /** Whether to use the bias. */ boolean hasBias; + /** Whether to use the axis. */ boolean useAxis; + /** Axis specified for the full connection. The specified axis and its following axes are converted into\n + * a 1D tensor and then apply the full connection. + */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs batch normalization for a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_FUSED_BATCH_NORM. + * + * Input: + * + * * x: a tensor of shape [N, ..., C], that is, the nth dimension is the number of channels. + * * scale: 1D tensor of the scaling factor used to scale the first normalized tensor. + * * offset: 1D tensor used to move to the first normalized tensor. + * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training,\n + * * this parameter must be left empty. + * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training,\n + * * this parameter must be left empty. + * + * Output: + * + * * output: computed tensor. + * + * @since 3.2 + * @version 1.0 + */ struct FusedBatchNorm { + /** A small value close to zero. It is used to ensure that the divisor is not 0. */ float epsilon; }; +/** + * @brief Returns the slice of the input tensor based on the specified index and axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_GATHER. + * + * Input: + * + * * x, an n-dimensional tensor. + * * inputIndices, indices of elements of the original tensor. The value is an array of the int type\n + * * and must be in the range [0, x.shape[axis]). + * * axis, the axis on which x is sliced. The value is an array with one element of the int32_t type. + * + * Output: + * + * * Sliced tensor. + * + * @since 3.2 + * @version 1.0 + */ struct Gather { }; +/** + * @brief Applies layer normalization for a tensor from the specified axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_LAYER_NORM_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * gamma, an m-dimensional tensor. The dimensions of gamma must be the same as the shape of the part\n + * * of the input tensor to normalize. + * * beta, an m-dimensional tensor with the same shape as gamma. + * + * Output: + * + * * An n-dimensional tensor, with the same data type and shape as the input tensor. + * + * @since 3.2 + * @version 1.0 + */ struct LayerNormFusion { + /** Start axis of x to apply layer normalization. */ long beginNormAxis; + /** A value added to the denominator for numerical stability. */ float epsilon; + /** Whether to perform an element-wise operation. */ boolean elementwiseAffine; + /** Start axis of the parameter input (gamma, beta) to apply layer normalization.\n + * The value must be in the range [-n, n). + */ long beginParamsAxis; }; +/** + * @brief Calculates the result of x1 <= x2 element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LESS_EQUAL. + * + * Input: + * + * * x1, which can be a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * x2, which can be a number or a Boolean value if x1 is a tensor; or a tensor with the data type\n + * * of number or Boolean if x1 is not a tensor. + * + * Output: + * + * * A tensor with the data type of Boolean. When a quantization model is used, the quantization parameters of\n + * * the output cannot be omitted. However, values of the quantization parameters do not affect the result. + * + * @since 3.2 + * @version 1.0 + */ struct LessEqual { }; +/** + * @brief Calculates the matrix product of x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_MATMUL_FUSION. + * + * Input: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Output: + * + * * Matrix product of the inputs. When type! When = DATA_TYPE_UNKNOWN, the data type of the output is determined by\n + * * type. When type==DATA_TYPE_UNKNOWN, + * * the data type of the output depends on the data type converted during the calculation of x1 and x2. + * + * @since 3.2 + * @version 1.0 + */ struct MatMulFusion { + /** Whether to transpose the x1 matrix. */ boolean transposeA; + /** Whether to transpose the x2 matrix. */ boolean transposeB; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates the maximum of x1 and x2 element-wise. The inputs of x1 and x2\n + * comply with the implicit type conversion rules to make the data types are consistent. + * + * The input must be two tensors or one tensor and one scalar. When the input is two tensors, the data types\n + * cannot be Boolean at the same time, and their shapes can be broadcast to the same size. When the inputs are\n + * one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAXIMUM. + * + * Input: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Output: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 1.0 + */ struct Maximum { }; +/** + * @brief Applies a 2D maximum pooling over an input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAX_POOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 1.0 + */ struct MaxPoolFusion { + /** Size of the kernel used to take the maximum value. It is an int array [kernel_height, kernel_weight]\n + * with length of 2. + */ long[] kernelSize; + /** Distance of kernel moving. It is an int array with two elements. */ long[] strides; + /** Array to pad. */ long[] pad; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; - enum RoundMode roundMode; + /** Whether to do global pooling. */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Multiplies the elements in the same position of x1 and x2 to obtain output. + * + * If the shapes of x1 and x2 are different, expand x1 and x2 to the same shape through\n + * broadcast and then perform the multiplication. + * The {@link NodeType} of this operator is NODE_TYPE_MUL_FUSION. + * + * Input: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Output: + * + * * Product of each element of x1 and x2. + * + * @since 3.2 + * @version 1.0 + */ struct MulFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Generates a one-hot tensor based on the specified locations. + * + * The locations specified by indices are determined by on_value, and other locations are determined\n + * by off_value. + * + * The {@link NodeType} of this operator is NODE_TYPE_ONE_HOT. + * + * Input: + * + * * indices, an n-dimensional tensor. Each element in indices determines the location of on_value\n + * * in each one-hot vector. + * * depth, an integer scalar that determines the depth of the one-hot vector. The value of depth must be\n + * * greater than 0. + * * on_value, a scalar that specifies a valid value in the one-hot vector. + * * off_value, a scalar that specifies the values of other locations in the one-hot vector except the valid value. + * + * Output: + * + * * An (n+1)-dimensional tensor if indices is an n-dimensional tensor. The output shape is determined by\n + * * indices and axis. + * + * @since 3.2 + * @version 1.0 + */ struct OneHot { + /** + * An integer scalar that specifies the dimension for inserting the one-hot. + * Assume that the shape of indices is [N, C],\n + * and the value of depth is D. + * When axis is 0, the shape of the output is [D, N, C]. + * When axis is -1, the shape of the output is [N, C, D]. + * When axis is -1, the shape of the output is [N, D, C]. + * + */ long axis; }; +/** + * @brief Pads the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_PAD_FUSION. + * + * When paddingMode==PADDING_MODE_CONSTANT, constantValue must be set. + * The default value of constantValue is 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * * paddings, a 2D tensor that specifies the length to add in each dimension. + * * The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input + * * tensor in ith dimension. + * * paddings[i][1] indicates the number of paddings to add after the input tensor in ith dimension. + * + * Output: + * + * * An n-dimensional tensor after padding, with the same dimensions and data type as x. + * * The shape is determined by x and paddings. + * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] + * + * @since 3.2 + * @version 1.0 + */ struct PadFusion { + /** + * A 2D tensor, specifying the length to add in each dimension. The shape is [n, 2]. paddings[i][0] + * indicates the number of paddings to add before the input x in the ith dimension. + * paddings[i][1] indicates the number of paddings to add after the input x in the ith dimension. + * The meaning of this parameter is the same as that of paddings input. + */ long[][] paddings; + /** + * Padding mode. + * For details, see {@link PaddingMode}. + */ enum PaddingMode paddingMode; + /** + * A constant with the same data type as x. It specifies the value to add in the pad operation. + * This parameter is valid only when paddingMode==PADDING_MODE_CONSTANT. The default value is 0. + */ float constantValue; }; +/** + * @brief Calculates the y power of each element in x. The inputs must be two tensors or one tensor + * and one scalar. + * + * When the inputs are two tensors, their data types cannot be Boolean at the same time, and their shapes + * must be the same. + * When the inputs are one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_POW_FUSION. + * + * The x' = scale*x+shift operation is performed for each element of x, and then the y power of + * x' is calculated. + * + * Input: + * + * * x, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * y, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * + * Output: + * + * * A tensor, whose shape is determined by the shape of x and y after broadcasting. + * + * @since 3.2 + * @version 1.0 + */ struct PowFusion { + /** Scale the value of x. */ float scale; + /** Increase or decrease the value of x after scaling. */ float shift; }; +/** + * @brief Applies the PReLU activation of x and weight. + * + * The {@link NodeType} of this operator is NODE_TYPE_PRELU_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. If n is greater than or equal to 2, x must be + * * [BatchSize, ..., Channels]. The second dimension is the number of channels. + * * weight, a 1D tensor. The length of weight must be 1 or equal to the number of channels. + * * If the length of weight is 1, all channels share the same weight. + * If the length of weight is equal to the number of channels, each channel exclusively has a weight. + * If n of x is less than 2, the weight length must be 1. + * + * Output: + * + * * PReLU activation value of x, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct PReLUFusion { + /** + * Whether to enable weight sharing for the parameter validity check. + * If the length of weight is 1, channelShared must be true. + * Otherwise, channelShared is false. + */ boolean channelShared; }; +/** + * @brief Converts the data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor after the data type conversion. + * + * @since 3.2 + * @version 1.0 + */ struct QuantDTypeCast { + /** Data type of the input tensor. */ long srcT; + /** Data type of the output tensor. */ long dstT; }; +/** + * @brief Reduces the dimensions of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_REDUCE_FUSION. + * If mode is REDUCE_ALL, REDUCE_PROD, or REDUCE_MEAN and reduce_to_end + * is true, the output is the reduced value multiplied by coeff. + * + * Input: + * + * * x, an n-dimensional tensor, where n is less than 8. + * * axis, a 1D tensor that specifies the dimension to reduce. The value range of each element in axis + * * is [–n, n). + * + * Output: + * + * * An m-dimensional tensor, with the same data type as x. If keepDims is false, m < n. + * * If keepDims is true, m==n. + * + * @since 3.2 + * @version 1.0 + */ struct ReduceFusion { + /** Whether to keep the dimensions remain unchanged. */ boolean keepDims; + /** Algorithm used to reduce the tensor dimensions. For details, see {@link ReduceMode}. */ enum ReduceMode mode; + /** + * If this parameter is set to true, the first element is obtained from axis and set to i, + * and then axis will be changed to [i,i+1, ...,n-1,n]. + * For example, if reduceToEnd is true, axis is [2,4], and the number of dimensions of + * x is 7, then axis will be [2,3,4,5,6]. + */ boolean reduceToEnd; + /** Coefficient. */ float coeff; }; +/** + * @brief Reshapes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESHAPE. + * + * Input: + * + * * x, an n-dimensional tensor. + * * InputShape, a 1D tensor that specifies the shape of the output tensor. It must be a constant. + * + * Output: + * + * * A tensor of the specified shape. The data type is the same as that of x. + * + * @since 3.2 + * @version 1.0 + */ struct Reshape { }; +/** + * @brief Resizes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESIZE. + * + * The parameter combination of this operator can implement the Resize function. + * For example, to implement bilinear interpolation on the four corners of an image that is precisely aligned, set: + * method = RESIZE_METHOD_LINEAR + * coordinateTransformMode = COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS + * + * Input: + * + * * x, a 4D tensor in the [batchSize, height, width, channels] (NHWC) format. + * + * Output: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct Resize { + /** Method used for resizing. For details, see {@link ResizeMethod}. */ enum ResizeMethod method; + /** Height of the 4D tensor after resizing. */ long newHeight; + /** Width of the 4D tensor after resizing. */ long newWidth; + /** Whether to maintain the height/width ratio of x after resizing. */ boolean preserveAspectRatio; + /** + * Coordinate transformation method. For details, see {@link CoordinateTransformMode}. + */ enum CoordinateTransformMode coordinateTransformMode; + /** Cubic coefficient, used when method is RESIZE_METHOD_CUBIC. */ float cubicCoeff; + /** When excludeOutside==1, the sampling weight that exceeds the boundary of x is set to 0, + * and other weights are normalized. + */ long excludeOutside; + /** Value to interpolate, which is used only when x is cropped. The sampling weight that exceeds the + * boundary is set to extrapolationValue. + */ float extrapolationValue; + /** Nearest neighbor interpolation algorithm, used when method is RESIZE_METHOD_NEAREST. + * For details, see {@link NearestMode}. + */ enum NearestMode nearestMode; }; +/** + * @brief Calculates the reciprocal of the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RSQRT. + * + * Input: + * + * *x, an n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be less than 0. + * + * Output: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 1.0 + */ struct Rsqrt { }; +/** + * @brief Scales a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SCALE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * scale, the scaling tensor. + * * bias, the bias tensor. + * + * Output: + * + * * An n-dimensional tensor scaled, whose data type is the same as that of xx and shape is determined + * * by axis. + * + * @since 3.2 + * @version 1.0 + */ struct ScaleFusion { + /** Dimensions to scale. */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Returns the share of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SHAPE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An integer array representing the dimensions of x. + * + * @since 3.2 + * @version 1.0 + */ struct Shape { }; +/** + * @brief Slices a tensor of the specified size. + * + * The {@link NodeType} of this operator is NODE_TYPE_SLICE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * begin, an array of integers greater than or equal to 0, specifying the start of the slice. + * * size, an array of integers greater than or equal to 0, specifying the length of the slice. + * * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. + * + * Output: + * + * * An n-dimensional tensor obtained. + * + * @since 3.2 + * @version 1.0 + */ struct SliceFusion { + /** Dimensions on which the tensor is sliced. */ long[] axes; }; +/** + * @brief Applies the softmax operation on a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SOFTMAX. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result of the softmax operation. It is an n-dimensional tensor with the same data type and shape + * * as x. + * + * @since 3.2 + * @version 1.0 + */ struct Softmax { + /** Dimensions on which the softmax operation is performed. It is an integer in the range [-n, n). */ long[] axis; }; +/** + * @brief Splits a 4D tensor into multiple blocks in the spatial dimension and then concatenates these blocks + * in the batch dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPACE_TO_BATCH_ND. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * A 4D tensor with the same data type as x. The shape is determined by input, blockShape, + * and paddings. Assume that the input shape is [n,c,h,w], then: + * \f$ output.shape[0] = n * blockShape[0] * blockShape[1]\f$
+ * \f$ output.shape[1] = c \f$
+ * \f$ output.shape[2] = (h + paddings[0][0] + paddings[0][1]) / blockShape[0] \f$
+ * \f$ output.shape[3] = (w + paddings[1][0] + paddings[1][1]) / blockShape[1] \f$
+ * \f$ (h + paddings[0][0] + paddings[0][1]) must be an integer multiple of \f$ blockShape[0]\f$, and + * (w + paddings[1][0] + paddings[1][1]) \f$ must be an integer multiple of \f$ blockShape[1] \f$. + * + * @since 3.2 + * @version 1.0 + */ struct SpaceToBatchND { + /** Number of blocks. The value must be greater than 1. */ long[] blockShape; + /** Padding size for spatial dimensions. */ long[][] paddings; }; +/** + * @brief Splits a tensor into multiple tensors along the axis dimension. The number of tensors is + * specified by outputNum. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPLIT. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An array of n-dimensional tensors, with the same data type and dimensions. + * * The data type of each tensor is the same as that of x. + * + * @since 3.2 + * @version 1.0 + */ struct Split { + /** Number of output sensors. */ long outputNum; + /** + * Size of each tensor to output. + * If size_splits is empty, x will be evenly split into tensors of the same size. + * In this case, x.shape[axis] must be an integer multiple of outputNum. + * If size_splits is not empty, the sum of all elements must be equal to x.shape[axis]. + */ long[] sizeSplits; + /** Target axis on which x is split. The data type is int. */ long axis; }; +/** + * @brief Calculates the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQRT. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An n-dimensional tensor, with the same data type and shape as x. + * + * @since 3.2 + * @version 1.0 + */ struct Sqrt { }; +/** + * @brief Calculates the square of the difference between two tensors. + * The SquaredDifference operator supports subtraction between tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUEEZE. + * + * Input: + * + * * x, a tensor representing the minuend, which can be a number or a Boolean value. + * * x, a tensor representing the subtrahend, which can be a number or a Boolean value. + * + * Output: + * + * * A tensor obtained. The shape of the output is determined by x and y. + * * If x and y are of the same shape, the output shape is the same as that of x and y. + * If x and y are of different types, you need to perform the broadcast operation on + * x and y first. + * The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 1.0 + */ struct SquaredDifference { }; +/** + * @brief Removes the dimension with length of 1 from the specified axis. The int8 quantization input is supported. + * + * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor + * must be [2, 1, 2, 2]. That is, the dimension with the length of 1 between the 0th and 1st dimensions is removed. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUARED_DIFFERENCE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * *Tensor obtained. + * + * @since 3.2 + * @version 1.0 + */ struct Squeeze { + /** Axis on which the dimension of length 1 is to be removed. The value can be an integer or an array. + * The value range of the integer is [-n, n). + */ long[] axis; }; +/** + * @brief Stacks multiple tensors along the specified axis. If the number of dimensions of each tensor is n + * before stacking, the number of dimensions of the output tensor is n+1. + * + * The {@link NodeType} of this operator is NODE_TYPE_STACK. + * + * Input: + * + * * Multiple n-dimensional tensors, which are of the same data type and shape. + * + * Output: + * + * * An n+1D tensor along the specified axis, with the same data type and precision as the input tensors. + * + * @since 3.2 + * @version 1.0 + */ struct Stack { + /** An integer that specifies the dimension for tensor stacking. The value range is [-(n+1),(n+1)), + * which means a negative number is allowed. + */ long axis; }; +/** + * @brief Slices a tensor at the specified intervals. + * + * The {@link NodeType} of this operator is NODE_TYPE_STRIDED_SLICE. + * + * Input: + * + * * x, an n-dimensional tensor. + * * begin, a 1D tensor that specifies the position from which the tensor is sliced. + * * The length of begin is n. begin[i] specifies the start point to slice in the ith dimension. + * * end, a 1D tensor that specifies the end to which the tensor is sliced. The length of end is n. + * * end[i] specifies the end point to slice in the ith dimension. + * * strides, a 1D tensor that specifies the intervals for slicing. The length of strides is n. + * * strides[i] specifies the intervals at which the tensor is sliced in the ith dimension. Negative values are allowed. + * + * For the input tensor, the shapes of begin, end, and strides must be the same. + * The indices of begin and end start from 0. The elements of strides cannot be 0. + * + * Output: + * + * * A tensor, with the same data type as x. The number of dimensions of the output tensor is rank (x[0])+1. + * + * @since 3.2 + * @version 1.0 + */ struct StridedSlice { + /** + * Mask of begin. + * beginMask identifies different dimensions of x in binary code. For example, if bit i of beginMask + * is set to 1, the setting of begin in the ith dimension will be invalid, which means the start index of + * that dimension is 0. The default value is 0. + */ long beginMask; + /** + * Mask of end. The parameter is similar to begin_mask. + * endMask identifies different dimensions of x in binary code. For example, if bit i of endMask is + * set to 1, the setting of end in the ith dimension will be invalid, which means the tensor will be + * sliced till the end in that dimension. The default value is 0. + */ long endMask; + /** + * An integer used to mask begin and end. + * The tensor does not need to be sliced in the non-zero dimensions. + * ellipsisMask is represented in binary code. If bit i of ellipsisMask is 1, elements are sliced + * from the first element at strides[i] in the ith dimension until the tensor boundary. + */ long ellipsisMask; + /** + * Used to add a dimension. + * newAxisMask identifies different dimensions of x in binary code. If bit i is 1, the settings of + * begin, end, and strides are invalid for all dimensions, and a dimension with size of 1 is added + * to bit i. + */ long newAxisMask; + /** + * Used to shrink the specified dimension. + * shrinkAxisMask is represented in binary code. If the ith bit of the shrinkAxisMask is 1, all + * elements in the ith dimension will be discarded, and the length of the ith dimension is shrunk to 1. + */ long shrinkAxisMask; }; +/** + * @brief Calculates the difference between two tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SUB_FUSION. + * + * Input: + * + * * x, the minuend, which is a tensor of the int or float type. + * * y, the subtrahend, which is a tensor of the int or float type. + * + * Output: + * + * * Difference between the two tensors. The output shape is determined byx and y. + * * If x and y are of the same shape, the output tensor has the same shape as x and y. + * If x and y are of different shapes, perform the broadcast operation on x or y first. + * The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 1.0 + */ struct SubFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Copies a tensor by the specified times. + * + * The {@link NodeType} of this operator is NODE_TYPE_TILE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * multiples, a 1D tensor that specifies the number of times that the input tensor is copied + * * in each dimension. + * * The length m is not less than the number of dimensions of x. + * + * Output: + * + * * An m-dimensional tensor, with the same data type as x. If the length of x is the same as that of + * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, + * an n-dimensional tensor is output. + * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. + * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. + * + * @since 3.2 + * @version 1.0 + */ struct TileFusion { + /** A 1D tensor that specifies the number of times that data is copied in each dimension. The length m is not + * less than the number of dimensions of x. + */ long[] dims; }; +/** + * @brief Obtains the first K maximum values along the axis and their indices. + * + * The {@link NodeType} of this operator is NODE_TYPE_TOPK_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * output0, the first K maximum values in the axis dimension. + * * output1, indices of the first K maximum values. + * + * @since 3.2 + * @version 1.0 + */ struct TopKFusion { + /** The value true means to sort the elements in descending order; the value false means + * the opposite. + */ boolean sorted; + /** Specified axis. */ long axis; }; +/** + * @brief Transposes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_TRANSPOSE. + * + * Input: + * + * * x, an n-dimensional tensor to transpose. + * * perm, a 1D tensor that specifies the permutation. Its length is the same as the number of dimensions of + * * x. + * + * Output: + * + * * An n-dimensional tensor, which has the same data type and quantization parameters as x. + * * The shape is determined by the shape of x and perm. + * + * @since 3.2 + * @version 1.0 + */ struct Transpose { }; +/** + * @brief Adds a dimension based on the value of axis. * + * + * The {@link NodeType} of this operator is NODE_TYPE_UNSQUEEZE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor output. + * + * @since 3.2 + * @version 1.0 + */ struct Unsqueeze { + /** Dimension to add. The value of axis can be an integer or an array of integers. + * The value range of the integer is [-n, n). + */ long[] axis; -}; \ No newline at end of file +}; + +/** @} */ -- Gitee From ecf383e71ad7b4db2e89de9a68b7ed4188df7dbd Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 6 Feb 2024 11:37:15 +0800 Subject: [PATCH 024/210] update v1_0/v2_0 description Signed-off-by: maoyong --- nnrt/v1_0/INnrtDevice.idl | 7 ++----- nnrt/v2_0/INnrtDevice.idl | 12 ++++-------- nnrt/v2_0/IPreparedModel.idl | 4 ++-- nnrt/v2_0/NnrtTypes.idl | 2 +- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/nnrt/v1_0/INnrtDevice.idl b/nnrt/v1_0/INnrtDevice.idl index c23a3726..75b3f872 100644 --- a/nnrt/v1_0/INnrtDevice.idl +++ b/nnrt/v1_0/INnrtDevice.idl @@ -161,9 +161,7 @@ interface INnrtDevice { * @return Returns 0 if the operation is successful. * @return Returns a negative number if the operation fails. */ - PrepareModel([in] struct Model model, - [in] struct ModelConfig config, - [out] IPreparedModel preparedModel); + PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); /** * @brief Checks whether the device supports caching of the AI models built. @@ -187,8 +185,7 @@ interface INnrtDevice { * @return Returns 0 if the operation is successful. * @return Returns a negative number if the operation fails. */ - PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, - [in] struct ModelConfig config, + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); /** diff --git a/nnrt/v2_0/INnrtDevice.idl b/nnrt/v2_0/INnrtDevice.idl index c7e2d683..3129c068 100644 --- a/nnrt/v2_0/INnrtDevice.idl +++ b/nnrt/v2_0/INnrtDevice.idl @@ -177,9 +177,7 @@ interface INnrtDevice { * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ - PrepareModel([in] struct Model model, - [in] struct ModelConfig config, - [out] IPreparedModel preparedModel); + PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); /** * @brief Checks whether the device supports caching of the AI models built. @@ -206,15 +204,14 @@ interface INnrtDevice { * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ - PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, - [in] struct ModelConfig config, + PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); /** * @brief Loads offline model files from the cache. The offline model is obtained after offline model files\n * are passed by the inference framework to the NNRt module and then parsed by the NNRt module. * - * @param modelCache Array of offline model files. The sequence of array elements depends on the format of\n + * @param offlineModels Array of offline model files. The sequence of array elements depends on the format of\n * the input offline model. For details about the element types, see the definition of SharedBuffer {@link SharedBuffer}. * @param config Configuration for loading the offline model files. For details, see {@link ModelConfig}. * @param preparedModel Model object obtained. For details, see {@link IPreparedModel}. @@ -223,8 +220,7 @@ interface INnrtDevice { * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ - PrepareOfflineModel([in] struct SharedBuffer[] modelCache, - [in] struct ModelConfig config, + PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); /** diff --git a/nnrt/v2_0/IPreparedModel.idl b/nnrt/v2_0/IPreparedModel.idl index 48f95dd4..92a11158 100644 --- a/nnrt/v2_0/IPreparedModel.idl +++ b/nnrt/v2_0/IPreparedModel.idl @@ -85,7 +85,7 @@ interface IPreparedModel { *For details about the input data type, see {@link IOTensor}. * @param outputs Output data of AI model inference. After inference, the output data is written to the\n *shared buffer. For details about the output data type, see {@link IOTensor}. - * @param outputsDims Dimensions of the output data. The output sequence is the same as that of outputs. + * @param outputDims Dimensions of the output data. The output sequence is the same as that of outputs. * @param isOutputBufferEnough Whether the shared buffer space is sufficient for the output data.\n *The value true means the shared buffer space is sufficient; the value false means the opposite. * @@ -93,7 +93,7 @@ interface IPreparedModel { * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ - Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputsDims); + Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); } /** @} */ diff --git a/nnrt/v2_0/NnrtTypes.idl b/nnrt/v2_0/NnrtTypes.idl index 7ad2e271..ea22f13a 100644 --- a/nnrt/v2_0/NnrtTypes.idl +++ b/nnrt/v2_0/NnrtTypes.idl @@ -851,7 +851,7 @@ enum PaddingMode : byte { * @since 4.0 * @version 2.0 */ -enum NNRT_ReturnCode : int { +enum NNRT_ReturnCode : unsigned int { /** Success. */ NNRT_SUCCESS = 0, /** Failed. */ -- Gitee From 4f779a452a829e9cce98870e1f8940aec7437485 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 6 Feb 2024 14:14:19 +0800 Subject: [PATCH 025/210] update nnrt v2_0 maxpool attrTypes Signed-off-by: maoyong --- nnrt/v2_0/NodeAttrTypes.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nnrt/v2_0/NodeAttrTypes.idl b/nnrt/v2_0/NodeAttrTypes.idl index 463be678..e3dd60e0 100644 --- a/nnrt/v2_0/NodeAttrTypes.idl +++ b/nnrt/v2_0/NodeAttrTypes.idl @@ -726,6 +726,8 @@ struct MaxPoolFusion enum PadMode padMode; /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** RoundMode mode. For details, see {@link RoundMode}. */ + enum RoundMode roundMode; /** Whether to do global pooling. */ boolean global; /** Activation function type. For details, see {@link ActivationType}. */ -- Gitee From fad7db8004ce09fd380cf24849e3f2cb660c290f Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 6 Feb 2024 14:55:25 +0800 Subject: [PATCH 026/210] update nnrt v1_0/v2_0 description Signed-off-by: maoyong --- nnrt/v1_0/NnrtTypes.idl | 3 -- nnrt/v1_0/NodeAttrTypes.idl | 22 ++++----- nnrt/v2_0/ModelTypes.idl | 10 ++-- nnrt/v2_0/NnrtTypes.idl | 42 ++++++++-------- nnrt/v2_0/NodeAttrTypes.idl | 98 ++++++++++++++++++------------------- 5 files changed, 85 insertions(+), 90 deletions(-) diff --git a/nnrt/v1_0/NnrtTypes.idl b/nnrt/v1_0/NnrtTypes.idl index e8d22177..9b631688 100644 --- a/nnrt/v1_0/NnrtTypes.idl +++ b/nnrt/v1_0/NnrtTypes.idl @@ -795,12 +795,9 @@ enum RoundMode : byte { [8. 7. 7. 8. 9. 9. 8.],\\ [5. 4. 4. 5. 6. 6. 5.]]\\ \f$ * - * - * * @since 3.2 * @version 1.0 */ - enum PaddingMode : byte { /** Constant (0 by default) padding. */ PADDING_MODE_CONSTANT = 0, diff --git a/nnrt/v1_0/NodeAttrTypes.idl b/nnrt/v1_0/NodeAttrTypes.idl index 9d694649..77a54009 100644 --- a/nnrt/v1_0/NodeAttrTypes.idl +++ b/nnrt/v1_0/NodeAttrTypes.idl @@ -27,7 +27,7 @@ * @file NodeAttrTypes.idl * * @brief Defines the parameters and functions of AI model operators. - * + * * All structures in this file declare only operator attributes and do not contain the interfaces for executing operator functions. * - 1. The operators in the file are in one-to-one correspondence with a {@link NodeType}. In model inference, {@link NodeType} is stored in nodeType of {@link Node}. * - 2. Each operator has at least one input and one output. The input is the tensor received by the operator, and the output is the tensor obtained after the operator operation. The relationship between the input, operator, and output is determined by inputIndex and outIndex of the {@link Node} structure. @@ -48,7 +48,7 @@ import ohos.hdi.nnrt.v1_0.NnrtTypes; /** * @brief Defines the operator of the activation type. All activation functions belong to this operator. The specific activation function type is determined by the parameters. - * + * * The {@link NodeType} of this operator is NODE_TYPE_ACTIVATION. * * Inputs: @@ -78,7 +78,7 @@ struct Activation /** * @brief Adds tensors. - * + * * The {@link NodeType} of this operator is NODE_TYPE_ADD_FUSION. * * Inputs: @@ -383,7 +383,7 @@ struct Conv2dTransposeFusion * * * x1, a tensor of the int or float type. * * x2, a tensor of the int or float type. - * + * * Outputs: * * * Quotient of the two inputs. @@ -635,7 +635,7 @@ struct MatMulFusion * * Outputs: * - /** Maximum value of the elements of the two tensors. + * * Maximum value of the elements of the two tensors. * * @since 3.2 * @version 1.0 @@ -657,7 +657,7 @@ struct Maximum * * Outputs: * - /** Maximum value of the elements of the two tensors. + * * Maximum value of the elements of the two tensors. * * @since 3.2 * @version 1.0 @@ -682,7 +682,7 @@ struct MaxPoolFusion /** * @brief Multiplies the elements in the same position of x1 and x2 to obtain output. - * + * * If the shapes of x1 and x2 are different, expand x1 and x2 to the same shape through broadcast and then perform the multiplication. * The {@link NodeType} of this operator is NODE_TYPE_MUL_FUSION. * @@ -766,12 +766,12 @@ struct PadFusion * The meaning of this parameter is the same as that of paddings input. */ long[][] paddings; - /** + /** * Padding mode. * For details, see {@link PaddingMode}. */ enum PaddingMode paddingMode; - /** + /** * A constant with the same data type as x. It specifies the value to add in the pad operation. * This parameter is valid only when paddingMode==PADDING_MODE_CONSTANT. The default value is 0. */ @@ -780,7 +780,7 @@ struct PadFusion /** * @brief Calculates the y power of each element in x. The inputs must be two tensors or one tensor and one scalar. - * + * * When the inputs are two tensors, their data types cannot be Boolean at the same time, and their shapes must be the same. When the inputs are one tensor and one scalar, the scalar must be a constant. * * The {@link NodeType} of this operator is NODE_TYPE_POW_FUSION. @@ -1175,7 +1175,7 @@ struct SquaredDifference /** * @brief Removes the dimension with length of 1 from the specified axis. The int8 quantization input is supported. - * + * * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor must be [2, 1, 2, 2]. That is, the dimension with one element between the 0th and 1st dimensions is removed. * * The {@link NodeType} of this operator is NODE_TYPE_SQUARED_DIFFERENCE. diff --git a/nnrt/v2_0/ModelTypes.idl b/nnrt/v2_0/ModelTypes.idl index 2b02e96c..793aa41f 100644 --- a/nnrt/v2_0/ModelTypes.idl +++ b/nnrt/v2_0/ModelTypes.idl @@ -42,7 +42,7 @@ * and the outputs the model inference result. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ /** @@ -59,7 +59,7 @@ import ohos.hdi.nnrt.v2_0.NnrtTypes; * @brief Defines the tensor structure. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Tensor { /** Tensor name. */ @@ -107,7 +107,7 @@ struct Tensor { * Up to now, the four parameters are written into full_connection. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Node { /** Operator node name. */ @@ -130,7 +130,7 @@ struct Node { * @brief Defines the subgraph structure. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SubGraph { /** Subgraph name. */ @@ -150,7 +150,7 @@ struct SubGraph { * Generally, a model has only one subGraph. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Model { /** Model name. */ diff --git a/nnrt/v2_0/NnrtTypes.idl b/nnrt/v2_0/NnrtTypes.idl index ea22f13a..18f9ae35 100644 --- a/nnrt/v2_0/NnrtTypes.idl +++ b/nnrt/v2_0/NnrtTypes.idl @@ -45,7 +45,7 @@ package ohos.hdi.nnrt.v2_0; * @brief Defines the shared memory data structure. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SharedBuffer { /** File descriptor of the shared memory. */ @@ -62,7 +62,7 @@ struct SharedBuffer { * @brief Enumerates the AI chip types. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum DeviceType: int { /** Other types. */ @@ -79,7 +79,7 @@ enum DeviceType: int { * @brief Enumerates the AI chip states. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum DeviceStatus: int { /** Available. */ @@ -96,7 +96,7 @@ enum DeviceStatus: int { * @brief Enumerates the performance modes for a chip to perform AI computing. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum PerformanceMode: int { /** No performance mode is specified. The specific running mode is defined by the chip. */ @@ -115,7 +115,7 @@ enum PerformanceMode: int { * @brief Enumerates the AI computing task priorities. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum Priority: int { /** No task priority is specified. The specific execution policy is defined by the chip. */ @@ -151,7 +151,7 @@ struct ModelConfig { * @brief Enumerates the operator data formats. This parameter must be used together with {@link Tensor}. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum Format : byte { /** Format initial value. */ @@ -202,7 +202,7 @@ enum Format : byte { * When \f$ r_{min} \f$ and \f$ r_{max} \f$ are 0, scale and zeroPoint must be 0. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct QuantParam { /** Number of quantized bits. */ @@ -217,7 +217,7 @@ struct QuantParam { * @brief Enumerates the tensor data types. This parameter must be used together with {@link Tensor}. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum DataType : byte { /** Unknown type. */ @@ -252,7 +252,7 @@ enum DataType : byte { * @brief Defines the input and output tensors of an AI model. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct IOTensor { /** Tensor name. */ @@ -273,7 +273,7 @@ struct IOTensor { * @brief Enumerates the quantization types. This parameter must be used together with {@link Node}. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum QuantType: byte { /** Do not use quantification. */ @@ -286,7 +286,7 @@ enum QuantType: byte { * @brief Enumerates the operator types. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum NodeType : unsigned int { /** None. */ @@ -393,7 +393,7 @@ enum NodeType : unsigned int { * @brief Enumerates the resize methods. It must be used together with the {@link Resize} operator. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum ResizeMethod : byte { /** Unknown. This is the default value. */ @@ -458,7 +458,7 @@ enum ResizeMethod : byte { * COORDINATE_TRANSFORM_MODE_HALF_PIXEL: \f$ old_i = newWidth > 1 ? (new_x + 0.5) * oldWidth / newWidth - 0.5 : 0 \f$
* * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum CoordinateTransformMode : byte { /** Scale based on the ratio without alignment. */ @@ -474,7 +474,7 @@ enum CoordinateTransformMode : byte { * {@link Resize} operator. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum NearestMode : byte { /** Round off. */ @@ -498,7 +498,7 @@ enum NearestMode : byte { * the corresponding activation function will be called after the operator calculation is complete. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum ActivationType : byte { /** No activation function. */ @@ -714,7 +714,7 @@ enum ActivationType : byte { * @brief Enumerates the modes for removing dimensions. It must be used together with the {@link ReduceFusion} operator. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum ReduceMode : byte { /** Use the average value of all elements of a dimension to replace other elements of the dimension. */ @@ -740,7 +740,7 @@ enum ReduceMode : byte { * {@link Eltwise} operator. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum EltwiseMode : byte { /** Product of the elements of two tensors */ @@ -758,7 +758,7 @@ enum EltwiseMode : byte { * {@link Conv2DFusion}, and {@link MaxPoolFusion}. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum PadMode : byte { /** @@ -785,7 +785,7 @@ enum PadMode : byte { * {@link AvgPoolFusion} operator. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ enum RoundMode : byte { /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down to −24. */ @@ -829,11 +829,9 @@ enum RoundMode : byte { [8. 7. 7. 8. 9. 9. 8.],\\ [5. 4. 4. 5. 6. 6. 5.]]\\ \f$ * - * * @since 3.2 - * @version 1.0 + * @version 2.0 */ - enum PaddingMode : byte { /** Constant (0 by default) padding. */ PADDING_MODE_CONSTANT = 0, diff --git a/nnrt/v2_0/NodeAttrTypes.idl b/nnrt/v2_0/NodeAttrTypes.idl index e3dd60e0..0296404c 100644 --- a/nnrt/v2_0/NodeAttrTypes.idl +++ b/nnrt/v2_0/NodeAttrTypes.idl @@ -38,7 +38,7 @@ * and output is determined by inputIndex and outIndex of the {@link Node} structure. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ /** @@ -66,7 +66,7 @@ import ohos.hdi.nnrt.v2_0.NnrtTypes; * * A tensor returned after the activation function is executed. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Activation { @@ -101,7 +101,7 @@ struct Activation * the output is returned. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct AddFusion { @@ -124,7 +124,7 @@ struct AddFusion * * First K indices or values before the maximum input tensor on the axis. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct ArgMaxFusion { @@ -157,7 +157,7 @@ struct ArgMaxFusion * * Tensor after average pooling. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct AvgPoolFusion { @@ -207,7 +207,7 @@ struct AvgPoolFusion * \f$ c'= c \f$ * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct BatchToSpaceND { @@ -235,7 +235,7 @@ struct BatchToSpaceND * * Output tensor, which is the sum of the input tensor and the bias in each dimension. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct BiasAdd { @@ -256,7 +256,7 @@ struct BiasAdd * * A tensor with the specified data type. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Cast { @@ -276,7 +276,7 @@ struct Cast * * Result of the tensors connected. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Concat { @@ -307,7 +307,7 @@ struct Concat * * Convolution output. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Conv2DFusion { @@ -368,7 +368,7 @@ struct Conv2DFusion * * An n-dimensional tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Conv2dTransposeFusion { @@ -421,7 +421,7 @@ struct Conv2dTransposeFusion * * Quotient of the two inputs. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct DivFusion { @@ -444,7 +444,7 @@ struct DivFusion * * A tensor with the same data type and shape as x1. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Eltwise { @@ -468,7 +468,7 @@ struct Eltwise * * Operator with an additional dimension at the given axis. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct ExpandDims { @@ -488,7 +488,7 @@ struct ExpandDims * *Tensor filled by the scaler. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Fill { @@ -515,7 +515,7 @@ struct Fill * * output: computed tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct FullConnection { @@ -551,7 +551,7 @@ struct FullConnection * * output: computed tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct FusedBatchNorm { @@ -576,7 +576,7 @@ struct FusedBatchNorm * * Sliced tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Gather { @@ -599,7 +599,7 @@ struct Gather * * An n-dimensional tensor, with the same data type and shape as the input tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct LayerNormFusion { @@ -632,7 +632,7 @@ struct LayerNormFusion * * the output cannot be omitted. However, values of the quantization parameters do not affect the result. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct LessEqual { @@ -655,7 +655,7 @@ struct LessEqual * * the data type of the output depends on the data type converted during the calculation of x1 and x2. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct MatMulFusion { @@ -687,7 +687,7 @@ struct MatMulFusion /** Maximum value of the elements of the two tensors. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Maximum { @@ -710,7 +710,7 @@ struct Maximum /** Maximum value of the elements of the two tensors. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct MaxPoolFusion { @@ -751,7 +751,7 @@ struct MaxPoolFusion * * Product of each element of x1 and x2. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct MulFusion { @@ -782,7 +782,7 @@ struct MulFusion * * indices and axis. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct OneHot { @@ -821,7 +821,7 @@ struct OneHot * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct PadFusion { @@ -867,7 +867,7 @@ struct PadFusion * * A tensor, whose shape is determined by the shape of x and y after broadcasting. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct PowFusion { @@ -896,7 +896,7 @@ struct PowFusion * * PReLU activation value of x, with the same shape and data type as x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct PReLUFusion { @@ -922,7 +922,7 @@ struct PReLUFusion * * Tensor after the data type conversion. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct QuantDTypeCast { @@ -951,7 +951,7 @@ struct QuantDTypeCast * * If keepDims is true, m==n. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct ReduceFusion { @@ -985,7 +985,7 @@ struct ReduceFusion * * A tensor of the specified shape. The data type is the same as that of x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Reshape { @@ -1010,7 +1010,7 @@ struct Reshape * * An n-dimensional tensor, with the same shape and data type as x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Resize { @@ -1056,7 +1056,7 @@ struct Resize * * An n-dimensional tensor, with the same shape and data type as x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Rsqrt { @@ -1079,7 +1079,7 @@ struct Rsqrt * * by axis. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct ScaleFusion { @@ -1103,7 +1103,7 @@ struct ScaleFusion * * An integer array representing the dimensions of x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Shape { @@ -1126,7 +1126,7 @@ struct Shape * * An n-dimensional tensor obtained. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SliceFusion { @@ -1149,7 +1149,7 @@ struct SliceFusion * * as x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Softmax { @@ -1179,7 +1179,7 @@ struct Softmax * (w + paddings[1][0] + paddings[1][1]) \f$ must be an integer multiple of \f$ blockShape[1] \f$. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SpaceToBatchND { @@ -1205,7 +1205,7 @@ struct SpaceToBatchND * * The data type of each tensor is the same as that of x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Split { @@ -1236,7 +1236,7 @@ struct Split * * An n-dimensional tensor, with the same data type and shape as x. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Sqrt { @@ -1262,7 +1262,7 @@ struct Sqrt * The precision of the output is the same as the input tensor with higher precision. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SquaredDifference { @@ -1285,7 +1285,7 @@ struct SquaredDifference * *Tensor obtained. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Squeeze { @@ -1310,7 +1310,7 @@ struct Squeeze * * An n+1D tensor along the specified axis, with the same data type and precision as the input tensors. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Stack { @@ -1343,7 +1343,7 @@ struct Stack * * A tensor, with the same data type as x. The number of dimensions of the output tensor is rank (x[0])+1. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct StridedSlice { @@ -1401,7 +1401,7 @@ struct StridedSlice * The precision of the output is the same as the input tensor with higher precision. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct SubFusion { @@ -1430,7 +1430,7 @@ struct SubFusion * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct TileFusion { @@ -1455,7 +1455,7 @@ struct TileFusion * * output1, indices of the first K maximum values. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct TopKFusion { @@ -1484,7 +1484,7 @@ struct TopKFusion * * The shape is determined by the shape of x and perm. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Transpose { @@ -1504,7 +1504,7 @@ struct Transpose * * Tensor output. * * @since 3.2 - * @version 1.0 + * @version 2.0 */ struct Unsqueeze { -- Gitee From 819ea5ca40c49077adfae1acc71d2def85b66c0f Mon Sep 17 00:00:00 2001 From: maoyong Date: Wed, 7 Feb 2024 16:24:56 +0800 Subject: [PATCH 027/210] add south interface description Signed-off-by: maoyong --- nnrt/v2_1/INnrtDevice.idl | 215 ++++- nnrt/v2_1/IPreparedModel.idl | 77 +- nnrt/v2_1/ModelTypes.idl | 131 ++- nnrt/v2_1/NnrtTypes.idl | 674 +++++++++++++- nnrt/v2_1/NodeAttrTypes.idl | 1628 +++++++++++++++++++++++++++++++++- 5 files changed, 2719 insertions(+), 6 deletions(-) diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl index ed45e918..22fc5822 100644 --- a/nnrt/v2_1/INnrtDevice.idl +++ b/nnrt/v2_1/INnrtDevice.idl @@ -13,28 +13,241 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment\n + * oriented to the AI field. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @file INnrtDevice.idl + * + * @brief Defines methods related to chip devices. + * + * You can use the methods to query chip device information and build AI models. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.1 + */ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; import ohos.hdi.nnrt.v2_1.ModelTypes; import ohos.hdi.nnrt.v2_1.IPreparedModel; +/** + * @brief Provides methods for device management and model building. + * + * When multiple devices are registered, ensure that the combination of the device name\n + * and vendor name is globally unique. + * + * @since 3.2 + * @version 2.1 + */ interface INnrtDevice { + /** + * @brief Obtains the device name. + * + * @param name Device name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceName([out] String name); + + /** + * @brief Obtains the device vendor name. + * + * @param name Device vendor name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetVendorName([out] String name); + + /** + * @brief Obtains the device type. + * + * @param deviceType Device type. For details, see {@link DeviceType}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceType([out] enum DeviceType deviceType); + + /** + * @brief Obtains the device status. + * + * @param deviceType Device status. For details, see {@link DeviceStatus}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetDeviceStatus([out] enum DeviceStatus status); + + /** + * @brief Obtains the device's support for the operators of the specified AI model. + * + * @param model AI model. For details, see {@link Model}. + * @param ops Operators supported and not supported by the device. The operators are listed in the same\n + * sequence as they listed in the API model. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetSupportedOperation([in] struct Model model, [out] boolean[] ops); + + /** + * @brief Checks whether the device supports the Float32 model with the Float16 precision. + * + * @param isSupported Whether the Float16 precision is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsFloat16PrecisionSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports performance preference settings. For details about the performance\n + * preference, see {@link PerformanceMode}. + * + * @param isSupported Whether performance preference settings are supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsPerformanceModeSupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports task priority settings. For details about the priority,\n + * see {@link Priority}. + * + * @param isSupported Whether task priority settings are supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsPrioritySupported([out] boolean isSupported); + + /** + * @brief Checks whether the device supports dynamic input, which allows a model of different shapes\n + * to be used for different operations. + * + * If dynamic input is supported, -1 is added in the shape of the input tensor. + * + * @param isSupported Whether dynamic input is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsDynamicInputSupported([out] boolean isSupported); + + /** + * @brief Builds a model. + * + * If the AI model supports dynamic input, at least one dimension of the input tensor contains -1. + * + * @param model Module to build. For details, see {@link Model}. + * @param config Model configuration. For details, see {@link ModelConfig}. + * @param preparedModel Model object built. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ PrepareModel([in] struct Model model, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Checks whether the device supports caching of the AI models built. + * + * If yes, PrepareModelFromModelCache() and ExportModelCache() need to be implemented. + * + * @param isSupported Whether caching of the AI models built is supported. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ IsModelCacheSupported([out] boolean isSupported); + + /** + * @brief Loads an AI model from the cache. The AI model is exported by using ExportModelCache(). + * + * @param modelCache Array of the model files, which are in the same sequence as they exported. For details,\n + * see {@link SharedBuffer}. + * @param config Configuration for loading the model. For details, see {@link ModelConfig}. + * @param preparedModel Model object. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ PrepareModelFromModelCache([in] struct SharedBuffer[] modelCache, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Loads offline model files from the cache. The offline model is obtained after offline model files\n + * are passed by the inference framework to the NNRt module and then parsed by the NNRt module. + * + * @param offlineModels Array of offline model files. The sequence of array elements depends on the format of\n + * the input offline model. For details about the element types, see the definition of SharedBuffer {@link SharedBuffer}. + * @param config Configuration for loading the offline model files. For details, see {@link ModelConfig}. + * @param preparedModel Model object obtained. For details, see {@link IPreparedModel}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ PrepareOfflineModel([in] struct SharedBuffer[] offlineModels, [in] struct ModelConfig config, [out] IPreparedModel preparedModel); + + /** + * @brief Allocates the shared memory for the device. The shared memory allows quick access to the input\n + * and output data for AI inference. + * + * @param length Length of the shared memory to allocate, in bytes. + * @param buffer Information about the shared memory allocated, including the file descriptor and size.\n + * For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); + + /** + * @brief Releases the shared memory. + * + * @param buffer Information about the shared memory allocated, including the file descriptor and size.\n + * For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ ReleaseBuffer([in] struct SharedBuffer buffer); -} \ No newline at end of file +} + +/** @} */ diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl index 98643e38..dd379d1c 100644 --- a/nnrt/v2_1/IPreparedModel.idl +++ b/nnrt/v2_1/IPreparedModel.idl @@ -13,12 +13,87 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @file IPreparedModel.idl + * + * @brief Defines the APIs for AI model inference, obtaining the input tensor dimension range,\n + * and exporting the AI model built. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.1 + */ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; +/** + * @brief Provides the APIs for exporting AI models and performing AI model inference. + * + * @since 3.2 + * @version 2.1 + */ interface IPreparedModel { + /** + * @brief Exports an AI model from the cache. + * + * @param modelCache Array of the model files, which are in the same sequence as they exported.\n + *For details, see {@link SharedBuffer}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ ExportModelCache([out] struct SharedBuffer[] modelCache); + + /** + * @brief Obtains the tensor dimension range supported by AI model. If a fixed dimension is used,\n + *the maximum dimension value is the same as the minimum dimension value. + * + * @param minInputDims Two-dimensional array that stores the minimum dimension of the model input data.\n + *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * @param maxInputDims Two-dimensional array that stores the maximum dimension of the model input data.\n + *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); + + /** + * @brief Performs AI model inference. + * + * @param inputs Input data for AI model inference. The data is input in the sequence defined by the model.\n + *For details about the input data type, see {@link IOTensor}. + * @param outputs Output data of AI model inference. After inference, the output data is written to the\n + *shared buffer. For details about the output data type, see {@link IOTensor}. + * @param outputDims Dimensions of the output data. The output sequence is the same as that of outputs. + * @param isOutputBufferEnough Whether the shared buffer space is sufficient for the output data.\n + *The value true means the shared buffer space is sufficient; the value false means the opposite. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n + *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + */ Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); -} \ No newline at end of file +} + +/** @} */ diff --git a/nnrt/v2_1/ModelTypes.idl b/nnrt/v2_1/ModelTypes.idl index cb20b456..2e805b98 100644 --- a/nnrt/v2_1/ModelTypes.idl +++ b/nnrt/v2_1/ModelTypes.idl @@ -13,40 +13,169 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony.\n + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @file ModelTypes.idl + * + * @brief Defines AI model structures. + * + * In {@link PrepareModel}, the AI model is parsed and converted into the structure for inference.\n + * Then, model inference is performed in {@link Run}. The process is as follows. + * - 1. Write the functions for each operator in the {@link NodeAttrTypes.idl} file and associate\n + * each function with a {@link NodeType}. + * - 2. The subGraph parameter of {@link Model} is traversed to obtain the operator nodes\n + * contained in the subgraph, the input and output tensors of the operator, and the input and output tensors\n + * of the entire {@link Model} from nodeIndecies of the subgraph. + * - 3. The operator functions are located based on the nodeType parameter of {@link Node} to\n + * build the model structure for runtime. + * - 4. When the tensors input by the user are passed to the model, the NNRt module performs model inference\n + * and the outputs the model inference result. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.1 + */ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; +/** + * @brief Defines the tensor structure. + * + * @since 3.2 + * @version 2.1 + */ struct Tensor { + /** Tensor name. */ String name; + /** Tensor data type. For details, see {@link DataType}. */ enum DataType dataType; + /** Tensor dimensions. */ int[] dims; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** Structure used for passing the tensor data during process communication.\n + * For details, see {@link SharedBuffer}. + */ struct SharedBuffer data; + /** + * Array of quantization parameters of the tensor. For details, see {@link QuantParam}. + * If the length is 1, all axes share one quantization parameter. + * If the length is not 1, each quantization parameter in the array corresponds to an axis. + */ struct QuantParam[] quantParams; }; +/** + * @brief Defines the operator node structure. + * + * nodeAttr is a segment of serialized data. Specific parameters can be obtained only by using + * the deserialization interface of OpenHarmony HDI. + * The process is as follows: + * - Define the operator parameter structure OP op{}, where OP can be replaced with + * the operator parameter structure defined in {@link NodeAttrTypes.idl} and op is a variable name. + * - Declare `OHOS::MessageParcel data;`, that is, the MessageParcle object used to store deserialized data. + * - Use data.WriteBuffer (nodeAttr.data(),nodeAttr.size()); to write nodeAttr to data. + * - Use (void)OPBlockUnmarshalling(data, op); to deserialize data to the op structure.
+ * Then, you can view the parameter values of the operator in op. + * + * Example: + * If nodeType of an operator is NODE_TYPE_FULL_CONNECTION, the corresponding operator + * parameter structure is {@link FullConnection}. + * The operator has four parameters: hasBias, useAxis, axis, and activationType.
+ * The invoking process is as follows:
+ * FullConnection full_connection{};
+ * OHOS::MessageParcel data;
+ * data.WriteBuffer(nodeAttr.data(),nodeAttr.size());
+ * (void)FullConnectionBlockUnmarshalling(data, full_connection);
+ * Up to now, the four parameters are written into full_connection. + * + * @since 3.2 + * @version 2.1 + */ struct Node { + /** Operator node name. */ String name; + /** Operator node type. For details, see {@link NodeType}. */ enum NodeType nodeType; + /** + * Array of the serialized data corresponding to the operator node parameters. + */ byte[] nodeAttr; + /** Subscript of the input node of the operator node. */ unsigned int[] inputIndex; + /** Subscript of the output node of the operator node. */ unsigned int[] outputIndex; + /** Quantization parameter of the operator node. For details, see {@link QuantType}. */ enum QuantType quantType; }; +/** + * @brief Defines the subgraph structure. + * + * @since 3.2 + * @version 2.1 + */ struct SubGraph { + /** Subgraph name. */ String name; + /** Indices of the input subgraphs in subGraph of {@link Model}. */ unsigned int[] inputIndices; + /** Indices of the output subgraphs in subGraph of {@link Model}. */ unsigned int[] outputIndices; + /** Indices of the operator nodes related to the subgraph in the nodes array of {@link Model}. */ unsigned int[] nodeIndices; }; +/** + * @brief Defines the model structure. + * + * This structure stores all information required for model inference. Subgraph 0 of each model is the main subgraph.\n + * Generally, a model has only one subGraph. + * + * @since 3.2 + * @version 2.1 + */ struct Model { + /** Model name. */ String name; + /** + * Index of the input tensor of the model in allTensors. + */ unsigned int[] inputIndex; + /** + * Index of the output tensor of the model in allTensors. + */ unsigned int[] outputIndex; + /** + * Array of all operator nodes in the model. For details, see {@link Node}. + */ struct Node[] nodes; + /** + * Array of all tensors in the model. The array contains input tensors, output tensors, and constant tensors.\n + * For details, see {@link Tensor}. + */ struct Tensor[] allTensors; + /** + * Array of all subgraphs in the model. For details, see {@link SubGraph}. + */ struct SubGraph[] subGraph; -}; \ No newline at end of file +}; + +/** @} */ diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index cc28a7a0..dbc6d26c 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -13,282 +13,952 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @file NnrtTypes.idl + * + * @brief Defines the types used in the HDI methods. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.1 + */ package ohos.hdi.nnrt.v2_1; +/** + * @brief Defines the shared memory data structure. + * + * @since 3.2 + * @version 2.1 + */ struct SharedBuffer { + /** File descriptor of the shared memory. */ FileDescriptor fd; + /** Size of the shared memory, in bytes. */ unsigned int bufferSize; + /** Offset of the start address of the valid data in the shared memory. */ unsigned int offset; + /** Space occupied by the valid data, in bytes. */ unsigned int dataSize; }; +/** + * @brief Enumerates the AI chip types. + * + * @since 3.2 + * @version 2.1 + */ enum DeviceType: int { + /** Other types. */ OTHER, + /** CPU chip. */ CPU, + /** GPU chip. */ GPU, + /** AI acceleration chip, such as NPU chip and DSP chip. */ ACCELERATOR }; +/** + * @brief Enumerates the AI chip states. + * + * @since 3.2 + * @version 2.1 + */ enum DeviceStatus: int { + /** Available. */ AVAILABLE, + /** Busy. The chip in this state may not respond to computing tasks in a timely manner. */ BUSY, + /** Offline. The chip in this state cannot respond to computing tasks. */ OFFLINE, + /** Unknown state. */ UNKNOWN }; +/** + * @brief Enumerates the performance modes for a chip to perform AI computing. + * + * @since 3.2 + * @version 2.1 + */ enum PerformanceMode: int { + /** No performance mode is specified. The specific running mode is defined by the chip. */ PERFORMANCE_NONE, + /** Low-performance mode, which provides slow AI computing but low power consumption. */ PERFORMANCE_LOW, + /** Medium-performance mode, which provides moderate computing speed and power consumption. */ PERFORMANCE_MEDIUM, + /** High-performance mode, which provides fast AI computing but high power consumption. */ PERFORMANCE_HIGH, + /** Extreme-performance mode, which provides the fastest AI computing but highest power consumption. */ PERFORMANCE_EXTREME }; +/** + * @brief Enumerates the AI computing task priorities. + * + * @since 3.2 + * @version 2.1 + */ enum Priority: int { + /** No task priority is specified. The specific execution policy is defined by the chip. */ PRIORITY_NONE, + /** Low priority. A task with a higher priority will be executed first. */ PRIORITY_LOW, + /** Medium priority. A task with a higher priority will be executed first. */ PRIORITY_MEDIUM, + /** High priority. High-priority tasks are executed first. */ PRIORITY_HIGH }; +/** + * @brief Defines the parameters required for model building. + * + * @since 3.2 + * @version 2.1 + */ struct ModelConfig { + /** Whether to run a Float32 model in Float16 precision. */ boolean enableFloat16; + /** Performance mode of the computing task. For details, see {@link PerformanceMode}. */ enum PerformanceMode mode; + /** Priority of the computing task. For details, see {@link Priority}. */ enum Priority priority; + /** Custom attributes of the underlying hardware. They stored in the format of name:binary value + * and parsed by the HDI service. + */ Map extensions; }; +/** + * @brief Enumerates the operator data formats. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 2.1 + */ enum Format : byte { + /** Format initial value. */ FORMAT_NONE = -1, + /** NCHW, which indicates the number of data samples, image channels, image height, and image width in sequence. */ FORMAT_NCHW = 0, + /** NHWC. */ FORMAT_NHWC = 1 }; +/** + * @brief Defines the quantization parameter structure. + * + * In the following formula, q is a quantized parameter, r is a real parameter, \f$ r_{max} \f$\n + * is the maximum value of the data to be quantized, \f$ r_{min} \f$ is the minimum value of the data + * to be quantized, and round(x) means to round off x to an integer. + \f[ + \text{clamp}(x,min,max) = + \begin{cases} + \text{max} & \text{ if } x > \text{ max } \\ + \text{min} & \text{ if } x < \text{ min } \\ + x & \text{ otherwise } \\ + \end{cases} + \f] + * Formula for transforming a real number from a floating-point representation to a fixed-point representation: + \f[ + \text{q}(x_i) = clamp(round(\frac{r}{scale}+zeroPoint), min , max) + \f] + * Formula for transforming a real number from a fixed-point representation to a floating-point representation: + \f[ + \text{r}= (q-zeroPoint)*scale + \f] + * scale is calculated by using the following formula: + \f[ + scale = \frac{r_{max}-r_{min}}{q_{max}-q_{min}} + \f] + * zeroPoint is calculated by using the following formula: + \f[ + zeroPoint = round(q_{min}-\frac{r_{min}}{scale}) + \f] + * \f$ q_{min},q_{max} \f$ is calculated by using the following formula: + \f[ + q_{min} = -(1<<(numBits-1)) + \f] + \f[ + q_{max} = (1<<(numBits-1))-1 + \f] + * When \f$ r_{min} \f$ and \f$ r_{max} \f$ are 0, scale and zeroPoint must be 0. + * + * @since 3.2 + * @version 2.1 + */ struct QuantParam { + /** Number of quantized bits. */ int numBits; + /** Zero value. */ int zeroPoint; + /** Step of the quantizer. */ double scale; }; +/** + * @brief Enumerates the tensor data types. This parameter must be used together with {@link Tensor}. + * + * @since 3.2 + * @version 2.1 + */ enum DataType : byte { + /** Unknown type. */ DATA_TYPE_UNKNOWN = 0, + /** Boolean. */ DATA_TYPE_BOOL = 30, + /** INT8. */ DATA_TYPE_INT8 = 32, + /** INT16. */ DATA_TYPE_INT16 = 33, + /** INT32. */ DATA_TYPE_INT32 = 34, + /** INT64. */ DATA_TYPE_INT64 = 35, + /** UINT8. */ DATA_TYPE_UINT8 = 37, + /** UINT16. */ DATA_TYPE_UINT16 = 38, + /** UINT32. */ DATA_TYPE_UINT32 = 39, + /** UINT64. */ DATA_TYPE_UINT64 = 40, + /** FLOAT16. */ DATA_TYPE_FLOAT16 = 42, + /** FLOAT32. */ DATA_TYPE_FLOAT32 = 43, + /** FLOAT64. */ DATA_TYPE_FLOAT64 = 44, }; +/** + * @brief Defines the input and output tensors of an AI model. + * + * @since 3.2 + * @version 2.1 + */ struct IOTensor { + /** Tensor name. */ String name; + /** Data type of the tensor. For details, see {@link DataType}. */ enum DataType dataType; + /** Dimensions of the tensor. */ int[] dimensions; + /** Format of the tensor. For details, see {@link Format}. */ enum Format format; + /** Tensor data, which is stored in the shared memory. For details about the shared memory,\n + * see {@link SharedBuffer}. + */ struct SharedBuffer data; }; +/** + * @brief Enumerates the quantization types. This parameter must be used together with {@link Node}. + * + * @since 3.2 + * @version 2.1 + */ enum QuantType: byte { + /** Do not use quantification. */ QUANT_TYPE_NONE, + /** INT8 quantization. */ QUANT_TYPE_ALL, }; /** - * @brief Enumerates types of the extended stream information. + * @brief Enumerates the operator types. + * + * @since 3.2 + * @version 2.1 */ enum NodeType : unsigned int { + /** None. */ NODE_TYPE_NONE = 0, + /** Abs operator. */ NODE_TYPE_ABS = 1, + /** Activation function. */ NODE_TYPE_ACTIVATION = 2, + /** ADD operator. */ NODE_TYPE_ADD_FUSION = 5, + /** ArgMax operator. */ NODE_TYPE_ARGMAX_FUSION = 11, + /** AVGPOOL operator. */ NODE_TYPE_AVGPOOL_FUSION = 17, + /** BatchToSpaceND operator. */ NODE_TYPE_BATCH_TO_SPACE_ND = 22, + /** BiasAdd operator. */ NODE_TYPE_BIAS_ADD = 23, + /** BroadCastTo operator. */ NODE_TYPE_BROADCAST_TO = 27, + /** Cast operator. */ NODE_TYPE_CAST = 28, + /** Clip operator. */ NODE_TYPE_CLIP = 30, + /** Concat operator. */ NODE_TYPE_CONCAT = 31, + /** Conv2D operator, including common convolution, separable convolution, and group convolution. */ NODE_TYPE_CONV2D_FUSION = 35, + /** Two-dimensional deconvolution operator. */ NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, + /** ConstantOfShape operator. */ NODE_TYPE_CONSTANT_OF_SHAPE = 38, + /** DepthToSpace operator. */ NODE_TYPE_DEPTH_TO_SPACE = 45, + /** Div operator. */ NODE_TYPE_DIV_FUSION = 47, + /** Element-level operator. */ NODE_TYPE_ELTWISE = 52, + /** Equal operator. */ NODE_TYPE_EQUAL = 53, + /** Exp operator. */ NODE_TYPE_EXPFUSION = 55, + /** ExpandDims operator. */ NODE_TYPE_EXPAND_DIMS = 56, + /** Flatten operator. */ NODE_TYPE_FLATTEN = 61, + /** Fill operator. */ NODE_TYPE_FILL = 66, + /** FullConnection operator. */ NODE_TYPE_FULL_CONNECTION = 67, + /** BatchNorm operator. */ NODE_TYPE_FUSED_BATCH_NORM = 68, + /** Gather operator. */ NODE_TYPE_GATHER = 69, + /** Greater operator. */ NODE_TYPE_GREATER = 71, + /** GreaterEqual operator. */ NODE_TYPE_GREATER_EQUAL = 72, + /** InstanceNorm operator. */ NODE_TYPE_INSTANCE_NORM = 74, + /** LayerNorm operator. */ NODE_TYPE_LAYER_NORM_FUSION = 75, + /** LeakyReLU operator. */ NODE_TYPE_LEAKY_RELU = 76, + /** Less operator. */ NODE_TYPE_LESS = 77, + /** LessEqual operator. */ NODE_TYPE_LESS_EQUAL = 78, + /** LSTM operator. */ NODE_TYPE_LSTM = 87, + /** MatMul operator. */ NODE_TYPE_MATMUL_FUSION = 89, + /** Maximum operator. */ NODE_TYPE_MAXIMUM = 90, + /** MaxPool operator. */ NODE_TYPE_MAX_POOL_FUSION = 92, + /** Mul operator. */ NODE_TYPE_MUL_FUSION = 99, + /** NotEqual operator. */ NODE_TYPE_NOT_EQUAL = 103, + /** OneHot operator. */ NODE_TYPE_ONE_HOT = 105, + /** Pad operator. */ NODE_TYPE_PAD_FUSION = 107, + /** Pow operator. */ NODE_TYPE_POW_FUSION = 110, + /** PReLU operator. */ NODE_TYPE_PRELU_FUSION = 112, + /** QuantDTypeCast operator. */ NODE_TYPE_QUANT_DTYPE_CAST = 113, + /** Range operator. */ NODE_TYPE_RANGE = 115, + /** RealDiv operator. */ NODE_TYPE_REAL_DIV = 117, + /** Reduce operator. */ NODE_TYPE_REDUCE_FUSION = 118, + /** Reshape operator. */ NODE_TYPE_RESHAPE = 119, + /** Resize operator. */ NODE_TYPE_RESIZE = 120, + /** Rsqrt operator. */ NODE_TYPE_RSQRT = 126, + /** Scale operator. */ NODE_TYPE_SCALE_FUSION = 127, + /** Shape operator. */ NODE_TYPE_SHAPE = 130, + /** Slice operator. */ NODE_TYPE_SLICE_FUSION = 135, + /** Softmax operator. */ NODE_TYPE_SOFTMAX = 138, + /** SpaceToBatchND operator. */ NODE_TYPE_SPACE_TO_BATCH_ND = 141, + /** Split operator. */ NODE_TYPE_SPLIT = 145, + /** Sqrt operator. */ NODE_TYPE_SQRT = 146, + /** Squeeze operator. */ NODE_TYPE_SQUEEZE = 147, + /** Square operator. */ NODE_TYPE_SQUARE = 148, + /** SquaredDifference operator. */ NODE_TYPE_SQUARED_DIFFERENCE = 149, + /** Stack operator. */ NODE_TYPE_STACK = 150, + /** StridedSlice operator. */ NODE_TYPE_STRIDED_SLICE = 151, + /** Sub operator. */ NODE_TYPE_SUB_FUSION = 152, + /** Tile operator. */ NODE_TYPE_TILE_FUSION = 160, + /** TopK operator. */ NODE_TYPE_TOPK_FUSION = 161, + /** Transpose operator. */ NODE_TYPE_TRANSPOSE = 162, + /** Unsqueeze operator. */ NODE_TYPE_UNSQUEEZE = 165, + /** Unstack operator. */ NODE_TYPE_UNSTACK = 166, + /** Select operator. */ NODE_TYPE_SELECT = 170, + /** Ref operator. */ NODE_TYPE_ERF = 178, }; +/** + * @brief Enumerates the resize methods. It must be used together with the {@link Resize} operator. + * + * @since 3.2 + * @version 2.1 + */ enum ResizeMethod : byte { + /** Unknown. This is the default value. */ RESIZE_METHOD_UNKNOWN = -1, + /** Bilinear interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where\n + * \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2), Q_{21} = (x_2, y_1),\n + * and Q_{22} = (x_2, y_2) \f$. + * \f$f(Q_{11}), f(Q_{12}), f(Q_{21}), and f(Q_{22}) \f$ represent the values of the four points.\n + * The value of \f$ f(x,y) \f$ can be calculated by using the following formula: + \f[ + f(x,y_1) = \frac{x_2-x}{x_2-x_1}f(Q_{11})+\frac{x-x_1}{x_2-x_1}f(Q_{21}) + \f] + + \f[ + f(x,y_2) = \frac{x_2-x}{x_2-x_1}f(Q_{12})+\frac{x-x_1}{x_2-x_1}f(Q_{22}) + \f] + + \f[ + f(x,y) = \frac{y_2-y}{y_2-y_1}f(x,y_1)+\frac{y-y_1}{y_2-y_1}f(x,y_2) + \f] + */ RESIZE_METHOD_LINEAR = 0, + /** Nearest neighbor interpolation. + * For example, calculate the value of an unknown function f at point \f$ (x,y) \f$, where\n + * \f$ x_1< x < x_2, y_1< y < y_2 \f$. + * The values of the four coordinate points are \f$ Q_{11} = (x_1, y_1), Q_{12} = (x1, y2),\n + * Q_{21} = (x_2, y_1), and Q_{22} = (x_2, y_2) \f$. + * Then, the value of the point closest to the point \f$(x,y) \f$ is the value of \f$ f(x,y) \f$. + */ RESIZE_METHOD_NEAREST = 1, + /** Bicubic interpolation. + * Bicubic interpolation obtains the value of a sampling point by calculating the weighted average of the\n + * values of 16 points around the sampling point. This parameter must be used together with cubicCoeff\n + * and coordinateTransformMode of {@link Resize}. + * When coordinateTransformMode==COORDINATE_TRANSFORM_MODE_HALF_PIXEL, cubicCoeff is -0.5.\n + * In other cases, cubicCoeff is -0.75. The weight function of the interpolation is as follows: + \f[ + W(x) = + \begin{cases} + (cubicCoeff+2)|x|^3 - (cubicCoeff+3)|x|^2 +1 , &\text{if } |x| \leq 1; \cr + cubicCoeff|x|^3 - 5cubicCoeff|x|^2 + 8cubicCoeff|x| - 4a, &\text{if } 1 \lt |x| \leq 2; \cr + 0, &\text{otherwise.} + \end{cases} + \f] + */ RESIZE_METHOD_CUBIC = 2 }; +/** + * @brief Enumerates the coordinate transformation modes. Only the {@link Resize} operator uses this parameter. + * For example, the width coordinates are transformed, where: + * new_i is the ith coordinate of the resized tensor along the x axis. + * old_i is the coordinate of the input tensor along the x axis. + * newWidth is the length of the resized tensor along the x axis. + * oldWidth is the length of the input tensor along the x axis. + * old_i can be calculated by using the following formula: + * + * COORDINATE_TRANSFORM_MODE_ASYMMETRIC: \f$ old_i = newWidth != 0 ? new_i * oldWidth / newWidth : 0 \f$
+ * COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS: \f$ old_i = newWidth != 1 ? new_i * (oldWidth - 1) / (newWidth - 1) \f$
+ * COORDINATE_TRANSFORM_MODE_HALF_PIXEL: \f$ old_i = newWidth > 1 ? (new_x + 0.5) * oldWidth / newWidth - 0.5 : 0 \f$
+ * + * @since 3.2 + * @version 2.1 + */ enum CoordinateTransformMode : byte { + /** Scale based on the ratio without alignment. */ COORDINATE_TRANSFORM_MODE_ASYMMETRIC = 0, + /** Align the four corners of the image. */ COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS = 1, + /** Align with the pixel center. */ COORDINATE_TRANSFORM_MODE_HALF_PIXEL = 2 }; +/** + * @brief Enumerates the nearest neighbor interpolation types. It must be used together with the + * {@link Resize} operator. + * + * @since 3.2 + * @version 2.1 + */ enum NearestMode : byte { + /** Round off. */ NEAREST_MODE_NORMAL = 0, + /** Round toward negative infinity. For example, 23.5 is rounded to 23, and −23.5 is rounded to −24. */ NEAREST_MODE_ROUND_HALF_DOWN = 1, + /** Round toward positive infinity. For example, 23.5 is rounded to 24, and −23.5 is rounded to −23. */ NEAREST_MODE_ROUND_HALF_UP = 2, + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down + * to −24. + */ NEAREST_MODE_FLOOR = 3, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ NEAREST_MODE_CEIL = 4 }; +/** + * @brief Enumerates the activation function types. Activation functions introduce nonlinearity to neural networks.\n + * This allows the use of neural network models in nonlinear models. + * If an operator in the {@link NodeAttrTypes.idl} file has ActivationType parameters,\n + * the corresponding activation function will be called after the operator calculation is complete. + * + * @since 3.2 + * @version 2.1 + */ enum ActivationType : byte { + /** No activation function. */ ACTIVATION_TYPE_NO_ACTIVATION = 0, + /** + * ReLU activation function. + * ReLU calculates \f$ max(x_i, 0) \f$ element by element. It outputs the value directly if it is positive;\n + * otherwise, it outputs 0. + \f[ + \text{ReLU}(x_i) = (x_i)^+ = \max(x_i, 0), + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU = 1, + /** + * Sigmoid activation function. + * Execute the sigmoid activation function element-wise. + * The sigmoid function is defined as follows: + \f[ + \text{Sigmoid}(x_i) = \frac{1}{1 + \exp(-x_i)} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SIGMOID = 2, + /** + * ReLU6 activation function. + * ReLU6 is similar to ReLU. The difference is ReLU6 has an upper limit of 6. If the input is greater than 6,\n + * the output is limited to 6. + * The ReLU6 function is defined as follows: + \f[ + \text{ReLU6}(x_i) = \min(\max(0, x_i), 6) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU6 = 3, + /** + * Exponential Linear Unit (ELU) activation function. + * ELU calculates the ELU for each input element. + * The ELU function is defined as follows: + \f[ + ELU(x_{i}) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + \alpha * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter,\n + * which is set by {@link Activation}. + */ ACTIVATION_TYPE_ELU = 4, + /** + * LeakyReLU activation function. + * The LeakyReLU function is defined as follows: + \f[ + \text{LeakyReLU}(x_i) = + \begin{cases} + x_i, &\text{if } x_i \geq 0; \cr + {\alpha} * x_i, &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ indicates the input element, and \f$ \alpha \f$ indicates the alpha parameter,\n + * which is set by {@link Activation}. + */ ACTIVATION_TYPE_LEAKY_RELU = 5, + /** + * Activation function for calculating the absolute value. + * The function is defined as follows: + \f[ + \text{abs}(x_i) = |x_i| + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_ABS = 6, + /** + * ReLU1 activation function. + * The ReLU1 function is defined as follows: + \f[ + \text{ReLU1}(x_i)= \min(\max(0, x_i), 1) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_RELU1 = 7, + /** + * SoftSign activation function. + * The SoftSign function is defined as follows: + \f[ + \text{SoftSign}(x_i) = \frac{x_i}{1 + |x_i|} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SOFTSIGN = 8, + /** + * Softplus activation function. + * Softplus is a smooth approximation to ReLU. It can be used to constrain the output to always be positive. + * The Softplus function is defined as follows: + \f[ + \text{Softplus}(x_i) = \log(1 + \exp(x_i)) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_SOFTPLUS = 9, + /** + * Tanh activation function. + * The Tanh function is defined as follows: + \f[ + tanh(x) = \frac{\exp(x_i) - \exp(-x_i)}{\exp(x_i) + \exp(-x_i)} = \frac{\exp(2x_i) - 1}{\exp(2x_i) + 1} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_TANH = 10, + /** + * Scaled exponential Linear Unit (SELU) activation function. + * The SELU function is defined as follows: + \f[ + SELU(x_{i}) = + scale * + \begin{cases} + x_{i}, &\text{if } x_{i} \geq 0; \cr + \text{alpha} * (\exp(x_i) - 1), &\text{otherwise.} + \end{cases} + \f] + * \f$ x_i \f$ is the input element, and \f$ \alpha \f$ and \f$ scale \f$ are predefined\n + * constants (\f$ \alpha = 1.67326324 \f$, \f$ scale = 1.05070098 \f$). + */ ACTIVATION_TYPE_SELU = 11, + /** + * Hard Swish activation function. + * + \f[ + \text{Hardswish}(x_{i}) = x_{i} * \frac{ReLU6(x_{i} + 3)}{6} + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSWISH = 12, + /** + * Hard sigmoid activation function. + * The hard sigmoid function is defined as follows: + \f[ + \text{Hardsigmoid}(x_{i}) = max(0, min(1, \frac{x_{i} + 3}{6})) + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_HSIGMOID = 13, + /** + * ThresholdedReLU activation function. + * ThresholdedReLU is similar to ReLU. The ThresholdedReLU function is defined as follows: + \f[ + \text{ThresholdedReLU}(x_i) = \min(\max(0, x_i), t) + \f] + * \f$ x_i \f$ is the input element, and \f$ t \f$ is the maximum value. + */ ACTIVATION_TYPE_THRESHOLDRELU = 14, + /** + * Linear activation function. + * The Linear function is defined as follows: + \f[ + \text{Linear}(x_i) = x_i + \f] + * \f$ x_i \f$ is the input element. + */ ACTIVATION_TYPE_LINEAR = 15, + /** + * HardTanh activation function. + * The HardTanh function is defined as follows: + \f[ + \text{HardTanh}(x_i) = + \begin{cases} + \text{max_val} & \text{ if } x_i > \text{ max_val } \\ + \text{min_val} & \text{ if } x_i < \text{ min_val } \\ + x_i & \text{ otherwise } \\ + \end{cases} + \f] + * \f$ x_i \f$ is the input, \f$ max\_val \f$ is the maximum value, and \f$ min\_val \f$\n + * is the minimum value. The two parameters are set by {@link Activation}. + */ ACTIVATION_TYPE_HARD_TANH = 16, + /** + * Sign activation function. + * The Sign function is defined as follows: + \f[ + Sign(x_i) = \begin{cases} -1, &if\ x_i < 0 \cr + 0, &if\ x_i = 0 \cr + 1, &if\ x_i > 0\end{cases} + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SIGN = 17, + /** + * Swish activation function. + * The Swish function is defined as follows: + \f[ + \text{Swish}(x_i) = x_i * Sigmoid(x_i) + \f] + * \f$ x_i \f$ is the input. + */ ACTIVATION_TYPE_SWISH = 18, + /** + * Gaussian error linear unit (GELU) activation function. + * The GELU function is defined as follows: + \f[ + GELU(x_i) = x_i*P(X < x_i) + \f] + * \f$ x_i \f$ is the input element, and \f$ P \f$ is a cumulative distribution function of\n + * the standard Gaussian distribution. + * You need to use the approximate parameter of {@link Activation} to specify whether to use approximation. + */ ACTIVATION_TYPE_GELU = 19, + /** Unknown. */ ACTIVATION_TYPE_UNKNOWN = 20 }; +/** + * @brief Enumerates the modes for removing dimensions. It must be used together with the {@link ReduceFusion} operator. + * + * @since 3.2 + * @version 2.1 + */ enum ReduceMode : byte { + /** Use the average value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MEAN = 0, + /** Use the maximum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MAX = 1, + /** Use the minimum value of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_MIN = 2, + /** Use the product of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_PROD = 3, + /** Use the sum of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM = 4, + /** Use the sum of squares of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_SUM_SQUARE = 5, + /** Use the sum of absolute values of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ASUM = 6, + /** Use the logical AND of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ALL = 7 }; +/** + * @brief Enumerates the calculation types supported by elements. It must be used together with the\n + * {@link Eltwise} operator. + * + * @since 3.2 + * @version 2.1 + */ enum EltwiseMode : byte { + /** Product of the elements of two tensors */ ELTWISE_MODE_PROD = 0, + /** Difference between the elements of two tensors */ ELTWISE_MODE_SUM = 1, + /** Maximum value of the elements of two tensors */ ELTWISE_MODE_MAXIMUM = 2, + /** Unknown type. */ ELTWISE_MODE_UNKNOWN = 3 }; +/** + * @brief Enumerates the padding types. It must be used together with {@link AvgPoolFusion}, {@link AvgPoolFusion},\n + * {@link Conv2DFusion}, and {@link MaxPoolFusion}. + * + * @since 3.2 + * @version 2.1 + */ enum PadMode : byte { + /** + * Adds 0s in the input height and width directions. + * If this mode is used, the padding parameter of the operator must be greater than or equal to 0. + */ PAD_MODE_PAD = 0, + /** + * The output height and width are obtained by dividing the input height and width by a stride and rounding off\n + * the quotient to an integer. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_SAME = 1, + /** + * Return the output of a valid calculation without padding. Pixels that do not meet the calculation requirements\n + * will be discarded. + * If this mode is used, the padding parameter of the operator must be 0. + */ PAD_MODE_VALID = 2, }; +/** + * @brief Enumerates the algorithms for rounding off decimals. It must be used together with the\n + * {@link AvgPoolFusion} operator. + * + * @since 3.2 + * @version 2.1 + */ enum RoundMode : byte { + /** Round down to the nearest integer. For example, 23.5 is rounded down to 23, and −23.5 is rounded down to −24. */ ROUND_MODE_FLOOR = 0, + /** Round up to the nearest integer. For example, 23.5 is rounded up to 24, and −23.5 is rounded up to −23. */ ROUND_MODE_CEIL = 1 }; +/** + * @brief Enumerates the padding modes. It must be used together with the {@link PadFusion} operator. + * + * When x is \f$[[1,2,3],[4,5,6],[7,8,9]]\f$ and paddingsis \f$[[2,2], [2,2]] \f$,\n + * the effect is as follows:
+ * If paddingMode==PADDING_MODE_CONSTANT and constantValue = 0, the output is as follows: + * + \f$[[0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 1. 2. 3. 0. 0.],\\ + [0. 0. 4. 5. 6. 0. 0.],\\ + [0. 0. 7. 8. 9. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.],\\ + [0. 0. 0. 0. 0. 0. 0.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_REFLECT, the output is as follows: + * + \f$[[9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [9. 8. 7. 8. 9. 8. 7.],\\ + [6. 5. 4. 5. 6. 5. 4.],\\ + [3. 2. 1. 2. 3. 2. 1.]]\\ \f$ + * + * If paddingMode==PADDING_MODE_SYMMETRIC, the output is as follows: + * + \f$[[5. 4. 4. 5. 6. 6. 5.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [2. 1. 1. 2. 3. 3. 2.],\\ + [5. 4. 4. 5. 6. 6. 5.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [8. 7. 7. 8. 9. 9. 8.],\\ + [5. 4. 4. 5. 6. 6. 5.]]\\ \f$ + * + * @since 3.2 + * @version 2.1 + */ enum PaddingMode : byte { + /** Constant (0 by default) padding. */ PADDING_MODE_CONSTANT = 0, + /** Reflection padding, which uses the content next to the input data to pad the values directly next to it. */ PADDING_MODE_REFLECT = 1, + /** Symmetric padding, which is similar to {@link PADDING_MODE_REFLECT}. Symmetric padding makes a copy of the input. */ PADDING_MODE_SYMMETRIC = 2, + /** Reserved. */ PADDING_MODE_RESERVED = 3 }; +/** + * @brief Dedicated error codes defined by NNRt. They are used as the return values of HDIs. + * + * @since 4.0 + * @version 2.1 + */ enum NNRT_ReturnCode : unsigned int { + /** Success. */ NNRT_SUCCESS = 0, + /** Failed. */ NNRT_FAILED = 1, + /** Null pointer. */ NNRT_NULL_PTR = 2, + /** Invalid parameter. */ NNRT_INVALID_PARAMETER = 3, + /** Memory error. */ NNRT_MEMORY_ERROR = 4, + /** Insufficient memory. */ NNRT_OUT_OF_MEMORY = 5, + /** Forbidden operation. */ NNRT_OPERATION_FORBIDDEN = 6, + /** Invalid file. */ NNRT_INVALID_FILE = 7, + /** Invalid path. */ NNRT_INVALID_PATH = 8, + /** Insufficient cache. */ NNRT_INSUFFICIENT_BUFFER = 9, + /** No change. */ NNRT_NO_CHANGE = 10, + /** Not supported. */ NNRT_NOT_SUPPORT = 11, + /** Service error. */ NNRT_SERVICE_ERROR = 12, + /** Device error. */ NNRT_DEVICE_ERROR = 13, + /** Device busy. */ NNRT_DEVICE_BUSY = 14, + /** Operation canceled. */ NNRT_CANCELLED = 15, + /** Access denied. */ NNRT_PERMISSION_DENIED = 16, + /** Timeout. */ NNRT_TIME_OUT = 17, + /** Invalid tensor. */ NNRT_INVALID_TENSOR = 18, + /** Invalid node. */ NNRT_INVALID_NODE = 19, + /** Invalid input. */ NNRT_INVALID_INPUT = 20, + /** Invalid output. */ NNRT_INVALID_OUTPUT = 21, + /** Invalid data type. */ NNRT_INVALID_DATATYPE = 22, + /** Invalid data layout. */ NNRT_INVALID_FORMAT = 23, + /** Invalid tensor name. */ NNRT_INVALID_TENSOR_NAME = 24, + /** Invalid shape. */ NNRT_INVALID_SHAPE = 25, + /** Dimension range exceeded. */ NNRT_OUT_OF_DIMENTION_RANGES = 26, + /** Invalid cache. */ NNRT_INVALID_BUFFER = 27, + /** Invalid cache size. */ NNRT_INVALID_BUFFER_SIZE = 28, + /** Invalid performance mode. */ NNRT_INVALID_PERFORMANCE_MODE = 29, + /** Invalid priority. */ NNRT_INVALID_PRIORITY = 30, + /** Invalid model. */ NNRT_INVALID_MODEL = 31, + /** Invalid model cache. */ NNRT_INVALID_MODEL_CACHE = 32, + /** Operator not supported. */ NNRT_UNSUPPORTED_OP = 33 -}; \ No newline at end of file +}; +/** @} */ diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 9269731b..1b7a3b36 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -13,417 +13,2043 @@ * limitations under the License. */ +/** + * @addtogroup NNRt + * @{ + * + * @brief Provides a unified interface for AI chip drivers to access OpenHarmony. + * Neural Network Runtime (NNRt) is a cross-chip inference computing runtime environment oriented to the AI field. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @file NodeAttrTypes.idl + * + * @brief Defines the parameters and functionality of AI model operators. + * + * All structures in this file declare only operator attributes and do not contain the interfaces for executing\n + * operator functions. + * - 1. The operators in the file are in one-to-one correspondence with a {@link NodeType}. In model inference,\n + * {@link NodeType} is stored in nodeType of {@link Node}. + * - 2. Each operator has at least one input and one output. The input is the tensor received by the operator,\n + * and the output is the tensor produced after the operator operation. The relationship between the input, operator,\n + * and output is determined by inputIndex and outIndex of the {@link Node} structure. + * + * @since 3.2 + * @version 2.1 + */ + +/** + * @brief Defines the package path of the NNRt module. + * + * @since 3.2 + * @version 2.1 + */ package ohos.hdi.nnrt.v2_1; import ohos.hdi.nnrt.v2_1.NnrtTypes; +/** + * @brief Obtains the absolute value of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_ABS. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * The absolute value of the input tensor. + * + * @since 5.0 + * @version 2.1 + */ struct Abs { }; +/** + * @brief Defines the operator of the activation type. All activation functions belong to this operator.\n + * The specific activation function type is determined by the parameters. + * + * The {@link NodeType} of this operator is NODE_TYPE_ACTIVATION. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * A tensor returned after the activation function is executed. + * + * @since 3.2 + * @version 2.1 + */ struct Activation { +/** Activation function type. */ enum ActivationType activationType; +/** Size factor, used for the LeakyReLU and ELU activation functions. */ float alpha; +/** Minimum value, used for the HardTanh activation function. */ float minVal; +/** Maximum value, used for the HardTanh activation function. */ float maxVal; +/** Whether to use the approximation algorithm. It is used for the GRLU activation function. */ boolean approximate; }; +/** + * @brief Adds tensors. The output shape is the same as the input one after broadcasting, and the data type\n + * is the one with higher precision of the two inputs. + * + * The {@link NodeType} of this operator is NODE_TYPE_ADD_FUSION. + * + * Input: + * + * * x, the first input tensor. + * * y, the second input tensor. The data type must be the same as that of the first tensor. + * + * * Output: + * + * * Sum of the elements of x and y. The data shape is the same as the one after broadcasting,\n + * and the data type is the one with higher precision of the two inputs. + * If activationType is configured, the specified activation function will be called before + * the output is returned. + * + * @since 3.2 + * @version 2.1 + */ struct AddFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Obtains the first K indices or values of a cross-axis tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_ARGMAX_FUSION. + * + * Input: + * + * * x, a tensor of shape (N,*), where * indicates any number of additional dimensions. + * + * Output: + * + * * First K indices or values before the maximum input tensor on the axis. + * + * @since 3.2 + * @version 2.1 + */ struct ArgMaxFusion { + /** Target axis where the maximum indices or values are obtained. */ long axis; + /** First K maximum values on the axis. */ long topK; + /** Whether to keep the output dimensions the same as the input dimensions. */ boolean keepDims; + /** Return the index if the value is false. Return the value if the value is true.\n + * The default value is false. + */ boolean outMaxValue; }; +/** + * @brief Applies a 2D average pooling on the input tensor. The int8 quantization input is supported. + * + * The {@link NodeType} of this operator is NODE_TYPE_AVGPOOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor after average pooling. + * + * @since 3.2 + * @version 2.1 + */ struct AvgPoolFusion { + /** + * Kernel size used to obtain the average value. It is an int array in the format of [kernel_height, kernel_weight]\n + * with length of 2. + * The first number indicates the kernel height, and the second number indicates the kernel width. + */ long[] kernelSize; + /** + * Distance of kernel moving. The value is an int array [stride_height, stride_weight] with length of 2.\n + * The first number indicates the moving size in height, and the second number indicates the moving size in width. + */ long[] strides; + /** x is padded with an int array [top, bottom, left, right] with length of 4, and the nearest neighbor values\n + * are used for padding. + */ long[] pad; + /** Padding method. */ enum PadMode padMode; + /** Numerical operation mode of the output tensor. */ enum RoundMode roundMode; + /** Format of the data during calculation. For details, see {@link Format}. */ enum Format format; + /** Whether to do global pooling. */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks\n + * back into the spatial dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_BATCH_TO_SPACE_ND. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Output tensor. Assume that the shape of x is (n,h,w,c) and the shape of output is (n',h',w',c'): + * \f$ n' = n / (block_shape[0] * block_shape[1])\f$
+ * \f$ h' = h * block_shape[0] - crops[0][0] - crops[0][1] \f$
+ * \f$ w' = w * block_shape[1] - crops[1][0] - crops[1][1] \f$
+ * \f$ c'= c \f$ + * + * @since 3.2 + * @version 2.1 + */ struct BatchToSpaceND { + /** Block size, which is an array [height_block, weight_block] with length of 2. */ long[] blockShape; + /** + * Crop values for the spatial dimension. + * It is a 2D array [crop0_start, crop0_end], [crop1_start, crop1_end] with the shape of (2, 2). + */ long[][] crops; }; +/** + * @brief Offsets the data in each dimension of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_BIAS_ADD. + * + * Input: + * + * * x, an n-dimensional tensor. + * * bias, the bias tensor. + * + * Output: + * + * * Output tensor, which is the sum of the input tensor and the bias in each dimension. + * + * @since 3.2 + * @version 2.1 + */ struct BiasAdd { }; +/** + * @brief Broadcast a tensor for a compatiable shape. + * + * The {@link NodeType} of this operator is NODE_TYPE_BROADCAST_TO. + * + * Input: + * + * * x, an n-dimensional tensor to broadcast. + * + * Output: + * + * * Output tensor after broadcasted. + * + * @since 5.0 + * @version 2.1 + */ struct BroadcastTo { + /** An 1-dimensional Tensor, the shape of the desired output. */ long[] shape; }; +/** + * @brief Converts the tensor data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_CAST. + * + * Input: + * + * * x, an n-dimensional tensor. + * * type, the target type of the data. + * + * Output: + * + * * A tensor with the specified data type. + * + * @since 3.2 + * @version 2.1 + */ struct Cast { }; +/** + * @brief Returns a tensor of the same type and shape as input tensor with its value clipped to min and max. + * Any values less than min are set to min. Any values greater than max are set to max. + * + * The {@link NodeType} of this operator is NODE_TYPE_CLIP. + * + * Input: + * + * * x, an n-dimensional tensor to clip. + * + * Output: + * + * * Output tensor after clipped. + * + * @since 5.0 + * @version 2.1 + */ struct Clip { + /** Maximum value, above which element is replaced by max. It must be a scalar(tensor of empty shape). */ float max; + /** Minimum value, under which element is replaced by min. It must be a scalar(tensor of empty shape). */ float min; }; +/** + * @brief Connects tensors in the specified axis or connects input tensors along with the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONCAT. + * + * Input: + * + * * Tensors with the same dimension. + * + * Output: + * + * * Result of the tensors connected. + * + * @since 3.2 + * @version 2.1 + */ struct Concat { + /** Axis specified. The value must be less than the number of dimensions of the input tensor. */ long axis; }; +/** + * @brief Calculates the 2D convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0. + * In other cases, padding must be 0. + * + * Input: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with a length of [outChannel].\n + * In the quantization scenario, bias does not need to be quantized. + * If quantization is required, the input data must be of the int32 type. + * The actual quantization parameter is determined by x and weight. + * + * Output: + * + * * Convolution output. + * + * @since 3.2 + * @version 2.1 + */ struct Conv2DFusion { + /** Size (height and width) of the convolution kernel. */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight.\n + * It is an int array [strideHeight, strideWidth] with length of 2. + */ long[] stride; + /** + * Dilation size of the convolution kernel in height and weight. It is an int array in the format of\n + * [dilationHeight, dilationWidth]. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around x in the height and width directions. It is an int array [top, bottom, left, right]\n + * with length of 4. + */ long[] padList; + /** + * Splits x into groups by inChannel. The group value is of the int type. + * If group is 1, it is a conventional convolution. + * If group is inChannel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. + * If group is greater than 1 and less than inChannel, it is group convolution.\n + * In this case, out_channel==group. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates a 2D transposed convolution on a 4D tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONV2D_TRANSPOSE_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, a 4D tensor in NHWC format. + * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. + * * The value of inChannel divided by groupmust be an integer. + * * bias: bias of the convolution. It is an array with a length of [outChannel].\n + * * In the quantization scenario, bias does not need to be quantized. + * * If quantization is required, the input data must be of the int32 type. + * * The actual quantization parameter is determined by x and weight. + * + * Output: + * + * * An n-dimensional tensor. + * + * @since 3.2 + * @version 2.1 + */ struct Conv2dTransposeFusion { + /** Size (height and width) of the convolution kernel. */ long[] kernelSize; + /** Movement stride of the convolution kernel in height and weight. It is an int array [strideHeight, strideWidth]\n + * with length of 2. + */ long[] stride; + /** Dilation size of the convolution kernel in height and weight. It is an int array [dilationHeight, dilationWidth]\n + * with length of 2. + * The value must be greater than or equal to 1 and cannot exceed the height and width of x. + */ long[] dilation; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Padding around the input x in the height and width directions. It is an int array [top, bottom, left, right]\n + * with length of 4. */ long[] padList; + /** + * Splits x into groups by inChannel. + * If group is 1, it is a conventional convolution. + * If group is greater than 1 and less than or equal to inChannel, this is a group convolution. + */ long group; + /** Number of input channels. */ long inChannel; + /** Number of output channels. */ long outChannel; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; + /** + * A list of integer array with two elements, specifying the paddings along the height and width of the output tensor. + */ long[] outputPaddings; }; +/** + * @brief Generate a tensor with given value and shape. + * + * The {@link NodeType} of this operator is NODE_TYPE_CONSTANT_OF_SHAPE. + * + * Input: + * + * * x, an 1-dimensional tensor, indicates the shape of the expected output tensor. + * * If empty tensor is given, the output would be a scalar. All values must be >= 0. + * + * Output: + * + * * Output tensor of shape specified by x. + * + * @since 5.0 + * @version 2.1 + */ struct ConstantOfShape { + /** The data type of output elements. */ long data_type; + /** The value of the output elements. Should be a one-element tensor. */ float[] value; }; +/** + * @brief DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. + * This is the reverse transformation of SpaceToDepth. More specifically, this op outputsa copy of the input tensor\n + * where values from the depth dimension are moved in spatial blocks to the height and width dimensions. + * By default, mode = DCR. In the DCR mode, elements along the depth dimension from the input tensor are rearranged\n + * in the following order: depth, column, and then row. + * + * The {@link NodeType} of this operator is NODE_TYPE_DEPTH_TO_SPACE. + * + * Input: + * + * * x, input tensor of 4-dimensional, with specific format of NHWC or NCHW. + * * where N is the batch axis, H is the height, W is the width and C is the channel or depth. + * + * Output: + * + * * Output tensor of [N, H * blocksize, W * blocksize, C/(blocksize * blocksize)] for NHWC format\n + * * or [N, C/(blocksize * blocksize), H * blocksize, W * blocksize] for NCHW format. + * + * @since 5.0 + * @version 2.1 + */ struct DepthToSpace { + /** Blocks of [blocksize, blocksize] are moved. */ long block_size; + /** Format of input tensor, default NCHW. */ enum Format format; + /** DCR (default) for depth-column-row order re-arrangement. Use CRD for column-row-depth order. */ String mode; }; +/** + * @brief Divides the first tensor by the second tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_DIV_FUSION. + * + * Input: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Output: + * + * * Quotient of the two inputs. + * + * @since 3.2 + * @version 2.1 + */ struct DivFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs an element-wise operation. + * + * The {@link NodeType} of this operator is NODE_TYPE_ELTWISE. + * + * Input: + * + * * x1, the first input tensor. + * * x2, the second input tensor. + * + * Output: + * + * * A tensor with the same data type and shape as x1. + * + * @since 3.2 + * @version 2.1 + */ struct Eltwise { + /** Element-wise operation type. For details, see {@link EltwiseMode}. */ enum EltwiseMode mode; }; +/** + * @brief Returns the tensor resulted from performing the equal logical operation elementwise\n + * on the input tensors x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_EQUAL. + * + * Input: + * + * * x1, the first input operand. + * * x2, the second input operand. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct Equal { }; +/** + * @brief Calculates the exponential of the given input tensor, element-wise. + * ExpFusion computes outputs y = base ^ (shift + scale * x), for base > 0. + * Or if base is set to the default (-1), base is set to e, + * so y = exp(shift + scale * x). + * + * The {@link NodeType} of this operator is NODE_TYPE_EXPFUSION. + * + * Input: + * + * * x, input tensor. + * + * Output: + * + * * The exponential of the input tensor computed element-wise. + * + * @since 5.0 + * @version 2.1 + */ struct ExpFusion { + /** base of exponential function, default -1 for a value of e, must be > 0 */ float base; + /** amplifcation factor of independent value, default 1 */ float scale; + /** offset of independent value, default 1 */ float shift; }; +/** + * @brief Adds an additional dimension to a tensor at the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_EXPAND_DIMS. + * + * Input: + * + * * x, an n-dimensional tensor. + * * axis: index of the dimension to be added. The value is of the int32_t type and must be a constant\n + * in the range [-dim-1, dim]. + * + * Output: + * + * * Operator with an additional dimension at the given axis. + * + * @since 3.2 + * @version 2.1 + */ struct ExpandDims { }; +/** + * @brief Flattens the input tensor into a 2D matrix. If input tensor has shape (d_0, d_1, … d_n), + * then the output will have shape (d_0 X d_1 … d_(axis-1), d_axis X d_(axis+1) … X dn). + * + * The {@link NodeType} of this operator is NODE_TYPE_FLATTEN. + * + * Input: + * + * * x: A tensor of rank >= axis. + * Output: + * + * * A 2D tensor with the contents of the input tensor, with input dimensions up to axis flattened to\n + * * the outer dimension of the output and remaining input dimensions flattened into the inner dimension of the output. + * + * @since 5.0 + * @version 2.1 + */ struct Flatten { + /** Indicate up to which input dimensions (exclusive) should be flattened to the outer dimension of the output. + * The value for axis must be in the range [-r, r], where r is the rank of the input tensor. + * Negative value means counting dimensions from the back. When axis = 0, the shape of the output tensor is\n + * (1, (d_0 X d_1 … d_n)), where the shape of the input tensor is (d_0, d_1, … d_n). */ long axis; }; +/** + * @brief Creates a tensor of the specified dimensions and fills it with a scalar. + * + * The {@link NodeType} of this operator is NODE_TYPE_FILL. + * + * Input: + * + * * value: scalar used to fill the tensor. + * * shape, which specifies the dimensions of the tensor to create. + * Output: + * + * * Tensor filled by the scaler. + * + * @since 3.2 + * @version 2.1 + */ struct Fill { }; +/** + * @brief Applies full connection for the input data. + * + * The {@link NodeType} of this operator is NODE_TYPE_FULL_CONNECTION. + * + * When useAxis is true, axis must be set. When useAxis is false,\n + * axis is 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * * weight: weight tensor for a full connection. + * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required.\n + * * If quantization is required, the data must be of the int32 type. The actual quantization parameter is\n + * * determined by x and weight. + * * + * Output: + * + * * output: computed tensor. + * + * @since 3.2 + * @version 2.1 + */ struct FullConnection { + /** Whether to use the bias. */ boolean hasBias; + /** Whether to use the axis. */ boolean useAxis; + /** Axis specified for the full connection. The specified axis and its following axes are converted into\n + * a 1D tensor and then apply the full connection. + */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Performs batch normalization for a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_FUSED_BATCH_NORM. + * + * Input: + * + * * x: a tensor of shape [N, ..., C], that is, the nth dimension is the number of channels. + * * scale: 1D tensor of the scaling factor used to scale the first normalized tensor. + * * offset: 1D tensor used to move to the first normalized tensor. + * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training,\n + * * this parameter must be left empty. + * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training,\n + * * this parameter must be left empty. + * + * Output: + * + * * output: computed tensor. + * + * @since 3.2 + * @version 2.1 + */ struct FusedBatchNorm { + /** A small value close to zero. It is used to ensure that the divisor is not 0. */ float epsilon; }; +/** + * @brief Returns the slice of the input tensor based on the specified index and axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_GATHER. + * + * Input: + * + * * x, an n-dimensional tensor. + * * inputIndices, indices of elements of the original tensor. The value is an array of the int type\n + * * and must be in the range [0, x.shape[axis]). + * * axis, the axis on which x is sliced. The value is an array with one element of the int32_t type. + * + * Output: + * + * * Sliced tensor. + * + * @since 3.2 + * @version 2.1 + */ struct Gather { }; +/** + * @brief Returns the tensor resulted from performing the greater logical operation elementwise\n + * on the input tensors x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_GREATER. + * + * Input: + * + * * x1, the first input operand. + * * x2, the second input operand. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct Greater { }; +/** + * @brief Returns the tensor resulted from performing the greater_equal logical operation elementwise\n + * on the input tensors x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_GREATER_EQUAL. + * + * Input: + * + * * x1, the first input operand. + * * x2, the second input operand. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct GreaterEqual { }; +/** + * @brief Carries out instance normalization as formula y = scale * (x - mean) / sqrt(variance + epsilon) + B, + * where mean and variance are computed per instance per channel. + * + * The {@link NodeType} of this operator is NODE_TYPE_INSTANCE_NORM. + * + * Input: + * + * * x, input data tensor from the previous operator; + * * dimensions for image case are (N x C x H x W), where N is the batch size, + * * C is the number of channels, and H and W are the height and the width of the data. + * * For non image case, the dimensions are in the form of (N x C x D1 x D2 … Dn), where N is the batch size. + * * The input 1-dimensional scale tensor of size C. + * * The input 1-dimensional bias tensor of size C. + * + * Output: + * + * * The output tensor of the same shape as input. + * + * @since 5.0 + * @version 2.1 + */ struct InstanceNorm { + /** The epsilon value to use to avoid division by zero. */ float epsilon; }; +/** + * @brief Applies layer normalization for a tensor from the specified axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_LAYER_NORM_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * gamma, an m-dimensional tensor. The dimensions of gamma must be the same as the shape of the part\n + * * of the input tensor to normalize. + * * beta, an m-dimensional tensor with the same shape as gamma. + * + * Output: + * + * * An n-dimensional tensor, with the same data type and shape as the input tensor. + * + * @since 3.2 + * @version 2.1 + */ struct LayerNormFusion { + /** Start axis of x to apply layer normalization. */ long beginNormAxis; + /** A value added to the denominator for numerical stability. */ float epsilon; + /** Whether to perform an element-wise operation. */ boolean elementwiseAffine; + /** Start axis of the parameter input (gamma, beta) to apply layer normalization.\n + * The value must be in the range [-n, n). + */ long beginParamsAxis; }; +/** + * @brief LeakyRelu takes input data (Tensor) and an argument alpha, and produces one output data (Tensor)\n + * where the function f(x) = alpha * x for x < 0, f(x) = x for x >= 0, is applied to the data tensor elementwise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LEAKY_RELU. + * + * Input: + * + * * x, input tensor. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct LeakyRelu { + /** Coefficient of leakage. */ float negative_slope; }; +/** + * @brief Returns the tensor resulted from performing the less logical operation elementwise\n + * on the input tensors x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_LESS. + * + * Input: + * + * * x1, the first input operand. + * * x2, the second input operand. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct Less { }; +/** + * @brief Calculates the result of x1 <= x2 element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LESS_EQUAL. + * + * Input: + * + * * x1, which can be a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * x2, which can be a number or a Boolean value if x1 is a tensor; or a tensor with the data type\n + * * of number or Boolean if x1 is not a tensor. + * + * Output: + * + * * A tensor with the data type of Boolean. When a quantization model is used, the quantization parameters of\n + * * the output cannot be omitted. However, values of the quantization parameters do not affect the result. + * + * @since 3.2 + * @version 2.1 + */ struct LessEqual { }; +/** + * @brief Computes an one-layer LSTM. This operator is usually supported via some custom implementation. + * + * The {@link NodeType} of this operator is NODE_TYPE_LSTM. + * + * Input: + * + * * input, input tensor, shape is [seq_len, batch_size, input_size]. + * * weight_ih, weight tensor of input-layer to hidden-layer, + * * shape is [num_directions* num_layers, 4 * hidden_size, input_size]. + * * weight_hh, weight tensor of hidden-layer to hidden-layer, + * * shape is [num_directions* num_layers, 4 * hidden_size, hidden_size]. + * * bias, bias tensor of input-layer and hidden-layer to hidden-layer, + * * shape is [num_directions* num_layers, 8 * hidden_size]. + * * hidden_state, init state of hidden-layer, shape is [num_directions * num_layers, batch_size, hidden_size]. + * * cell_state, init state of cell, shape is [num_directions * num_layers, batch_size, hidden_size]. + * + * Output: + * + * * output, a tensor that concats all the intermediate output tensor of the hidden, + * * shape is [seq_len, batch_size, num_directions * real_hidden_size]. + * * hidden_state, the last output tensor of the hidden-layer, + * * shape is [num_directions * num_layers, batch_size, real_hidden_size]. + * * cell_state, the last output tensor of the cell, + * * shape is [num_directions * num_layers, batch_size, hidden_size]. + * + * @since 5.0 + * @version 2.1 + */ struct LSTM { + /** Whether the LSTM operation is bidirectional. */ boolean bidirectional; + /** Whether the operation contains bias. */ boolean has_bias; + /** Size of input tensor. */ long input_size; + /** Size of hidden state tensor. */ long hidden_size; + /** Layers of LSTM network. */ long num_layers; + /** Number of directions, value is 2 if direction == bidirectional else 1. */ long num_directions; + /** Dropout probalility of each layer except first-layer. */ float dropout; + /** Probalility that the cell state retains the previous state. Default: 0. */ float zoneout_cell; + /** Probalility that the hidden state retains the previous state. Default: 0. */ float zoneout_hidden; + /** If proj_size > 0, will use LSTM with projections of corresponding size. Default: 0. */ long proj_size; }; +/** + * @brief Calculates the matrix product of x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_MATMUL_FUSION. + * + * Input: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Output: + * + * * Matrix product of the inputs. When type! When = DATA_TYPE_UNKNOWN, the data type of the output is determined by\n + * * type. When type==DATA_TYPE_UNKNOWN, + * * the data type of the output depends on the data type converted during the calculation of x1 and x2. + * + * @since 3.2 + * @version 2.1 + */ struct MatMulFusion { + /** Whether to transpose the x1 matrix. */ boolean transposeA; + /** Whether to transpose the x2 matrix. */ boolean transposeB; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Calculates the maximum of x1 and x2 element-wise. The inputs of x1 and x2\n + * comply with the implicit type conversion rules to make the data types are consistent. + * + * The input must be two tensors or one tensor and one scalar. When the input is two tensors, the data types\n + * cannot be Boolean at the same time, and their shapes can be broadcast to the same size. When the inputs are\n + * one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAXIMUM. + * + * Input: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Output: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 2.1 + */ struct Maximum { }; +/** + * @brief Applies a 2D maximum pooling over an input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_MAX_POOL_FUSION. + * + * When padMode==PAD_MODE_PAD, padList must be greater than or equal to 0.\n + * In other cases, padding must be 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + /** Maximum value of the elements of the two tensors. + * + * @since 3.2 + * @version 2.1 + */ struct MaxPoolFusion { + /** Size of the kernel used to take the maximum value. It is an int array [kernel_height, kernel_weight]\n + * with length of 2. + */ long[] kernelSize; + /** Distance of kernel moving. It is an int array with two elements. */ long[] strides; + /** Array to pad. */ long[] pad; + /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; + /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; + /** RoundMode mode. For details, see {@link RoundMode}. */ enum RoundMode roundMode; + /** Whether to do global pooling. */ boolean global; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Multiplies the elements in the same position of x1 and x2 to obtain output. + * + * If the shapes of x1 and x2 are different, expand x1 and x2 to the same shape through\n + * broadcast and then perform the multiplication. + * The {@link NodeType} of this operator is NODE_TYPE_MUL_FUSION. + * + * Input: + * + * * x1, a tensor of the int or float type. + * * x2, a tensor of the int or float type. + * + * Output: + * + * * Product of each element of x1 and x2. + * + * @since 3.2 + * @version 2.1 + */ struct MulFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Returns the tensor resulted from performing the not_equal logical operation elementwise\n + * on the input tensors x1 and x2. + * + * The {@link NodeType} of this operator is NODE_TYPE_NOT_EQUAL. + * + * Input: + * + * * x1, the first input operand. + * * x2, the second input operand. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ struct NotEqual { }; +/** + * @brief Generates a one-hot tensor based on the specified locations. + * + * The locations specified by indices are determined by on_value, and other locations are determined\n + * by off_value. + * + * The {@link NodeType} of this operator is NODE_TYPE_ONE_HOT. + * + * Input: + * + * * indices, an n-dimensional tensor. Each element in indices determines the location of on_value\n + * * in each one-hot vector. + * * depth, an integer scalar that determines the depth of the one-hot vector. The value of depth must be\n + * * greater than 0. + * * on_value, a scalar that specifies a valid value in the one-hot vector. + * * off_value, a scalar that specifies the values of other locations in the one-hot vector except the valid value. + * + * Output: + * + * * An (n+1)-dimensional tensor if indices is an n-dimensional tensor. The output shape is determined by\n + * * indices and axis. + * + * @since 3.2 + * @version 2.1 + */ struct OneHot { + /** + * An integer scalar that specifies the dimension for inserting the one-hot. + * Assume that the shape of indices is [N, C],\n + * and the value of depth is D. + * When axis is 0, the shape of the output is [D, N, C]. + * When axis is -1, the shape of the output is [N, C, D]. + * When axis is -1, the shape of the output is [N, D, C]. + * + */ long axis; }; +/** + * @brief Pads the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_PAD_FUSION. + * + * When paddingMode==PADDING_MODE_CONSTANT, constantValue must be set. + * The default value of constantValue is 0. + * + * Input: + * + * * x, an n-dimensional tensor. + * * paddings, a 2D tensor that specifies the length to add in each dimension. + * * The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input + * * tensor in ith dimension. + * * paddings[i][1] indicates the number of paddings to add after the input tensor in ith dimension. + * + * Output: + * + * * An n-dimensional tensor after padding, with the same dimensions and data type as x. + * * The shape is determined by x and paddings. + * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] + * + * @since 3.2 + * @version 2.1 + */ struct PadFusion { + /** + * A 2D tensor, specifying the length to add in each dimension. The shape is [n, 2]. paddings[i][0] + * indicates the number of paddings to add before the input x in the ith dimension. + * paddings[i][1] indicates the number of paddings to add after the input x in the ith dimension. + * The meaning of this parameter is the same as that of paddings input. + */ long[][] paddings; + /** + * Padding mode. + * For details, see {@link PaddingMode}. + */ enum PaddingMode paddingMode; + /** + * A constant with the same data type as x. It specifies the value to add in the pad operation. + * This parameter is valid only when paddingMode==PADDING_MODE_CONSTANT. The default value is 0. + */ float constantValue; }; +/** + * @brief Calculates the y power of each element in x. The inputs must be two tensors or one tensor + * and one scalar. + * + * When the inputs are two tensors, their data types cannot be Boolean at the same time, and their shapes + * must be the same. + * When the inputs are one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_POW_FUSION. + * + * The x' = scale*x+shift operation is performed for each element of x, and then the y power of + * x' is calculated. + * + * Input: + * + * * x, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * * y, a number, a Boolean value, or a tensor whose data type is number or Boolean. + * + * Output: + * + * * A tensor, whose shape is determined by the shape of x and y after broadcasting. + * + * @since 3.2 + * @version 2.1 + */ struct PowFusion { + /** Scale the value of x. */ float scale; + /** Increase or decrease the value of x after scaling. */ float shift; }; +/** + * @brief Applies the PReLU activation of x and weight. + * + * The {@link NodeType} of this operator is NODE_TYPE_PRELU_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. If n is greater than or equal to 2, x must be + * * [BatchSize, ..., Channels]. The second dimension is the number of channels. + * * weight, a 1D tensor. The length of weight must be 1 or equal to the number of channels. + * * If the length of weight is 1, all channels share the same weight. + * If the length of weight is equal to the number of channels, each channel exclusively has a weight. + * If n of x is less than 2, the weight length must be 1. + * + * Output: + * + * * PReLU activation value of x, with the same shape and data type as x. + * + * @since 3.2 + * @version 2.1 + */ struct PReLUFusion { + /** + * Whether to enable weight sharing for the parameter validity check. + * If the length of weight is 1, channelShared must be true. + * Otherwise, channelShared is false. + */ boolean channelShared; }; +/** + * @brief Converts the data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor after the data type conversion. + * + * @since 3.2 + * @version 2.1 + */ struct QuantDTypeCast { + /** Data type of the input tensor. */ long srcT; + /** Data type of the output tensor. */ long dstT; }; +/** + * @brief Generate a tensor containing a sequence of numbers that begin at start\n + * and extends by increments of delta up to limit. + * + * The {@link NodeType} of this operator is NODE_TYPE_RANGE. + * + * Input: + * + * * None. + * + * Output: + * + * * A 1-D tensor with specific data type containing generated range of values. + * + * @since 5.0 + * @version 2.1 + */ struct Range { + /** Expected output data type. */ long d_type; + /** Scalar. First entry for the range of output values. */ long start; + /** Scalar. Exclusive upper limit for the range of output values. */ long limit; + /** Scalar. Value to step by. */ long delta; }; +/** + * @brief Return x / y element-wise for real types. If x and y are reals, this will return floating-point division. + * + * The {@link NodeType} of this operator is NODE_TYPE_REAL_DIV. + * + * Input: + * + * * x, an n-dimensional tensor. + * * y, an n-dimensional tensor. Has the same data type as x. + * + * Output: + * + * * A tensor. Has the same data type as x. + * + * @since 5.0 + * @version 2.1 + */ struct RealDiv { }; +/** + * @brief Reduces the dimensions of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_REDUCE_FUSION. + * If mode is REDUCE_ALL, REDUCE_PROD, or REDUCE_MEAN and reduce_to_end + * is true, the output is the reduced value multiplied by coeff. + * + * Input: + * + * * x, an n-dimensional tensor, where n is less than 8. + * * axis, a 1D tensor that specifies the dimension to reduce. The value range of each element in axis + * * is [–n, n). + * + * Output: + * + * * An m-dimensional tensor, with the same data type as x. If keepDims is false, m < n. + * * If keepDims is true, m==n. + * + * @since 3.2 + * @version 2.1 + */ struct ReduceFusion { + /** Whether to keep the dimensions remain unchanged. */ boolean keepDims; + /** Algorithm used to reduce the tensor dimensions. For details, see {@link ReduceMode}. */ enum ReduceMode mode; + /** + * If this parameter is set to true, the first element is obtained from axis and set to i, + * and then axis will be changed to [i,i+1, ...,n-1,n]. + * For example, if reduceToEnd is true, axis is [2,4], and the number of dimensions of + * x is 7, then axis will be [2,3,4,5,6]. + */ boolean reduceToEnd; + /** Coefficient. */ float coeff; }; +/** + * @brief Reshapes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESHAPE. + * + * Input: + * + * * x, an n-dimensional tensor. + * * InputShape, a 1D tensor that specifies the shape of the output tensor. It must be a constant. + * + * Output: + * + * * A tensor of the specified shape. The data type is the same as that of x. + * + * @since 3.2 + * @version 2.1 + */ struct Reshape { }; +/** + * @brief Resizes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RESIZE. + * + * The parameter combination of this operator can implement the Resize function. + * For example, to implement bilinear interpolation on the four corners of an image that is precisely aligned, set: + * method = RESIZE_METHOD_LINEAR + * coordinateTransformMode = COORDINATE_TRANSFORM_MODE_ALIGN_CORNERS + * + * Input: + * + * * x, a 4D tensor in the [batchSize, height, width, channels] (NHWC) format. + * + * Output: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 2.1 + */ struct Resize { + /** Method used for resizing. For details, see {@link ResizeMethod}. */ enum ResizeMethod method; + /** Height of the 4D tensor after resizing. */ long newHeight; + /** Width of the 4D tensor after resizing. */ long newWidth; + /** Whether to maintain the height/width ratio of x after resizing. */ boolean preserveAspectRatio; + /** + * Coordinate transformation method. For details, see {@link CoordinateTransformMode}. + */ enum CoordinateTransformMode coordinateTransformMode; + /** Cubic coefficient, used when method is RESIZE_METHOD_CUBIC. */ float cubicCoeff; + /** When excludeOutside==1, the sampling weight that exceeds the boundary of x is set to 0, + * and other weights are normalized. + */ long excludeOutside; + /** Value to interpolate, which is used only when x is cropped. The sampling weight that exceeds the + * boundary is set to extrapolationValue. + */ float extrapolationValue; + /** Nearest neighbor interpolation algorithm, used when method is RESIZE_METHOD_NEAREST. + * For details, see {@link NearestMode}. + */ enum NearestMode nearestMode; }; +/** + * @brief Calculates the reciprocal of the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RSQRT. + * + * Input: + * + * *x, an n-dimensional tensor, where n is less than 8. Each element of the tensor cannot be less than 0. + * + * Output: + * + * * An n-dimensional tensor, with the same shape and data type as x. + * + * @since 3.2 + * @version 2.1 + */ struct Rsqrt { }; +/** + * @brief Scales a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SCALE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * scale, the scaling tensor. + * * bias, the bias tensor. + * + * Output: + * + * * An n-dimensional tensor scaled, whose data type is the same as that of xx and shape is determined + * * by axis. + * + * @since 3.2 + * @version 2.1 + */ struct ScaleFusion { + /** Dimensions to scale. */ long axis; + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Returns the share of the input tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SHAPE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An integer array representing the dimensions of x. + * + * @since 3.2 + * @version 2.1 + */ struct Shape { }; +/** + * @brief Slices a tensor of the specified size. + * + * The {@link NodeType} of this operator is NODE_TYPE_SLICE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * begin, an array of integers greater than or equal to 0, specifying the start of the slice. + * * size, an array of integers greater than or equal to 0, specifying the length of the slice. + * * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. + * + * Output: + * + * * An n-dimensional tensor obtained. + * + * @since 3.2 + * @version 2.1 + */ struct SliceFusion { + /** Dimensions on which the tensor is sliced. */ long[] axes; }; +/** + * @brief Applies the softmax operation on a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SOFTMAX. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result of the softmax operation. It is an n-dimensional tensor with the same data type and shape + * * as x. + * + * @since 3.2 + * @version 2.1 + */ struct Softmax { + /** Dimensions on which the softmax operation is performed. It is an integer in the range [-n, n). */ long[] axis; }; +/** + * @brief Splits a 4D tensor into multiple blocks in the spatial dimension and then concatenates these blocks + * in the batch dimension. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPACE_TO_BATCH_ND. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * A 4D tensor with the same data type as x. The shape is determined by input, blockShape, + * and paddings. Assume that the input shape is [n,c,h,w], then: + * \f$ output.shape[0] = n * blockShape[0] * blockShape[1]\f$
+ * \f$ output.shape[1] = c \f$
+ * \f$ output.shape[2] = (h + paddings[0][0] + paddings[0][1]) / blockShape[0] \f$
+ * \f$ output.shape[3] = (w + paddings[1][0] + paddings[1][1]) / blockShape[1] \f$
+ * \f$ (h + paddings[0][0] + paddings[0][1]) must be an integer multiple of \f$ blockShape[0]\f$, and + * (w + paddings[1][0] + paddings[1][1]) \f$ must be an integer multiple of \f$ blockShape[1] \f$. + * + * @since 3.2 + * @version 2.1 + */ struct SpaceToBatchND { + /** Number of blocks. The value must be greater than 1. */ long[] blockShape; + /** Padding size for spatial dimensions. */ long[][] paddings; }; +/** + * @brief Splits a tensor into multiple tensors along the axis dimension. The number of tensors is + * specified by outputNum. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPLIT. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An array of n-dimensional tensors, with the same data type and dimensions. + * * The data type of each tensor is the same as that of x. + * + * @since 3.2 + * @version 2.1 + */ struct Split { + /** Number of output sensors. */ long outputNum; + /** + * Size of each tensor to output. + * If size_splits is empty, x will be evenly split into tensors of the same size. + * In this case, x.shape[axis] must be an integer multiple of outputNum. + * If size_splits is not empty, the sum of all elements must be equal to x.shape[axis]. + */ long[] sizeSplits; + /** Target axis on which x is split. The data type is int. */ long axis; }; +/** + * @brief Calculates the square root of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQRT. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An n-dimensional tensor, with the same data type and shape as x. + * + * @since 3.2 + * @version 2.1 + */ struct Sqrt { }; +/** + * @brief Calculates the square of a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUARE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * An n-dimensional tensor, with the same data type and shape as x. + * + * @since 5.0 + * @version 2.1 + */ struct Square { }; +/** + * @brief Calculates the square of the difference between two tensors. + * The SquaredDifference operator supports subtraction between tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUEEZE. + * + * Input: + * + * * x, a tensor representing the minuend, which can be a number or a Boolean value. + * * x, a tensor representing the subtrahend, which can be a number or a Boolean value. + * + * Output: + * + * * A tensor obtained. The shape of the output is determined by x and y. + * * If x and y are of the same shape, the output shape is the same as that of x and y. + * If x and y are of different types, you need to perform the broadcast operation on + * x and y first. + * The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 2.1 + */ struct SquaredDifference { }; +/** + * @brief Removes the dimension with length of 1 from the specified axis. The int8 quantization input is supported. + * + * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor\n + * must be [2, 1, 2, 2]. That is, the dimension with the length of 1 between the 0th and 1st dimensions is removed. + * + * The {@link NodeType} of this operator is NODE_TYPE_SQUARED_DIFFERENCE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * *Tensor obtained. + * + * @since 3.2 + * @version 2.1 + */ struct Squeeze { + /** Axis on which the dimension of length 1 is to be removed. The value can be an integer or an array. + * The value range of the integer is [-n, n). + */ long[] axis; }; +/** + * @brief Stacks multiple tensors along the specified axis. If the number of dimensions of each tensor is n + * before stacking, the number of dimensions of the output tensor is n+1. + * + * The {@link NodeType} of this operator is NODE_TYPE_STACK. + * + * Input: + * + * * Multiple n-dimensional tensors, which are of the same data type and shape. + * + * Output: + * + * * An n+1D tensor along the specified axis, with the same data type and precision as the input tensors. + * + * @since 3.2 + * @version 2.1 + */ struct Stack { + /** An integer that specifies the dimension for tensor stacking. The value range is [-(n+1),(n+1)), + * which means a negative number is allowed. + */ long axis; }; +/** + * @brief Slices a tensor at the specified intervals. + * + * The {@link NodeType} of this operator is NODE_TYPE_STRIDED_SLICE. + * + * Input: + * + * * x, an n-dimensional tensor. + * * begin, a 1D tensor that specifies the position from which the tensor is sliced. + * * The length of begin is n. begin[i] specifies the start point to slice in the ith dimension. + * * end, a 1D tensor that specifies the end to which the tensor is sliced. The length of end is n. + * * end[i] specifies the end point to slice in the ith dimension. + * * strides, a 1D tensor that specifies the intervals for slicing. The length of strides is n. + * * strides[i] specifies the intervals at which the tensor is sliced in the ith dimension. Negative values are allowed. + * + * For the input tensor, the shapes of begin, end, and strides must be the same. + * The indices of begin and end start from 0. The elements of strides cannot be 0. + * + * Output: + * + * * A tensor, with the same data type as x. The number of dimensions of the output tensor is rank (x[0])+1. + * + * @since 3.2 + * @version 2.1 + */ struct StridedSlice { + /** + * Mask of begin. + * beginMask identifies different dimensions of x in binary code. For example, if bit i of beginMask + * is set to 1, the setting of begin in the ith dimension will be invalid, which means the start index of + * that dimension is 0. The default value is 0. + */ long beginMask; + /** + * Mask of end. The parameter is similar to begin_mask. + * endMask identifies different dimensions of x in binary code. For example, if bit i of endMask is + * set to 1, the setting of end in the ith dimension will be invalid, which means the tensor will be + * sliced till the end in that dimension. The default value is 0. + */ long endMask; + /** + * An integer used to mask begin and end. + * The tensor does not need to be sliced in the non-zero dimensions. + * ellipsisMask is represented in binary code. If bit i of ellipsisMask is 1, elements are sliced + * from the first element at strides[i] in the ith dimension until the tensor boundary. + */ long ellipsisMask; + /** + * Used to add a dimension. + * newAxisMask identifies different dimensions of x in binary code. If bit i is 1, the settings of + * begin, end, and strides are invalid for all dimensions, and a dimension with size of 1 is added + * to bit i. + */ long newAxisMask; + /** + * Used to shrink the specified dimension. + * shrinkAxisMask is represented in binary code. If the ith bit of the shrinkAxisMask is 1, all + * elements in the ith dimension will be discarded, and the length of the ith dimension is shrunk to 1. + */ long shrinkAxisMask; }; +/** + * @brief Calculates the difference between two tensors. + * + * The {@link NodeType} of this operator is NODE_TYPE_SUB_FUSION. + * + * Input: + * + * * x, the minuend, which is a tensor of the int or float type. + * * y, the subtrahend, which is a tensor of the int or float type. + * + * Output: + * + * * Difference between the two tensors. The output shape is determined byx and y. + * * If x and y are of the same shape, the output tensor has the same shape as x and y. + * If x and y are of different shapes, perform the broadcast operation on x or y first. + * The precision of the output is the same as the input tensor with higher precision. + * + * @since 3.2 + * @version 2.1 + */ struct SubFusion { + /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; +/** + * @brief Copies a tensor by the specified times. + * + * The {@link NodeType} of this operator is NODE_TYPE_TILE_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * * multiples, a 1D tensor that specifies the number of times that the input tensor is copied + * * in each dimension. + * * The length m is not less than the number of dimensions of x. + * + * Output: + * + * * An m-dimensional tensor, with the same data type as x. If the length of x is the same as that of + * * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, + * * an n-dimensional tensor is output. + * * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. + * * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. + * + * @since 3.2 + * @version 2.1 + */ struct TileFusion { + /** A 1D tensor that specifies the number of times that data is copied in each dimension. The length m is not + * less than the number of dimensions of x. + */ long[] dims; }; +/** + * @brief Obtains the first K maximum values along the axis and their indices. + * + * The {@link NodeType} of this operator is NODE_TYPE_TOPK_FUSION. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * output0, the first K maximum values in the axis dimension. + * * output1, indices of the first K maximum values. + * + * @since 3.2 + * @version 2.1 + */ struct TopKFusion { + /** The value true means to sort the elements in descending order; the value false means + * the opposite. + */ boolean sorted; + /** Specified axis. */ long axis; }; +/** + * @brief Transposes a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_TRANSPOSE. + * + * Input: + * + * * x, an n-dimensional tensor to transpose. + * * perm, a 1D tensor that specifies the permutation. Its length is the same as the number of dimensions of + * * x. + * + * Output: + * + * * An n-dimensional tensor, which has the same data type and quantization parameters as x. + * * The shape is determined by the shape of x and perm. + * + * @since 3.2 + * @version 2.1 + */ struct Transpose { }; +/** + * @brief Adds a dimension based on the value of axis. * + * + * The {@link NodeType} of this operator is NODE_TYPE_UNSQUEEZE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor output. + * + * @since 3.2 + * @version 2.1 + */ struct Unsqueeze { + /** Dimension to add. The value of axis can be an integer or an array of integers. + * The value range of the integer is [-n, n). + */ long[] axis; }; +/** + * @brief Unpacks the given dimension of a rank-R tensor into rank-(R-1) tensors. + * Unpacks tensors from x by chipping it along the axis dimension. + * For example, given a tensor of shape (A, B, C, D); + * If axis == 0, then the i'th tensor in output is the slice value[i, :, :, :],\n + * and each tensor in output will have shape (B, C, D). + * If axis == 1, then the i'th tensor in output is the slice value[:, i, :, :],\n + * and each tensor in output will have shape (A, C, D). Etc. + * This is the opposite of stack. + * + * The {@link NodeType} of this operator is NODE_TYPE_UNSTACK. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor output. + * + * @since 5.0 + * @version 2.1 + */ struct Unstack { long axis; }; +/** + * @brief Selects elements from x1 or x2, depending on condition. + * The x1 and x2 tensors must all have the same shape, and the output will also have that shape. + * The condition tensor must be a scalar if x1 and x2 are scalars. + * If x and x2 are vectors or higher rank, then condition must be either a scalar, + * a vector with size matching the first dimension of x, or must have the same shape as x. + * The condition tensor acts as a mask that chooses, based on the value at each element, + * whether the corresponding element / row in the output should be taken from x (if true) or y (if false). + * + * The {@link NodeType} of this operator is NODE_TYPE_SELECT. + * + * Input: + * + * * condition, A Tensor of type bool. + * * x1, a tensor which may have the same shape as condition. + * * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. + * * x2, a tensor with the same data type and shape as x1. + * Output: + * + * * Tensor output. Has the same shape as x1. + * + * @since 5.0 + * @version 2.1 + */ struct Select { }; +/** + * @brief Computes the Gauss error function of x element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_ERF. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor output. Has the same data type and shape as x. + * + * @since 5.0 + * @version 2.1 + */ struct Erf { -}; \ No newline at end of file +}; + +/** @} */ -- Gitee From 0588e5b531e0c6854a967bf8bd700eabc40eda15 Mon Sep 17 00:00:00 2001 From: maoyong Date: Wed, 7 Feb 2024 16:47:21 +0800 Subject: [PATCH 028/210] fix description bug. Signed-off-by: maoyong --- nnrt/v1_0/NnrtTypes.idl | 4 ++-- nnrt/v1_0/NodeAttrTypes.idl | 2 +- nnrt/v2_0/NnrtTypes.idl | 4 ++-- nnrt/v2_0/NodeAttrTypes.idl | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/nnrt/v1_0/NnrtTypes.idl b/nnrt/v1_0/NnrtTypes.idl index 9b631688..8e538edd 100644 --- a/nnrt/v1_0/NnrtTypes.idl +++ b/nnrt/v1_0/NnrtTypes.idl @@ -361,9 +361,9 @@ enum NodeType : unsigned int { NODE_TYPE_SPLIT = 145, /** Sqrt operator */ NODE_TYPE_SQRT = 146, - /** SquaredDifference operator */ - NODE_TYPE_SQUEEZE = 147, /** Squeeze operator */ + NODE_TYPE_SQUEEZE = 147, + /** SquaredDifference operator */ NODE_TYPE_SQUARED_DIFFERENCE = 149, /** Stack operator */ NODE_TYPE_STACK = 150, diff --git a/nnrt/v1_0/NodeAttrTypes.idl b/nnrt/v1_0/NodeAttrTypes.idl index 77a54009..17b13044 100644 --- a/nnrt/v1_0/NodeAttrTypes.idl +++ b/nnrt/v1_0/NodeAttrTypes.idl @@ -452,7 +452,7 @@ struct ExpandDims * * shape, which specifies the dimensions of the tensor to create. * Outputs: * - * *Tensor filled by the scaler. + * * Tensor filled by the scaler. * * @since 3.2 * @version 1.0 diff --git a/nnrt/v2_0/NnrtTypes.idl b/nnrt/v2_0/NnrtTypes.idl index 18f9ae35..dbe63091 100644 --- a/nnrt/v2_0/NnrtTypes.idl +++ b/nnrt/v2_0/NnrtTypes.idl @@ -369,9 +369,9 @@ enum NodeType : unsigned int { NODE_TYPE_SPLIT = 145, /** Sqrt operator. */ NODE_TYPE_SQRT = 146, - /** SquaredDifference operator. */ - NODE_TYPE_SQUEEZE = 147, /** Squeeze operator. */ + NODE_TYPE_SQUEEZE = 147, + /** SquaredDifference operator. */ NODE_TYPE_SQUARED_DIFFERENCE = 149, /** Stack operator. */ NODE_TYPE_STACK = 150, diff --git a/nnrt/v2_0/NodeAttrTypes.idl b/nnrt/v2_0/NodeAttrTypes.idl index 0296404c..8bd5650c 100644 --- a/nnrt/v2_0/NodeAttrTypes.idl +++ b/nnrt/v2_0/NodeAttrTypes.idl @@ -485,7 +485,7 @@ struct ExpandDims * * shape, which specifies the dimensions of the tensor to create. * Output: * - * *Tensor filled by the scaler. + * * Tensor filled by the scaler. * * @since 3.2 * @version 2.0 @@ -1271,7 +1271,7 @@ struct SquaredDifference /** * @brief Removes the dimension with length of 1 from the specified axis. The int8 quantization input is supported. * - * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor + * Assume that the shape of x is [2, 1, 1, 2, 2] and axis is [0,1], the shape of the output tensor\n * must be [2, 1, 2, 2]. That is, the dimension with the length of 1 between the 0th and 1st dimensions is removed. * * The {@link NodeType} of this operator is NODE_TYPE_SQUARED_DIFFERENCE. @@ -1424,10 +1424,10 @@ struct SubFusion * Output: * * * An m-dimensional tensor, with the same data type as x. If the length of x is the same as that of - * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, - * an n-dimensional tensor is output. - * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. - * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. + * * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, + * * an n-dimensional tensor is output. + * * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. + * * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. * * @since 3.2 * @version 2.0 -- Gitee From 59a04069c625c5505d5ebfe820aeb916492f9f69 Mon Sep 17 00:00:00 2001 From: hejiaogirl Date: Sat, 17 Feb 2024 21:01:01 +0800 Subject: [PATCH 029/210] fix : sensing the intermediate authentication result Signed-off-by: hejiaogirl Change-Id: Ic561f603b3f08f349358524b73eff534774c239f --- fingerprint_auth/bundle.json | 10 +- fingerprint_auth/v1_2/BUILD.gn | 27 +++ .../v1_2/FingerprintAuthTypes.idl | 181 ++++++++++++++++++ fingerprint_auth/v1_2/IExecutor.idl | 106 ++++++++++ .../v1_2/IFingerprintAuthInterface.idl | 60 ++++++ fingerprint_auth/v1_2/ISaCommandCallback.idl | 62 ++++++ 6 files changed, 441 insertions(+), 5 deletions(-) create mode 100644 fingerprint_auth/v1_2/BUILD.gn create mode 100644 fingerprint_auth/v1_2/FingerprintAuthTypes.idl create mode 100644 fingerprint_auth/v1_2/IExecutor.idl create mode 100644 fingerprint_auth/v1_2/IFingerprintAuthInterface.idl create mode 100644 fingerprint_auth/v1_2/ISaCommandCallback.idl diff --git a/fingerprint_auth/bundle.json b/fingerprint_auth/bundle.json index 6a152b0f..c490401c 100644 --- a/fingerprint_auth/bundle.json +++ b/fingerprint_auth/bundle.json @@ -1,7 +1,7 @@ { "name": "@ohos/drivers_interface_fingerprint_auth", "description": "fingerprint_auth device driver interface", - "version": "4.0", + "version": "5.0", "license": "Apache License 2.0", "publishAs": "code-segment", "segment": { @@ -27,7 +27,7 @@ "build": { "sub_component": [ "//drivers/interface/fingerprint_auth/v1_0:fingerprint_auth_idl_target", - "//drivers/interface/fingerprint_auth/v1_1:fingerprint_auth_idl_target" + "//drivers/interface/fingerprint_auth/v1_2:fingerprint_auth_idl_target" ], "test": [ ], @@ -57,7 +57,7 @@ } }, { - "name": "//drivers/interface/fingerprint_auth/v1_1:libfingerprint_auth_proxy_1.1", + "name": "//drivers/interface/fingerprint_auth/v1_2:libfingerprint_auth_proxy_1.2", "header": { "header_files": [ ], @@ -65,7 +65,7 @@ } }, { - "name": "//drivers/interface/fingerprint_auth/v1_1:libfingerprint_auth_stub_1.1", + "name": "//drivers/interface/fingerprint_auth/v1_2:libfingerprint_auth_stub_1.2", "header": { "header_files": [ ], @@ -73,7 +73,7 @@ } }, { - "name": "//drivers/interface/fingerprint_auth/v1_1:fingerprint_auth_idl_headers_1.1", + "name": "//drivers/interface/fingerprint_auth/v1_2:fingerprint_auth_idl_headers_1.2", "header": { "header_files": [ ], diff --git a/fingerprint_auth/v1_2/BUILD.gn b/fingerprint_auth/v1_2/BUILD.gn new file mode 100644 index 00000000..951ea728 --- /dev/null +++ b/fingerprint_auth/v1_2/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("fingerprint_auth") { + module_name = "drivers_peripheral_fingerprint_auth" + imports = [ "ohos.hdi.fingerprint_auth.v1_0:fingerprint_auth" ] + sources = [ + "FingerprintAuthTypes.idl", + "IExecutor.idl", + "IFingerprintAuthInterface.idl", + "ISaCommandCallback.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_fingerprint_auth" +} diff --git a/fingerprint_auth/v1_2/FingerprintAuthTypes.idl b/fingerprint_auth/v1_2/FingerprintAuthTypes.idl new file mode 100644 index 00000000..02097547 --- /dev/null +++ b/fingerprint_auth/v1_2/FingerprintAuthTypes.idl @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 5.0 + */ + +/** + * @file FingerprintAuthTypes.idl + * + * @brief Defines fingerprint auth driver enumeration and data structure, including AuthType, ExecutorRole, ExecutorSecureLevel, + * CommandId, FingerprintTipsCode, ExecutorInfo and TemplateInfo. + * + * @since 5.0 + */ + +package ohos.hdi.fingerprint_auth.v1_2; + +/** + * Enumerates prompt codes. + * + * @since 5.0 + * @version 1.2 + */ +enum FingerprintTipsCode : int { + FINGERPRINT_AUTH_TIP_GOOD = 0, /**< Indicates that the image acquired is good. */ + FINGERPRINT_AUTH_TIP_DIRTY = 1, /**< Indicates that the fingerprint image is too noisy due to suspected or detected dirt on sensor. */ + FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2, /**< Indicates that only a partial fingerprint image is detected. */ + FINGERPRINT_AUTH_TIP_PARTIAL = 3, /**< Indicates that only a partial fingerprint image is detected. */ + FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /**< Indicates that the fingerprint image is incomplete due to quick motion. */ + FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< Indicates that the fingerprint image is unreadable due to lack of motion. */ + FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< Indicates that the finger is down. */ + FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< Indicates that the finger is up. */ + FINGERPRINT_AUTH_TIP_SINGLE_AUTH_RESULT = 8, /**< Indicates that a single auth result. The authentication result is carried in a JSON + charactre string: {"authResult":1,"authRemainAttempts":5,"lockoutDuration":0} */ + VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< Vendor may add custom fingerprint auth tip after this. */ +}; + +/** + * @brief Enumerates get Property types. + * + * @since 5.0 + * @version 1.2 + */ +enum GetPropertyType : int { + /**< Indicates that the property to get is auth sub type. */ + AUTH_SUB_TYPE = 1, + /**< Indicates that the property to get is lockout duration. */ + LOCKOUT_DURATION = 2, + /**< Indicates that the property to get is remain attempts. */ + REMAIN_ATTEMPTS = 3, + /**< Indicates that the property to get is enroll progress. */ + ENROLL_PROGRESS = 4, + /**< Indicates that the property to get is sensor info. */ + SENSOR_INFO = 5 +}; + +/** + * @brief Indicates executor property. + * + * @since 5.0 + * @version 1.2 + */ +struct Property { + /**< Indicates auth sub type. */ + unsigned long authSubType; + /**< Indicates lockout duration. */ + int lockoutDuration; + /**< Indicates remain attempts. */ + int remainAttempts; + /**< Indicates enroll progress. */ + String enrollmentProgress; + /**< Indicates sensor info. */ + String sensorInfo; +}; + +/** + * @brief Enumerates sa command ids. + * + * @since 5.0 + * @version 1.2 + */ +enum SaCommandId : int { + /**< Indicates that the sa command is enable sensor illumination. */ + ENABLE_SENSOR_ILLUMINATION = 1, + /**< Indicates that the sa command is disable sensor illumination. */ + DISABLE_SENSOR_ILLUMINATION = 2, + /**< Indicates that the sa command is turn on sensor illumination. */ + TURN_ON_SENSOR_ILLUMINATION = 3, + /**< Indicates that the sa command is turn off sensor illumination. */ + TURN_OFF_SENSOR_ILLUMINATION = 4, +}; + +/** + * @brief Sa command parameter for enable sensor illumination. + * + * @since 5.0 + * @version 1.2 + */ +struct SaCommandParamEnableSensorIllumination { + /**< Indicates that highlight circle center x-coordinate per thousand to screen width. */ + unsigned int centerX; + /**< Indicates that highlight circle center y-coordinate per thousand to screen height. */ + unsigned int centerY; + /**< Indicates that highlight circle radius, in px. */ + unsigned int radius; + /**< Indicates that highlight brightness. */ + unsigned int brightness; + /**< Indicates that highlight color. */ + unsigned int color; +}; + +/** + * @brief Indicates sa command parameter none. + * + * @since 5.0 + * @version 1.2 + */ +struct SaCommandParamNone { +}; + +/** + * @brief Indicates sa command parameter. + * + * @since 5.0 + * @version 1.2 + */ +union SaCommandParam { + /**< Indicates that sa command parameter is none. See {@link SaCommandParamNone}. */ + struct SaCommandParamNone none; + /**< Indicates that sa command parameter is enable sensor illumination. See {@link SaCommandParamEnableSensorIllumination}. */ + struct SaCommandParamEnableSensorIllumination enableSensorIllumination; +}; + +/** + * @brief Indicates sa command. + * + * @since 5.0 + * @version 1.2 + */ +struct SaCommand { + /**< Indicates sa command id. See {@link SaCommandId}. */ + enum SaCommandId id; + /**< Indicates sa command parameter. See {@link SaCommandParam}. */ + union SaCommandParam param; +}; + +/** + * Enumerates command id. + * + * @since 5.0 + * @version 1.2 + */ +enum CommandId : int { + LOCK_TEMPLATE = 1, /**< Indicates lock template command id. */ + UNLOCK_TEMPLATE = 2, /**< Indicates unlock template command id. */ + INIT_ALGORITHM = 3, /**< Indicates init algorithm command id. */ + VENDOR_COMMAND_BEGIN = 10000 /**< Vendor may add custom command id after this. */ +}; \ No newline at end of file diff --git a/fingerprint_auth/v1_2/IExecutor.idl b/fingerprint_auth/v1_2/IExecutor.idl new file mode 100644 index 00000000..9821faeb --- /dev/null +++ b/fingerprint_auth/v1_2/IExecutor.idl @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 5.0 + */ + +/** + * @file IExecutor.idl + * + * @brief Defines the APIs of executor. These APIs can be used to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 5.0 + */ + +package ohos.hdi.fingerprint_auth.v1_2; + +import ohos.hdi.fingerprint_auth.v1_0.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v1_0.IExecutor; +import ohos.hdi.fingerprint_auth.v1_0.IExecutorCallback; +import ohos.hdi.fingerprint_auth.v1_2.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v1_2.ISaCommandCallback; + +/** + * @brief Defines the APIs of executor. These APIs can be used to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 5.0 + * @version 1.2 + */ +interface IExecutor extends ohos.hdi.fingerprint_auth.v1_0.IExecutor { + /** + * @brief Authenticate template. + * + * @param scheduleId Indicates schedule id of authenticate. + * @param templateIdList Indicates the templates to process. + * @param endAfterFirstFail Indicates end authentication after the first authentication failure. + * @param extraInfo Indicates extra info of authenticate. + * @param callbackObj Indicates authenticate callback object, see {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.2 + */ + AuthenticateV1_1([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] boolean endAfterFirstFail, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Get property. + * + * @param templateIdList Indicates the templates to process. + * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}. + * @param property Indicates property. See {@link Property}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.2 + */ + GetProperty([in] unsigned long[] templateIdList, [in] enum GetPropertyType[] propertyTypes, [out] struct Property property); + /** + * @brief Set cached templates. + * + * @param templateIdList Indicates the templates to cache. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.2 + */ + SetCachedTemplates([in] unsigned long[] templateIdList); + /** + * @brief Register sa command callback. + * + * @param callbackObj Indicates the sa command callback. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + RegisterSaCommandCallback([in] ISaCommandCallback callbackObj); +} \ No newline at end of file diff --git a/fingerprint_auth/v1_2/IFingerprintAuthInterface.idl b/fingerprint_auth/v1_2/IFingerprintAuthInterface.idl new file mode 100644 index 00000000..ff652f98 --- /dev/null +++ b/fingerprint_auth/v1_2/IFingerprintAuthInterface.idl @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 5.0 + */ + +/** + * @file IFingerprintAuthInterface.idl + * + * @brief Defines the get executor list API of the fingerprint auth driver. This API can be used to get executor list + * of driver. + * + * @since 5.0 + */ + +package ohos.hdi.fingerprint_auth.v1_2; + +import ohos.hdi.fingerprint_auth.v1_0.IFingerprintAuthInterface; +import ohos.hdi.fingerprint_auth.v1_2.IExecutor; + +/** + * @brief Defines the get executor list API of the fingerprint auth driver. + * + * @since 5.0 + * @version 1.2 + */ +interface IFingerprintAuthInterface extends ohos.hdi.fingerprint_auth.v1_0.IFingerprintAuthInterface { + /** + * @brief Obtains executor list of driver. + * + * @param executorList Indicates executor list of driver. For details, see {@link IExecutor}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + GetExecutorListV1_1([out] IExecutor[] executorList); +} \ No newline at end of file diff --git a/fingerprint_auth/v1_2/ISaCommandCallback.idl b/fingerprint_auth/v1_2/ISaCommandCallback.idl new file mode 100644 index 00000000..5cdf99f8 --- /dev/null +++ b/fingerprint_auth/v1_2/ISaCommandCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + */ + +/** + * @file ISaCommandCallback.idl + * + * @brief Defines the callback for an async API, which can be used to send command to SA. See {@link IExecutor}. + * + * @since 5.0 + */ + +package ohos.hdi.fingerprint_auth.v1_2; + +import ohos.hdi.fingerprint_auth.v1_2.FingerprintAuthTypes; + +/** + * @brief Defines the callback for an async API, which can be used to send command to SA. See {@link IExecutor}. + * + * @since 5.0 + * @version 1.2 + */ +[callback] interface ISaCommandCallback { + /** + * @brief Defines the function for sa commands in process. + * + * @param commands Indicates sa commands. See {@link SaCommand}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.2 + */ + OnSaCommands([in] struct SaCommand[] commands); +} +/** @} */ \ No newline at end of file -- Gitee From 9c3c433f51083e82fe498801862767386dfa4455 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Sun, 18 Feb 2024 10:53:12 +0800 Subject: [PATCH 030/210] HDF_SENSOR_TYPE_RPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/v2_0/SensorTypes.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/sensor/v2_0/SensorTypes.idl b/sensor/v2_0/SensorTypes.idl index 9c9fa62a..3cec89b1 100644 --- a/sensor/v2_0/SensorTypes.idl +++ b/sensor/v2_0/SensorTypes.idl @@ -127,6 +127,7 @@ enum HdfSensorTypeTag { HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */ HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + HDF_SENSOR_TYPE_RPC = 282, /**< Radio Power Control */ HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */ }; -- Gitee From 3ff8e46d2160075e2d301c62281a7e7e01f53dfb Mon Sep 17 00:00:00 2001 From: hejiaogirl Date: Sun, 18 Feb 2024 12:16:21 +0800 Subject: [PATCH 031/210] fix : sensing the intermediate authentication result Signed-off-by: hejiaogirl Change-Id: I6eb525d0091055c06350ed546524c86c60ab2233 --- fingerprint_auth/v1_2/FingerprintAuthTypes.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fingerprint_auth/v1_2/FingerprintAuthTypes.idl b/fingerprint_auth/v1_2/FingerprintAuthTypes.idl index 02097547..852f75d2 100644 --- a/fingerprint_auth/v1_2/FingerprintAuthTypes.idl +++ b/fingerprint_auth/v1_2/FingerprintAuthTypes.idl @@ -53,8 +53,8 @@ enum FingerprintTipsCode : int { FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, /**< Indicates that the fingerprint image is unreadable due to lack of motion. */ FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, /**< Indicates that the finger is down. */ FINGERPRINT_AUTH_TIP_FINGER_UP = 7, /**< Indicates that the finger is up. */ - FINGERPRINT_AUTH_TIP_SINGLE_AUTH_RESULT = 8, /**< Indicates that a single auth result. The authentication result is carried in a JSON - charactre string: {"authResult":1,"authRemainAttempts":5,"lockoutDuration":0} */ + FINGERPRINT_AUTH_TIP_SINGLE_AUTH_RESULT = 8, /**< Indicates that a single auth result. The authentication result is carried in a json + character string: {"authResult":1,"authRemainAttempts":3,"lockoutDuration":0} */ VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 /**< Vendor may add custom fingerprint auth tip after this. */ }; -- Gitee From 4a678d0b81554fb61bd5f62bdea4081541f2308a Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Sun, 4 Feb 2024 15:37:02 +0800 Subject: [PATCH 032/210] fix : Increase the enumeration value Signed-off-by: fan-jingle --- display/bundle.json | 19 ++++++- display/graphic/common/v1_1/BUILD.gn | 24 +++++++++ .../common/v1_1/BufferHandleMetaKeyType.idl | 54 +++++++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 display/graphic/common/v1_1/BUILD.gn create mode 100644 display/graphic/common/v1_1/BufferHandleMetaKeyType.idl diff --git a/display/bundle.json b/display/bundle.json index fcfa55a0..c5c0230a 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -48,7 +48,8 @@ "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", "//drivers/interface/display/composer/v1_1:display_composer_idl_target", "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", - "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target" + "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target", + "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target" ], "inner_kits": [ { @@ -220,6 +221,22 @@ ], "header_base": "//drivers/interface/display/graphic/common" } + }, + { + "name": "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_headers_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/graphic/common" + } + }, + { + "name": "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_headers_1.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/graphic/common" + } } ] } diff --git a/display/graphic/common/v1_1/BUILD.gn b/display/graphic/common/v1_1/BUILD.gn new file mode 100644 index 00000000..0b163061 --- /dev/null +++ b/display/graphic/common/v1_1/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2023 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("display_commontype") { + module_name = "display_commontype" + + sources = [ "BufferHandleMetaKeyType.idl" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} diff --git a/display/graphic/common/v1_1/BufferHandleMetaKeyType.idl b/display/graphic/common/v1_1/BufferHandleMetaKeyType.idl new file mode 100644 index 00000000..19890250 --- /dev/null +++ b/display/graphic/common/v1_1/BufferHandleMetaKeyType.idl @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 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 Display + * + * @brief Define the Buffer Handle Meta Key interface of the display module. + * + * This module provides the data types used by the driver interface for the upper-level graphics service + * + * @since 5.0 + * @version 1.1 + */ + +/** + * @file BufferHandleMetaKeyType.idl + * @brief Declares the data types used by the interfaces related to graphic BufferHandle Meta Key operations. + * + */ + +package ohos.hdi.display.graphic.common.v1_1; +import ohos.hdi.display.graphic.common.v1_0.BufferHandleMetaKeyType; + +/** + * @brief Enumerates the Gralloc Buffer Handle Attr Key types. + * + */ +enum BufferHandleAttrKey : ohos.hdi.display.graphic.common.v1_0.BufferHandleAttrKey { + ATTRKEY_REQUEST_ACCESS_TYPE = 10, // value: current request frame mode + ATTRKEY_ACCESS_TYPE = 11, // value: current data frame mode +}; + +/** + * @brief Enumerates the Gralloc Hebc Access types. + * + */ +enum HebcAccessType { + HEBC_ACCESS_UNINIT = 0, // not configured frame mode + HEBC_ACCESS_CPU_ACCESS, // cpu is accessible; hebc is not accessible + HEBC_ACCESS_HW_ONLY, // hardware_only: cpu is not accessible; hebc is accessible +}; -- Gitee From d474254f68a98bfe72c85f915439f8c406d66ef6 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 20 Feb 2024 11:55:44 +0800 Subject: [PATCH 033/210] add ops for phase 2 & phase 3 Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 52 +++ nnrt/v2_1/NodeAttrTypes.idl | 634 +++++++++++++++++++++++++++++++++++- 2 files changed, 680 insertions(+), 6 deletions(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index dbc6d26c..1043e132 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -297,8 +297,12 @@ enum NodeType : unsigned int { NODE_TYPE_ACTIVATION = 2, /** ADD operator. */ NODE_TYPE_ADD_FUSION = 5, + /** ALL operator. */ + NODE_TYPE_ALL = 9, /** ArgMax operator. */ NODE_TYPE_ARGMAX_FUSION = 11, + /** Assert operator. */ + NODE_TYPE_ASSERT = 13, /** AVGPOOL operator. */ NODE_TYPE_AVGPOOL_FUSION = 17, /** BatchToSpaceND operator. */ @@ -309,6 +313,8 @@ enum NodeType : unsigned int { NODE_TYPE_BROADCAST_TO = 27, /** Cast operator. */ NODE_TYPE_CAST = 28, + /** Ceil operator. */ + NODE_TYPE_CEIL = 29, /** Clip operator. */ NODE_TYPE_CLIP = 30, /** Concat operator. */ @@ -317,10 +323,18 @@ enum NodeType : unsigned int { NODE_TYPE_CONV2D_FUSION = 35, /** Two-dimensional deconvolution operator. */ NODE_TYPE_CONV2D_TRANSPOSE_FUSION = 36, + /** Cos operator. */ + NODE_TYPE_COS = 37, /** ConstantOfShape operator. */ NODE_TYPE_CONSTANT_OF_SHAPE = 38, + /** Crop operator. */ + NODE_TYPE_CROP = 39, + /** CustomNormalize operator. */ + NODE_TYPE_CUSTOM_NORMALIZE = 41, /** DepthToSpace operator. */ NODE_TYPE_DEPTH_TO_SPACE = 45, + /** DetectionPostProcess operator. */ + NODE_TYPE_DETECTION_POST_PROCESS = 46, /** Div operator. */ NODE_TYPE_DIV_FUSION = 47, /** Element-level operator. */ @@ -333,6 +347,8 @@ enum NodeType : unsigned int { NODE_TYPE_EXPAND_DIMS = 56, /** Flatten operator. */ NODE_TYPE_FLATTEN = 61, + /** Floor operator. */ + NODE_TYPE_FLOOR = 63, /** Fill operator. */ NODE_TYPE_FILL = 66, /** FullConnection operator. */ @@ -355,16 +371,34 @@ enum NodeType : unsigned int { NODE_TYPE_LESS = 77, /** LessEqual operator. */ NODE_TYPE_LESS_EQUAL = 78, + /** Log operator. */ + NODE_TYPE_LOG = 79, + /** LogicalAnd operator. */ + NODE_TYPE_LOGICAL_AND = 81, + /** LogicalNot operator. */ + NODE_TYPE_LOGICAL_NOT = 82, + /** LogicalOr operator. */ + NODE_TYPE_LOGICAL_OR = 83, + /** LRN operator. */ + NODE_TYPE_LRN = 87, /** LSTM operator. */ NODE_TYPE_LSTM = 87, + /** L2NormalizeFusion operator. */ + NODE_TYPE_L2_NORMALIZE_FUSION = 88, /** MatMul operator. */ NODE_TYPE_MATMUL_FUSION = 89, /** Maximum operator. */ NODE_TYPE_MAXIMUM = 90, /** MaxPool operator. */ NODE_TYPE_MAX_POOL_FUSION = 92, + /** Minimum operator. */ + NODE_TYPE_MINIMUM = 96, + /** Mod operator. */ + NODE_TYPE_MOD = 98, /** Mul operator. */ NODE_TYPE_MUL_FUSION = 99, + /** Neg operator. */ + NODE_TYPE_NEG = 101, /** NotEqual operator. */ NODE_TYPE_NOT_EQUAL = 103, /** OneHot operator. */ @@ -377,8 +411,12 @@ enum NodeType : unsigned int { NODE_TYPE_PRELU_FUSION = 112, /** QuantDTypeCast operator. */ NODE_TYPE_QUANT_DTYPE_CAST = 113, + /** Rank operator. */ + NODE_TYPE_RANK = 114, /** Range operator. */ NODE_TYPE_RANGE = 115, + /** Reciprocal operator. */ + NODE_TYPE_RECIPROCAL = 116, /** RealDiv operator. */ NODE_TYPE_REAL_DIV = 117, /** Reduce operator. */ @@ -387,18 +425,28 @@ enum NodeType : unsigned int { NODE_TYPE_RESHAPE = 119, /** Resize operator. */ NODE_TYPE_RESIZE = 120, + /** Round operator. */ + NODE_TYPE_ROUND = 125, /** Rsqrt operator. */ NODE_TYPE_RSQRT = 126, /** Scale operator. */ NODE_TYPE_SCALE_FUSION = 127, + /** ScatterNd operator. */ + NODE_TYPE_SCATTER_ND = 128, /** Shape operator. */ NODE_TYPE_SHAPE = 130, + /** Sin operator. */ + NODE_TYPE_SIN = 133, /** Slice operator. */ NODE_TYPE_SLICE_FUSION = 135, /** Softmax operator. */ NODE_TYPE_SOFTMAX = 138, /** SpaceToBatchND operator. */ NODE_TYPE_SPACE_TO_BATCH_ND = 141, + /** SpaceToDepth operator. */ + NODE_TYPE_SPACE_TO_DEPTH = 142, + /** SparseToDense operator. */ + NODE_TYPE_SPARSE_TO_DENSE = 144, /** Split operator. */ NODE_TYPE_SPLIT = 145, /** Sqrt operator. */ @@ -425,10 +473,14 @@ enum NodeType : unsigned int { NODE_TYPE_UNSQUEEZE = 165, /** Unstack operator. */ NODE_TYPE_UNSTACK = 166, + /** Where operator. */ + NODE_TYPE_WHERE = 168, /** Select operator. */ NODE_TYPE_SELECT = 170, /** Ref operator. */ NODE_TYPE_ERF = 178, + /** LogSoftmax operator. */ + NODE_TYPE_LOG_SOFTMAX = 189, }; /** diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 1b7a3b36..6d8f751c 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -129,6 +129,30 @@ struct AddFusion enum ActivationType activationType; }; +/** + * @brief Determine whether all emements in a given tensor are non-zero. It returns a boolean tensor\n + * where each element is 'True' if corresponding element in the input tensor is non-zero, and 'False' otherwise. + * + * The {@link NodeType} of this operator is NODE_TYPE_ALL. + * + * Input: + * + * * x, a N-dimension tensor of shape (N,*), where * indicates any number of additional dimensions. + * * axis, scalar or tensor, indices the dimension to be computed. + * + * Output: + * + * * First K indices or values before the maximum input tensor on the axis. + * + * @since 3.2 + * @version 2.1 + */ +struct All +{ + /** Whether to keep dimension info. */ + long keepDims; +} + /** * @brief Obtains the first K indices or values of a cross-axis tensor. * @@ -159,6 +183,31 @@ struct ArgMaxFusion boolean outMaxValue; }; +/** + * @brief Asserts that the given condition si true. + * If condition evalutes to false, print the list of tensors in data. + * Summerize determines how many entries of the tensors to print. + * + * The {@link NodeType} of this operator is NODE_TYPE_ASSERT. + * + * Input: + * + * * condition, the condition to evalute. + * * data, the tensors to print out when condition is false. + * + * Output: + * + * * Tensor after average pooling. + * + * @since 5.0 + * @version 2.1 + */ +struct Assert +{ + /** Print this many entries of each tensor. */ + long summarize; +} + /** * @brief Applies a 2D average pooling on the input tensor. The int8 quantization input is supported. * @@ -303,6 +352,26 @@ struct Cast { }; +/** + * @brief Returns element-wise smallest integer in not less than x. + * + * The {@link NodeType} of this operator is NODE_TYPE_CEIL. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Output tensor after ceiled. + * + * @since 5.0 + * @version 2.1 + */ +struct Ceil +{ +}; + /** * @brief Returns a tensor of the same type and shape as input tensor with its value clipped to min and max. * Any values less than min are set to min. Any values greater than max are set to max. @@ -472,6 +541,26 @@ struct Conv2dTransposeFusion long[] outputPaddings; }; +/** + * @brief Calculates the cosine of the given input tensor, element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_COS. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * The cosine of the input tensor computed element-wise. + * + * @since 5.0 + * @version 2.1 + */ +struct Cos +{ +}; + /** * @brief Generate a tensor with given value and shape. * @@ -497,6 +586,103 @@ struct ConstantOfShape float[] value; }; +/** + * @brief Crop given tensor acrodding to axis and offset. + * + * The {@link NodeType} of this operator is NODE_TYPE_CROP. + * + * Input: + * + * * x, an n-dimensional tensor. + * * shape, an 1-dimensional tensor, indices cropped windows dimension. + * + * Output: + * + * * Cropped output tensor. + * + * @since 5.0 + * @version 2.1 + */ +struct Crop +{ + /** Cropped dimension. */ + long axis; + /** Cropped offset per dimension. */ + long[] offset; +}; + +/** + * @brief Shift and scale inputs into a distribution centered around 0 with standard deviation 1. + * It accomplishes this by precomputing the mean and variance of the data, and calling\n + * (x - mean) / sqrt(var) at runtime. + * + * The {@link NodeType} of this operator is NODE_TYPE_CUSTOM_NORMALIZE. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Normalized output tensor. + * + * @since 5.0 + * @version 2.1 + */ +struct CustomNormalize +{ +}; + +/** + * @brief Generate the real coordinates of the prediction box relative to the original image, + * and filter all the prediction boxes to obtain the final object detection result. + * The information of each prediction box output includes image id, lable, confidence, and four coordinate values. + * (x - mean) / sqrt(var) at runtime. + * + * The {@link NodeType} of this operator is NODE_TYPE_DETECTION_POST_PROCESS. + * + * Input: + * + * * bbox, boxes to be predicted. + * * scores, socres of all boxes. + * * anchors, information of boxes, includes box, variance and coordinates. + * + * Output: + * + * * image_id. + * * label. + * * confidence. + * * coordinates. + * + * @since 5.0 + * @version 2.1 + */ +struct DetectionPostProcess +{ + /** Format of input tensor, default NCHW. */ + enum Format format; + /** The size of the input tensor. */ + long input_size; + /** The scaling factor used to convert the output from the normalized form to the original image coordinates. */ + float[] scale; + /** The threshold of overlapping region during NMS. */ + float nmsIoUThreshold; + /** The socre threshold used to select target bbox duing NMS. */ + float nmsScoreThreshold; + /** Maximum of bboxes per image. */ + long maxDetections; + /** Maximum of bboxes per class. */ + long detectionsPerClass; + /** Maximum of reserved classes per bboxes. */ + long maxClassesPerDetection; + /** Number of target classes to be detected. */ + long numClasses; + /** Whether use NMS based on IoU threshold. */ + bool useRegularNms; + /** Whether need to quantize. */ + bool outQuantized; +}; + /** * @brief DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. * This is the reverse transformation of SpaceToDepth. More specifically, this op outputsa copy of the input tensor\n @@ -657,6 +843,7 @@ struct ExpandDims * Input: * * * x: A tensor of rank >= axis. + * * Output: * * * A 2D tensor with the contents of the input tensor, with input dimensions up to axis flattened to\n @@ -674,6 +861,26 @@ struct Flatten long axis; }; +/** + * @brief Returns element-wise largest integer not greater than x. + * + * The {@link NodeType} of this operator is NODE_TYPE_FLOOR. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Output tensor after floored. + * + * @since 5.0 + * @version 2.1 + */ +struct Floor +{ +}; + /** * @brief Creates a tensor of the specified dimensions and fills it with a scalar. * @@ -683,6 +890,7 @@ struct Flatten * * * value: scalar used to fill the tensor. * * shape, which specifies the dimensions of the tensor to create. + * * Output: * * * Tensor filled by the scaler. @@ -709,7 +917,7 @@ struct Fill * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required.\n * * If quantization is required, the data must be of the int32 type. The actual quantization parameter is\n * * determined by x and weight. - * * + * * Output: * * * output: computed tensor. @@ -955,6 +1163,144 @@ struct LessEqual { }; +/** + * @brief Calculates the result of nature logarithm of the input x. + * + * The {@link NodeType} of this operator is NODE_TYPE_LOG. + * + * Input: + * + * * x, the input tensor. + * + * Output: + * + * * Result tensor. + * + * @since 5.0 + * @version 2.1 + */ +struct Log +{ +}; + +/** + * @brief Calculates the truth value of x1 AND x2 element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_AND. + * + * Input: + * + * * x1, tensor of type boolean or convert to boolean implicitly. + * * x2, tensor of type boolean or convert to boolean implicitly. + * + * Output: + * + * * A tensor of type bool with the shape that x1 and x2 broadcast to. + * + * @since 5.0 + * @version 2.1 + */ +struct LogicalAnd +{ +}; + +/** + * @brief Calculates the truth value of NOT x element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_NOT. + * + * Input: + * + * * x, tensor of type boolean or convert to boolean implicitly. + * + * Output: + * + * * A tensor of type bool with the shape of x. + * + * @since 5.0 + * @version 2.1 + */ +struct LogicalNot +{ +}; + +/** + * @brief Calculates the truth value of x1 OR x2 element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_OR. + * + * Input: + * + * * x1, tensor of type boolean or convert to boolean implicitly. + * * x2, tensor of type boolean or convert to boolean implicitly. + * + * Output: + * + * * A tensor of type bool with the shape that x1 and x2 broadcast to. + * + * @since 5.0 + * @version 2.1 + */ +struct LogicalOr +{ +}; + +/** + * @brief Normalize over local input regions. + * + * The {@link NodeType} of this operator is NODE_TYPE_LRN. + * + * Input: + * + * * x, input tensor of n-dimensional. + * + * Output: + * + * * Result output tensor. + * + * @since 5.0 + * @version 2.1 + */ +struct LRN +{ + /** Half-width of the 1-dimension normalization window. */ + long depthRadius; + /** Offset. */ + float bias; + /** Scale factor. */ + float alpha; + /** Exponent. */ + float beta; + /** Specifies normalization region. Options: "ACROSS_CHNNEL". */ + string normRegion; +}; + +/** + * @brief Calculate the L2-normalize of the input using the given axis. + * + * The {@link NodeType} of this operator is NODE_TYPE_L2_NORMALIZE_FUSION. + * + * Input: + * + * * x, input to compute the L2-normalization. + * + * Output: + * + * * Result tensor with the same type and shape as input x. + * + * @since 5.0 + * @version 2.1 + */ +struct L2NormalizeFusion +{ + /** The axis on which to apply normalization, -1 means last axis, default: 0.*/ + long[] axis; + /** Value added for numerical stability. default: 1e-4; */ + float epslion; + /** Activation function type. For details, see {@link ActivationType}. */ + enum ActivationType activationType; +}; + /** * @brief Computes an one-layer LSTM. This operator is usually supported via some custom implementation. * @@ -1054,7 +1400,7 @@ struct MatMulFusion * * Output: * - /** Maximum value of the elements of the two tensors. + * * Maximum value of the elements of the two tensors. * * @since 3.2 * @version 2.1 @@ -1077,7 +1423,7 @@ struct Maximum * * Output: * - /** Maximum value of the elements of the two tensors. + * * Result tensor after max-pooling. * * @since 3.2 * @version 2.1 @@ -1104,6 +1450,60 @@ struct MaxPoolFusion enum ActivationType activationType; }; +/** + * @brief Calculates the minimum of x1 and x2 element-wise. The inputs of x1 and x2\n + * comply with the implicit type conversion rules to make the data types are consistent. + * + * The input must be two tensors or one tensor and one scalar. When the input is two tensors, the data types\n + * cannot be Boolean at the same time, and their shapes can be broadcast to the same size. When the inputs are\n + * one tensor and one scalar, the scalar must be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_MINIMUM. + * + * Input: + * + * * x1, an n-dimensional tensor, whose data type can be number or Boolean. + * * x2, an n-dimensional tensor, whose data type can be number or Boolean. + * + * Output: + * + * * Minimum value of the elements of the two tensors. + * + * @since 5.0 + * @version 2.1 + */ +struct Minimum +{ +}; + +/** + * @brief Computes the remainder of dividing the first input tensor by the second input tensor element-wise. + * + * Inputs of x and y comply with the implicit type conversion rules to make the data types consistent. + * The inputs must be two tensors or one tensor and one scalar. When the inputs are two tensors, + * both dtypes cannot be bool, and the shapes of them could be broadcast. + * When the inputs are one tensor and one scalar, the scalar could only be a constant. + * + * The {@link NodeType} of this operator is NODE_TYPE_MOD. + * + * Input: + * + * * x, a number, a bool or a tensor whose data type is number. + * * y, if input x is a tensor, y could be a number, a bool or a tensor whose data type is number. + * * If input x is a number or a bool, y must be a tensor whose data type is number. + * + * Output: + * + * * Result tensor, the shape is the same as the one after broadcasting, and the data type is the one with\n + higher precision or higher digits among the two inputs. + * + * @since 5.0 + * @version 2.1 + */ +struct Mod +{ +}; + /** * @brief Multiplies the elements in the same position of x1 and x2 to obtain output. * @@ -1129,6 +1529,26 @@ struct MulFusion enum ActivationType activationType; }; +/** + * @brief Returns a tensor with negative values of the input tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_NEG. + * + * Input: + * + * * x, a tensor of the int or float type. + * + * Output: + * + * * Result tensor, has the same shape and dtype as input x. + * + * @since 5.0 + * @version 2.1 + */ +struct Neg +{ +}; + /** * @brief Returns the tensor resulted from performing the not_equal logical operation elementwise\n * on the input tensors x1 and x2. @@ -1185,7 +1605,6 @@ struct OneHot * When axis is 0, the shape of the output is [D, N, C]. * When axis is -1, the shape of the output is [N, C, D]. * When axis is -1, the shape of the output is [N, D, C]. - * */ long axis; }; @@ -1324,6 +1743,28 @@ struct QuantDTypeCast long dstT; }; +/** + * @brief Calculate the rank of a tensor. + * + * The rank of a tensor is the number of indices required to uniquely select each element of the tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_RANK. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result tensor. 0-D int32 Tensor representing the rank of input. + * + * @since 5.0 + * @version 2.1 + */ +struct Rank +{ +}; + /** * @brief Generate a tensor containing a sequence of numbers that begin at start\n * and extends by increments of delta up to limit. @@ -1332,7 +1773,7 @@ struct QuantDTypeCast * * Input: * - * * None. + * * x an n-dimensional tensor. * * Output: * @@ -1343,7 +1784,7 @@ struct QuantDTypeCast */ struct Range { - /** Expected output data type. */ + /** Reserved dataType parameter. */ long d_type; /** Scalar. First entry for the range of output values. */ long start; @@ -1353,6 +1794,26 @@ struct Range long delta; }; +/** + * @brief Calculate reciprocal of a tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_RECIPROCAL. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result tensor with the same shape as the input x. + * + * @since 5.0 + * @version 2.1 + */ +struct Reciprocal +{ +}; + /** * @brief Return x / y element-wise for real types. If x and y are reals, this will return floating-point division. * @@ -1484,6 +1945,26 @@ struct Resize enum NearestMode nearestMode; }; +/** + * @brief Calculate half to even of a tensor element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_ROUND. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result tensor with the same shape as the input x. + * + * @since 5.0 + * @version 2.1 + */ +struct Round +{ +}; + /** * @brief Calculates the reciprocal of the square root of a tensor. * @@ -1531,6 +2012,29 @@ struct ScaleFusion enum ActivationType activationType; }; +/** + * @brief Scatters a tensor into a new tensor depending on the specified indices. + * + * The {@link NodeType} of this operator is NODE_TYPE_SCATTER_ND. + * + * Input: + * + * * indices, the index of scattering in the new tensor with int32 or int64 data type. + * * The rank of indices must be at least 2 and indices_shape[-1] <= len(shape). + * * updates, the source tensor to be scattered. It has shape indices_shape[:-1] + shape[indices_shape[-1]:]. + * * shape, the shape of the output tensor, has the same data type as indices. + * + * Output: + * + * * Result tensor with the same type as update and the same shape as shape. + * + * @since 5.0 + * @version 2.1 + */ +struct ScatterNd +{ +}; + /** * @brief Returns the share of the input tensor. * @@ -1551,6 +2055,26 @@ struct Shape { }; +/** + * @brief Calculate sine of the input element-wise. + * + * The {@link NodeType} of this operator is NODE_TYPE_SIN. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Result tensor with the same shape as the input x. + * + * @since 5.0 + * @version 2.1 + */ +struct Sin +{ +}; + /** * @brief Slices a tensor of the specified size. * @@ -1631,6 +2155,58 @@ struct SpaceToBatchND long[][] paddings; }; +/** + * @brief Rearrange blocks of spatial data into depth. + * + * The output tensor’s height dimension is height / blocksize; + * The output tensor’s weight dimension is weight / blocksize; + * The depth of output tensor is blocksize * blocksize * inputDepth; + * The input tensor’s height and width must be divisible by blocksize. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPACE_TO_DEPTH. + * + * Input: + * + * * x, an 4-dimensional tensor. + * + * Output: + * + * * Result tensor with the same data_type as the input x. + * + * @since 5.0 + * @version 2.1 + */ +struct SpaceToDepth +{ + /** The block size used to divide spatial data. It must be >= 2. */ + long blocksize; + /** Format of the tensor data. For details, see {@link Format}. */ + enum Format format; +}; + +/** + * @brief Converts a sparse representation into a dense tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_SPARSE_TO_DENSE. + * + * Input: + * + * * indices, 2-dimension tensor, represents the position of the element in the sparse tensor. + * * values, 1-dimension Tensor, represents the value corresponding to the position in the indices. + * * sparseShape, a positive int tuple which specifies the shape of sparse tensor, + * * should have 2 elements, represent sparse tensor shape is (N, C). + * + * Output: + * + * * Result tensor converted from sparse tensor with dtype samed as values, and the shape is sparseShape. + * + * @since 5.0 + * @version 2.1 + */ +struct SparseToDense +{ +}; + /** * @brief Splits a tensor into multiple tensors along the axis dimension. The number of tensors is * specified by outputNum. @@ -2004,6 +2580,28 @@ struct Unstack long axis; }; +/** + * @brief Selects elements from x1 or x2 based on condition and returns a tensor. + * + * The {@link NodeType} of this operator is NODE_TYPE_WHERE. + * + * Input: + * + * * condition, A Tensor of type bool. + * * x1, a tensor which may have the same shape as condition. + * * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. + * * x2, a tensor with the same data type and shape as x1. + * Output: + * + * * Tensor output. Has the same shape as x1. + * + * @since 5.0 + * @version 2.1 + */ +struct Where +{ +}; + /** * @brief Selects elements from x1 or x2, depending on condition. * The x1 and x2 tensors must all have the same shape, and the output will also have that shape. @@ -2052,4 +2650,28 @@ struct Erf { }; +/** + * @brief Computes the log-softmax function to n-dimensional input tensor. + * + * The input is transformed by the Softmax function and then by the log function to lie in range[-inf,0). + * + * The {@link NodeType} of this operator is NODE_TYPE_LOG_SOFTMAX. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor output. Has the same data type and shape as x. + * + * @since 5.0 + * @version 2.1 + */ +struct LogSoftmax +{ + /** The axis to apply LogSoftmax operation, -1 means the last dimension. */ + long axis; +}; + /** @} */ -- Gitee From 07f73fddfe980aea578ed317e0a0d7c1da354bb2 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 20 Feb 2024 14:56:52 +0800 Subject: [PATCH 034/210] fix build bug Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 6d8f751c..64e669a8 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -151,7 +151,7 @@ struct All { /** Whether to keep dimension info. */ long keepDims; -} +}; /** * @brief Obtains the first K indices or values of a cross-axis tensor. @@ -206,7 +206,7 @@ struct Assert { /** Print this many entries of each tensor. */ long summarize; -} +}; /** * @brief Applies a 2D average pooling on the input tensor. The int8 quantization input is supported. @@ -678,9 +678,9 @@ struct DetectionPostProcess /** Number of target classes to be detected. */ long numClasses; /** Whether use NMS based on IoU threshold. */ - bool useRegularNms; + boolean useRegularNms; /** Whether need to quantize. */ - bool outQuantized; + boolean outQuantized; }; /** @@ -1272,7 +1272,7 @@ struct LRN /** Exponent. */ float beta; /** Specifies normalization region. Options: "ACROSS_CHNNEL". */ - string normRegion; + String normRegion; }; /** -- Gitee From 103d89fd308c107f969dfcb234d3b3f507f21554 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 20 Feb 2024 19:31:15 +0800 Subject: [PATCH 035/210] fix vension of all-op Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 64e669a8..a5ec30e2 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -144,7 +144,7 @@ struct AddFusion * * * First K indices or values before the maximum input tensor on the axis. * - * @since 3.2 + * @since 5.0 * @version 2.1 */ struct All -- Gitee From 30875caa0b6c7cd52e64143d4dfcba534fd64e6a Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 20 Feb 2024 21:27:21 +0800 Subject: [PATCH 036/210] fix codecheck Signed-off-by: maoyong --- nnrt/v2_1/INnrtDevice.idl | 7 +- nnrt/v2_1/IPreparedModel.idl | 22 ++--- nnrt/v2_1/NodeAttrTypes.idl | 155 ++++++++++++++++++----------------- 3 files changed, 95 insertions(+), 89 deletions(-) diff --git a/nnrt/v2_1/INnrtDevice.idl b/nnrt/v2_1/INnrtDevice.idl index 22fc5822..796fe6d6 100644 --- a/nnrt/v2_1/INnrtDevice.idl +++ b/nnrt/v2_1/INnrtDevice.idl @@ -92,7 +92,7 @@ interface INnrtDevice { GetDeviceType([out] enum DeviceType deviceType); /** - * @brief Obtains the device status. + * @brief Obtains the device status. * * @param deviceType Device status. For details, see {@link DeviceStatus}. * @@ -212,7 +212,8 @@ interface INnrtDevice { * are passed by the inference framework to the NNRt module and then parsed by the NNRt module. * * @param offlineModels Array of offline model files. The sequence of array elements depends on the format of\n - * the input offline model. For details about the element types, see the definition of SharedBuffer {@link SharedBuffer}. + * the input offline model. For details about the element types, see the definition of SharedBuffer\n + * {@link SharedBuffer}. * @param config Configuration for loading the offline model files. For details, see {@link ModelConfig}. * @param preparedModel Model object obtained. For details, see {@link IPreparedModel}. * @@ -238,7 +239,7 @@ interface INnrtDevice { AllocateBuffer([in] unsigned int length, [out] struct SharedBuffer buffer); /** - * @brief Releases the shared memory. + * @brief Releases the shared memory. * * @param buffer Information about the shared memory allocated, including the file descriptor and size.\n * For details, see {@link SharedBuffer}. diff --git a/nnrt/v2_1/IPreparedModel.idl b/nnrt/v2_1/IPreparedModel.idl index dd379d1c..bbaadcdd 100644 --- a/nnrt/v2_1/IPreparedModel.idl +++ b/nnrt/v2_1/IPreparedModel.idl @@ -55,26 +55,28 @@ interface IPreparedModel { * @brief Exports an AI model from the cache. * * @param modelCache Array of the model files, which are in the same sequence as they exported.\n - *For details, see {@link SharedBuffer}. + * For details, see {@link SharedBuffer}. * * @return Returns 0 if the operation is successful. * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n - *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ ExportModelCache([out] struct SharedBuffer[] modelCache); /** * @brief Obtains the tensor dimension range supported by AI model. If a fixed dimension is used,\n - *the maximum dimension value is the same as the minimum dimension value. + * the maximum dimension value is the same as the minimum dimension value. * * @param minInputDims Two-dimensional array that stores the minimum dimension of the model input data.\n - *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * The first dimension of the array indicates the number of tensors, and the second dimension indicates\n + * the number of dimensions of the tensors. * @param maxInputDims Two-dimensional array that stores the maximum dimension of the model input data.\n - *The first dimension of the array indicates the number of tensors, and the second dimension indicates the number of dimensions of the tensors. + * The first dimension of the array indicates the number of tensors, and the second dimension indicates\n + * the number of dimensions of the tensors. * * @return Returns 0 if the operation is successful. * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n - *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ GetInputDimRanges([out] unsigned int[][] minInputDims, [out] unsigned int[][] maxInputDims); @@ -82,16 +84,16 @@ interface IPreparedModel { * @brief Performs AI model inference. * * @param inputs Input data for AI model inference. The data is input in the sequence defined by the model.\n - *For details about the input data type, see {@link IOTensor}. + * For details about the input data type, see {@link IOTensor}. * @param outputs Output data of AI model inference. After inference, the output data is written to the\n - *shared buffer. For details about the output data type, see {@link IOTensor}. + * shared buffer. For details about the output data type, see {@link IOTensor}. * @param outputDims Dimensions of the output data. The output sequence is the same as that of outputs. * @param isOutputBufferEnough Whether the shared buffer space is sufficient for the output data.\n - *The value true means the shared buffer space is sufficient; the value false means the opposite. + * The value true means the shared buffer space is sufficient; the value false means the opposite. * * @return Returns 0 if the operation is successful. * @return Returns a non-0 value if the operation fails. A negative value is an HDF standard error code,\n - *and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. + * and a positive value is a dedicated error code defined by NNRt. For details, see {@link NNRT_ReturnCode}. */ Run([in] struct IOTensor[] inputs, [in] struct IOTensor[] outputs, [out] int[][] outputDims); } diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index a5ec30e2..8dca67dc 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -90,15 +90,15 @@ struct Abs */ struct Activation { -/** Activation function type. */ + /** Activation function type. */ enum ActivationType activationType; -/** Size factor, used for the LeakyReLU and ELU activation functions. */ + /** Size factor, used for the LeakyReLU and ELU activation functions. */ float alpha; -/** Minimum value, used for the HardTanh activation function. */ + /** Minimum value, used for the HardTanh activation function. */ float minVal; -/** Maximum value, used for the HardTanh activation function. */ + /** Maximum value, used for the HardTanh activation function. */ float maxVal; -/** Whether to use the approximation algorithm. It is used for the GRLU activation function. */ + /** Whether to use the approximation algorithm. It is used for the GRLU activation function. */ boolean approximate; }; @@ -240,9 +240,10 @@ struct AvgPoolFusion * The first number indicates the moving size in height, and the second number indicates the moving size in width. */ long[] strides; - /** x is padded with an int array [top, bottom, left, right] with length of 4, and the nearest neighbor values\n - * are used for padding. - */ + /** + * x is padded with an int array [top, bottom, left, right] with length of 4, and the nearest neighbor values\n + * are used for padding. + */ long[] pad; /** Padding method. */ enum PadMode padMode; @@ -448,9 +449,10 @@ struct Conv2DFusion { /** Size (height and width) of the convolution kernel. */ long[] kernelSize; - /** Movement stride of the convolution kernel in height and weight.\n - * It is an int array [strideHeight, strideWidth] with length of 2. - */ + /** + * Movement stride of the convolution kernel in height and weight.\n + * It is an int array [strideHeight, strideWidth] with length of 2. + */ long[] stride; /** * Dilation size of the convolution kernel in height and weight. It is an int array in the format of\n @@ -460,9 +462,10 @@ struct Conv2DFusion long[] dilation; /** Padding mode. For details, see {@link PadMode}. */ enum PadMode padMode; - /** Padding around x in the height and width directions. It is an int array [top, bottom, left, right]\n - * with length of 4. - */ + /** + * Padding around x in the height and width directions. It is an int array [top, bottom, left, right]\n + * with length of 4. + */ long[] padList; /** * Splits x into groups by inChannel. The group value is of the int type. @@ -492,11 +495,11 @@ struct Conv2DFusion * * * x, a 4D tensor in NHWC format. * * weight, a convolution weight in [outChannel, kernelHeight, kernelWidth, inChannel/group] format. - * * The value of inChannel divided by groupmust be an integer. + * The value of inChannel divided by groupmust be an integer. * * bias: bias of the convolution. It is an array with a length of [outChannel].\n - * * In the quantization scenario, bias does not need to be quantized. - * * If quantization is required, the input data must be of the int32 type. - * * The actual quantization parameter is determined by x and weight. + * In the quantization scenario, bias does not need to be quantized. + * If quantization is required, the input data must be of the int32 type. + * The actual quantization parameter is determined by x and weight. * * Output: * @@ -649,10 +652,10 @@ struct CustomNormalize * * Output: * - * * image_id. - * * label. - * * confidence. - * * coordinates. + * * image_id, the image ID of target detected bboxes. + * * label, the label of target detected bboxes. + * * confidence, the score of target detected bboxes. + * * coordinates, the coordinate of target detected bboxes. * * @since 5.0 * @version 2.1 @@ -700,7 +703,7 @@ struct DetectionPostProcess * Output: * * * Output tensor of [N, H * blocksize, W * blocksize, C/(blocksize * blocksize)] for NHWC format\n - * * or [N, C/(blocksize * blocksize), H * blocksize, W * blocksize] for NCHW format. + * or [N, C/(blocksize * blocksize), H * blocksize, W * blocksize] for NCHW format. * * @since 5.0 * @version 2.1 @@ -821,7 +824,7 @@ struct ExpFusion * * * x, an n-dimensional tensor. * * axis: index of the dimension to be added. The value is of the int32_t type and must be a constant\n - * in the range [-dim-1, dim]. + * in the range [-dim-1, dim]. * * Output: * @@ -846,8 +849,8 @@ struct ExpandDims * * Output: * - * * A 2D tensor with the contents of the input tensor, with input dimensions up to axis flattened to\n - * * the outer dimension of the output and remaining input dimensions flattened into the inner dimension of the output. + * * A 2-dimension tensor with the contents of the input tensor, with input dimensions up to axis flattened to\n + * the outer dimension of the output and remaining input dimensions flattened into the inner dimension of the output. * * @since 5.0 * @version 2.1 @@ -914,9 +917,9 @@ struct Fill * * * x, an n-dimensional tensor. * * weight: weight tensor for a full connection. - * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required.\n + * * bias, a full-connection bias. In quantization scenarios, a quantized parameter is not required. * * If quantization is required, the data must be of the int32 type. The actual quantization parameter is\n - * * determined by x and weight. + * determined by x and weight. * * Output: * @@ -950,9 +953,9 @@ struct FullConnection * * scale: 1D tensor of the scaling factor used to scale the first normalized tensor. * * offset: 1D tensor used to move to the first normalized tensor. * * mean: 1D tensor of the overall mean value. It is used only for inference. In case of training,\n - * * this parameter must be left empty. + * this parameter must be left empty. * * variance: 1D tensor used for the overall variance. It is used only for inference. In case of training,\n - * * this parameter must be left empty. + * this parameter must be left empty. * * Output: * @@ -976,7 +979,7 @@ struct FusedBatchNorm * * * x, an n-dimensional tensor. * * inputIndices, indices of elements of the original tensor. The value is an array of the int type\n - * * and must be in the range [0, x.shape[axis]). + * and must be in the range [0, x.shape[axis]). * * axis, the axis on which x is sliced. The value is an array with one element of the int32_t type. * * Output: @@ -1043,9 +1046,9 @@ struct GreaterEqual * Input: * * * x, input data tensor from the previous operator; - * * dimensions for image case are (N x C x H x W), where N is the batch size, - * * C is the number of channels, and H and W are the height and the width of the data. - * * For non image case, the dimensions are in the form of (N x C x D1 x D2 … Dn), where N is the batch size. + * Dimensions for image case are (N x C x H x W), where N is the batch size, + * C is the number of channels, and H and W are the height and the width of the data. + * For non image case, the dimensions are in the form of (N x C x D1 x D2 … Dn), where N is the batch size. * * The input 1-dimensional scale tensor of size C. * * The input 1-dimensional bias tensor of size C. * @@ -1071,7 +1074,7 @@ struct InstanceNorm * * * x, an n-dimensional tensor. * * gamma, an m-dimensional tensor. The dimensions of gamma must be the same as the shape of the part\n - * * of the input tensor to normalize. + * of the input tensor to normalize. * * beta, an m-dimensional tensor with the same shape as gamma. * * Output: @@ -1149,12 +1152,12 @@ struct Less * * * x1, which can be a number, a Boolean value, or a tensor whose data type is number or Boolean. * * x2, which can be a number or a Boolean value if x1 is a tensor; or a tensor with the data type\n - * * of number or Boolean if x1 is not a tensor. + * of number or Boolean if x1 is not a tensor. * * Output: * * * A tensor with the data type of Boolean. When a quantization model is used, the quantization parameters of\n - * * the output cannot be omitted. However, values of the quantization parameters do not affect the result. + * the output cannot be omitted. However, values of the quantization parameters do not affect the result. * * @since 3.2 * @version 2.1 @@ -1310,22 +1313,22 @@ struct L2NormalizeFusion * * * input, input tensor, shape is [seq_len, batch_size, input_size]. * * weight_ih, weight tensor of input-layer to hidden-layer, - * * shape is [num_directions* num_layers, 4 * hidden_size, input_size]. + * shape is [num_directions* num_layers, 4 * hidden_size, input_size]. * * weight_hh, weight tensor of hidden-layer to hidden-layer, - * * shape is [num_directions* num_layers, 4 * hidden_size, hidden_size]. + * shape is [num_directions* num_layers, 4 * hidden_size, hidden_size]. * * bias, bias tensor of input-layer and hidden-layer to hidden-layer, - * * shape is [num_directions* num_layers, 8 * hidden_size]. + * shape is [num_directions* num_layers, 8 * hidden_size]. * * hidden_state, init state of hidden-layer, shape is [num_directions * num_layers, batch_size, hidden_size]. * * cell_state, init state of cell, shape is [num_directions * num_layers, batch_size, hidden_size]. * * Output: * * * output, a tensor that concats all the intermediate output tensor of the hidden, - * * shape is [seq_len, batch_size, num_directions * real_hidden_size]. + * shape is [seq_len, batch_size, num_directions * real_hidden_size]. * * hidden_state, the last output tensor of the hidden-layer, - * * shape is [num_directions * num_layers, batch_size, real_hidden_size]. + * shape is [num_directions * num_layers, batch_size, real_hidden_size]. * * cell_state, the last output tensor of the cell, - * * shape is [num_directions * num_layers, batch_size, hidden_size]. + * shape is [num_directions * num_layers, batch_size, hidden_size]. * * @since 5.0 * @version 2.1 @@ -1367,8 +1370,8 @@ struct LSTM * Output: * * * Matrix product of the inputs. When type! When = DATA_TYPE_UNKNOWN, the data type of the output is determined by\n - * * type. When type==DATA_TYPE_UNKNOWN, - * * the data type of the output depends on the data type converted during the calculation of x1 and x2. + * type. When type==DATA_TYPE_UNKNOWN, + * the data type of the output depends on the data type converted during the calculation of x1 and x2. * * @since 3.2 * @version 2.1 @@ -1490,7 +1493,7 @@ struct Minimum * * * x, a number, a bool or a tensor whose data type is number. * * y, if input x is a tensor, y could be a number, a bool or a tensor whose data type is number. - * * If input x is a number or a bool, y must be a tensor whose data type is number. + * If input x is a number or a bool, y must be a tensor whose data type is number. * * Output: * @@ -1582,16 +1585,16 @@ struct NotEqual * Input: * * * indices, an n-dimensional tensor. Each element in indices determines the location of on_value\n - * * in each one-hot vector. + * in each one-hot vector. * * depth, an integer scalar that determines the depth of the one-hot vector. The value of depth must be\n - * * greater than 0. + * greater than 0. * * on_value, a scalar that specifies a valid value in the one-hot vector. * * off_value, a scalar that specifies the values of other locations in the one-hot vector except the valid value. * * Output: * * * An (n+1)-dimensional tensor if indices is an n-dimensional tensor. The output shape is determined by\n - * * indices and axis. + * indices and axis. * * @since 3.2 * @version 2.1 @@ -1621,14 +1624,14 @@ struct OneHot * * * x, an n-dimensional tensor. * * paddings, a 2D tensor that specifies the length to add in each dimension. - * * The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input - * * tensor in ith dimension. + * The shape is [n, 2]. paddings[i][0] indicates the number of paddings to add before the input\n + * tensor in ith dimension. * * paddings[i][1] indicates the number of paddings to add after the input tensor in ith dimension. * * Output: * * * An n-dimensional tensor after padding, with the same dimensions and data type as x. - * * The shape is determined by x and paddings. + * The shape is determined by x and paddings. * output.shape[i] = input.shape[i] + paddings[i][0]+paddings[i][1] * * @since 3.2 @@ -1644,7 +1647,7 @@ struct PadFusion */ long[][] paddings; /** - * Padding mode. + * Padding mode. * For details, see {@link PaddingMode}. */ enum PaddingMode paddingMode; @@ -1696,9 +1699,9 @@ struct PowFusion * Input: * * * x, an n-dimensional tensor. If n is greater than or equal to 2, x must be - * * [BatchSize, ..., Channels]. The second dimension is the number of channels. + * [BatchSize, ..., Channels]. The second dimension is the number of channels. * * weight, a 1D tensor. The length of weight must be 1 or equal to the number of channels. - * * If the length of weight is 1, all channels share the same weight. + * If the length of weight is 1, all channels share the same weight. * If the length of weight is equal to the number of channels, each channel exclusively has a weight. * If n of x is less than 2, the weight length must be 1. * @@ -1846,12 +1849,12 @@ struct RealDiv * * * x, an n-dimensional tensor, where n is less than 8. * * axis, a 1D tensor that specifies the dimension to reduce. The value range of each element in axis - * * is [–n, n). + * is [–n, n). * * Output: * * * An m-dimensional tensor, with the same data type as x. If keepDims is false, m < n. - * * If keepDims is true, m==n. + * If keepDims is true, m==n. * * @since 3.2 * @version 2.1 @@ -1999,7 +2002,7 @@ struct Rsqrt * Output: * * * An n-dimensional tensor scaled, whose data type is the same as that of xx and shape is determined - * * by axis. + * by axis. * * @since 3.2 * @version 2.1 @@ -2020,7 +2023,7 @@ struct ScaleFusion * Input: * * * indices, the index of scattering in the new tensor with int32 or int64 data type. - * * The rank of indices must be at least 2 and indices_shape[-1] <= len(shape). + * The rank of indices must be at least 2 and indices_shape[-1] <= len(shape). * * updates, the source tensor to be scattered. It has shape indices_shape[:-1] + shape[indices_shape[-1]:]. * * shape, the shape of the output tensor, has the same data type as indices. * @@ -2085,7 +2088,7 @@ struct Sin * * x, an n-dimensional tensor. * * begin, an array of integers greater than or equal to 0, specifying the start of the slice. * * size, an array of integers greater than or equal to 0, specifying the length of the slice. - * * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. + * Assume that a dimension is i and 1<=size[i]<=input.shape[i]-begin[i]. * * Output: * @@ -2112,7 +2115,7 @@ struct SliceFusion * Output: * * * Result of the softmax operation. It is an n-dimensional tensor with the same data type and shape - * * as x. + * as x. * * @since 3.2 * @version 2.1 @@ -2194,7 +2197,7 @@ struct SpaceToDepth * * indices, 2-dimension tensor, represents the position of the element in the sparse tensor. * * values, 1-dimension Tensor, represents the value corresponding to the position in the indices. * * sparseShape, a positive int tuple which specifies the shape of sparse tensor, - * * should have 2 elements, represent sparse tensor shape is (N, C). + * should have 2 elements, represent sparse tensor shape is (N, C). * * Output: * @@ -2220,7 +2223,7 @@ struct SparseToDense * Output: * * * An array of n-dimensional tensors, with the same data type and dimensions. - * * The data type of each tensor is the same as that of x. + * The data type of each tensor is the same as that of x. * * @since 3.2 * @version 2.1 @@ -2294,7 +2297,7 @@ struct Square * Output: * * * A tensor obtained. The shape of the output is determined by x and y. - * * If x and y are of the same shape, the output shape is the same as that of x and y. + * If x and y are of the same shape, the output shape is the same as that of x and y. * If x and y are of different types, you need to perform the broadcast operation on * x and y first. * The precision of the output is the same as the input tensor with higher precision. @@ -2367,11 +2370,11 @@ struct Stack * * * x, an n-dimensional tensor. * * begin, a 1D tensor that specifies the position from which the tensor is sliced. - * * The length of begin is n. begin[i] specifies the start point to slice in the ith dimension. + * The length of begin is n. begin[i] specifies the start point to slice in the ith dimension. * * end, a 1D tensor that specifies the end to which the tensor is sliced. The length of end is n. - * * end[i] specifies the end point to slice in the ith dimension. + * end[i] specifies the end point to slice in the ith dimension. * * strides, a 1D tensor that specifies the intervals for slicing. The length of strides is n. - * * strides[i] specifies the intervals at which the tensor is sliced in the ith dimension. Negative values are allowed. + * strides[i] specifies the intervals at which the tensor is sliced in the ith dimension. Negative values are allowed. * * For the input tensor, the shapes of begin, end, and strides must be the same. * The indices of begin and end start from 0. The elements of strides cannot be 0. @@ -2456,16 +2459,16 @@ struct SubFusion * * * x, an n-dimensional tensor. * * multiples, a 1D tensor that specifies the number of times that the input tensor is copied - * * in each dimension. - * * The length m is not less than the number of dimensions of x. + * in each dimension. + * * The length multiples is not less than the number of dimensions of x. * * Output: * * * An m-dimensional tensor, with the same data type as x. If the length of x is the same as that of - * * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, - * * an n-dimensional tensor is output. - * * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. - * * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. + * multiples, the number of dimensions of the output tensor is the same as that of the x, that is, + * an n-dimensional tensor is output. + * If the length of multiples is greater than n, 1s are used to pad the dimensions of x. + * Then, x is copies the specified number of times in each dimension to obtain an m-dimensional tensor. * * @since 3.2 * @version 2.1 @@ -2519,7 +2522,7 @@ struct TopKFusion * Output: * * * An n-dimensional tensor, which has the same data type and quantization parameters as x. - * * The shape is determined by the shape of x and perm. + * The shape is determined by the shape of x and perm. * * @since 3.2 * @version 2.1 @@ -2589,7 +2592,7 @@ struct Unstack * * * condition, A Tensor of type bool. * * x1, a tensor which may have the same shape as condition. - * * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. + * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. * * x2, a tensor with the same data type and shape as x1. * Output: * @@ -2617,7 +2620,7 @@ struct Where * * * condition, A Tensor of type bool. * * x1, a tensor which may have the same shape as condition. - * * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. + * If condition is rank 1, x1 may have higher rank, but its first dimension must match the size of condition. * * x2, a tensor with the same data type and shape as x1. * Output: * -- Gitee From 2485be7a53bafe126f00805eaca7da3ee29647c6 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 20 Feb 2024 21:33:44 +0800 Subject: [PATCH 037/210] add description for unstack para Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 8dca67dc..7fd22e23 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -2580,6 +2580,7 @@ struct Unsqueeze */ struct Unstack { + /** The specific axis to apply unstack operation. */ long axis; }; -- Gitee From bfd6906428f0ab8ea6858b531ad0fb593f3d87ea Mon Sep 17 00:00:00 2001 From: zhongning5 Date: Wed, 21 Feb 2024 15:54:43 +0800 Subject: [PATCH 038/210] add platformsdk tags Signed-off-by: zhongning5 --- codec/image/v1_0/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/codec/image/v1_0/BUILD.gn b/codec/image/v1_0/BUILD.gn index e4e095fc..9d96c318 100644 --- a/codec/image/v1_0/BUILD.gn +++ b/codec/image/v1_0/BUILD.gn @@ -26,6 +26,7 @@ if (defined(ohos_lite)) { "ICodecImage.idl", ] language = "cpp" + innerapi_tags = [ "platformsdk" ] subsystem_name = "hdf" part_name = "drivers_interface_codec" } -- Gitee From 4baf204180ee17b48aa8aab1b81ce7feff73be8e Mon Sep 17 00:00:00 2001 From: liufeng Date: Wed, 21 Feb 2024 18:41:12 +0800 Subject: [PATCH 039/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=88=E4=BA=AE?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/include/camera_device_ability_items.h | 3 +++ camera/metadata/include/camera_metadata_item_info.h | 6 ++++++ camera/metadata/src/camera_metadata_info.cpp | 3 +++ 3 files changed, 12 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 8e4659ed..405009bb 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -106,6 +106,9 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_NIGHT_MODE_SUPPORTED_EXPOSURE_TIME, OHOS_CAMERA_MESURE_EXPOSURE_TIME, OHOS_CAMERA_EXPOSURE_MODE_PREVIEW_STATE, + OHOS_ABILITY_MOON_CAPTURE_BOOST, + OHOS_CONTROL_MOON_CAPTURE_BOOST, + OHOS_STATUS_MOON_CAPTURE_DETECTION, OHOS_CAMERA_USER_ID, OHOS_CAMERA_PROPERTIES_END, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 904912dc..28176d38 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -74,6 +74,12 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"cameraExposureModePreviewState", META_TYPE_BYTE, 1}, [OHOS_ABILITY_AVAILABLE_COLOR_SPACES - OHOS_CAMERA_PROPERTIES_START] = {"availableColorSpaces", META_TYPE_INT32, -1}, + [OHOS_ABILITY_MOON_CAPTURE_BOOST - + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMoonCaptureBoost", META_TYPE_UINT32, 1}, + [OHOS_CONTROL_MOON_CAPTURE_BOOST - + OHOS_CAMERA_PROPERTIES_START] = {"cameraControlMoonCaptureBoost", META_TYPE_UINT32, 1}, + [OHOS_STATUS_MOON_CAPTURE_DETECTION - + OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusMoonCaptureDetection", META_TYPE_UINT32, 1}, [OHOS_CAMERA_USER_ID - OHOS_CAMERA_PROPERTIES_START] = {"cameraUserId", META_TYPE_INT32, -1}, }; diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 63a873da..f1671aa3 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -39,6 +39,9 @@ const std::vector g_metadataTags = { OHOS_ABILITY_SKETCH_ENABLE_RATIO, OHOS_ABILITY_SKETCH_REFERENCE_FOV_RATIO, OHOS_ABILITY_AVAILABLE_COLOR_SPACES, + OHOS_ABILITY_MOON_CAPTURE_BOOST, + OHOS_CONTROL_MOON_CAPTURE_BOOST, + OHOS_STATUS_MOON_CAPTURE_DETECTION, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, -- Gitee From 3ce898f9054e7210bae2999b34a6cc1dd63ff703 Mon Sep 17 00:00:00 2001 From: lwx1281857 Date: Thu, 22 Feb 2024 09:56:28 +0800 Subject: [PATCH 040/210] Description: repair api description Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: lwx1281857 --- sensor/v1_0/ISensorCallback.idl | 1 + sensor/v1_1/ISensorCallback.idl | 1 + sensor/v2_0/ISensorCallback.idl | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sensor/v1_0/ISensorCallback.idl b/sensor/v1_0/ISensorCallback.idl index 72c4aebb..db27e9cf 100644 --- a/sensor/v1_0/ISensorCallback.idl +++ b/sensor/v1_0/ISensorCallback.idl @@ -41,6 +41,7 @@ import ohos.hdi.sensor.v1_0.SensorTypes; [callback] interface ISensorCallback { /** * @brief Defines the function for reporting sensor data. + * @param event Indicates the information about sensor event in the system. * * @since 2.2 */ diff --git a/sensor/v1_1/ISensorCallback.idl b/sensor/v1_1/ISensorCallback.idl index fcf6add5..10743fe7 100755 --- a/sensor/v1_1/ISensorCallback.idl +++ b/sensor/v1_1/ISensorCallback.idl @@ -41,6 +41,7 @@ import ohos.hdi.sensor.v1_1.SensorTypes; [callback] interface ISensorCallback { /** * @brief Defines the function for reporting sensor data. + * @param event Indicates the information about sensor event in the system. * * @since 2.2 */ diff --git a/sensor/v2_0/ISensorCallback.idl b/sensor/v2_0/ISensorCallback.idl index 2e7f3fc6..226849bc 100644 --- a/sensor/v2_0/ISensorCallback.idl +++ b/sensor/v2_0/ISensorCallback.idl @@ -40,7 +40,8 @@ import ohos.hdi.sensor.v2_0.SensorTypes; */ [callback] interface ISensorCallback { /** - * @brief Defines the function for reporting sensor data. + * @brief Defines the function for reporting sensor data. + * @param event Indicates the information about sensor event in the system. * * @since 2.2 */ -- Gitee From fe15f4d600b19066f587d0df0900577a8e1ae643 Mon Sep 17 00:00:00 2001 From: lixiangran Date: Tue, 30 Jan 2024 22:07:56 +0800 Subject: [PATCH 041/210] fix code Signed-off-by: lixiangran Change-Id: I4ffc808769b5019265b00a6626647eb469cf67d4 --- user_auth/bundle.json | 29 ++++++++- user_auth/v1_3/BUILD.gn | 25 ++++++++ user_auth/v1_3/IUserAuthInterface.idl | 84 +++++++++++++++++++++++++++ user_auth/v1_3/UserAuthTypes.idl | 54 +++++++++++++++++ 4 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 user_auth/v1_3/BUILD.gn create mode 100644 user_auth/v1_3/IUserAuthInterface.idl create mode 100644 user_auth/v1_3/UserAuthTypes.idl diff --git a/user_auth/bundle.json b/user_auth/bundle.json index 4b7b31f4..fe9f25df 100644 --- a/user_auth/bundle.json +++ b/user_auth/bundle.json @@ -1,7 +1,7 @@ { "name": "@ohos/drivers_interface_user_auth", "description": "user_auth device driver", - "version": "4.1", + "version": "5.0", "license": "Apache License 2.0", "publishAs": "code-segment", "segment": { @@ -26,7 +26,8 @@ }, "build": { "sub_component": [ - "//drivers/interface/user_auth/v1_2:user_auth_idl_target" + "//drivers/interface/user_auth/v1_2:user_auth_idl_target", + "//drivers/interface/user_auth/v1_3:user_auth_idl_target" ], "test": [ ], @@ -54,6 +55,30 @@ ], "header_base": "//drivers/interface/user_auth" } + }, + { + "name": "//drivers/interface/user_auth/v1_3:libuser_auth_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/user_auth" + } + }, + { + "name": "//drivers/interface/user_auth/v1_3:user_auth_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interfaces/user_auth" + } + }, + { + "name": "//drivers/interface/user_auth/v1_3:libuser_auth_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/user_auth" + } } ] } diff --git a/user_auth/v1_3/BUILD.gn b/user_auth/v1_3/BUILD.gn new file mode 100644 index 00000000..961a31a2 --- /dev/null +++ b/user_auth/v1_3/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("user_auth") { + module_name = "drivers_peripheral_user_auth" + imports = [ "ohos.hdi.user_auth.v1_2:user_auth" ] + sources = [ + "IUserAuthInterface.idl", + "UserAuthTypes.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_user_auth" +} diff --git a/user_auth/v1_3/IUserAuthInterface.idl b/user_auth/v1_3/IUserAuthInterface.idl new file mode 100644 index 00000000..ffcc6cf1 --- /dev/null +++ b/user_auth/v1_3/IUserAuthInterface.idl @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 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 HdfUserAuth + * @{ + * + * @brief Provides APIs for the user_auth driver. + * + * The user_auth driver provides a unified interface for the user_auth service to access the user_auth driver. + * After obtaining the user_auth driver proxy, the service can call related APIs to register executors, + * manage credentials, and complete password and biometric authentication. + * @since 5.0 + */ + +/** + * @file IUserAuthInterface.idl + * + * @brief Declares the user_auth driver APIs, which can be used to register executors, + * manage credentials, and complete password and biometric authentication. + * + * @since 5.0 + */ + +package ohos.hdi.user_auth.v1_3; + +import ohos.hdi.user_auth.v1_2.UserAuthTypes; +import ohos.hdi.user_auth.v1_2.IUserAuthInterface; +import ohos.hdi.user_auth.v1_3.UserAuthTypes; + +/** + * @brief Declares the APIs of the user_auth driver. + * + * @since 5.0 + * @version 1.3 + */ +interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface { + + /** + * @brief Querying EnrolledId information. + * + * @param userId Indicates the user ID. + * @param authType Indicates the identification type. See @{AuthType}. + * @param info EnrolledId information. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.3 + */ + GetEnrolledState([in] int userId, [in] enum AuthType authType, + [out] struct EnrolledState info); + + /** + * @brief Updates the authentication result, and evaluates the result of the authentication solution. + * + * @param contextId Indicates the context index. + * @param scheduleResult Indicates the authentication result issued by the executor. + * @param info Indicates authentication result information. See {@link AuthResultInfo}. + * @param enrolledState EnrolledID information. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.3 + */ + UpdateAuthenticationResultWithEnrolledState([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct AuthResultInfo info, [out] EnrolledState enrolledState); +} +/** @} */ diff --git a/user_auth/v1_3/UserAuthTypes.idl b/user_auth/v1_3/UserAuthTypes.idl new file mode 100644 index 00000000..f2dd4aa4 --- /dev/null +++ b/user_auth/v1_3/UserAuthTypes.idl @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 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 HdfUserAuth + * @{ + * + * @brief Provides APIs for the user_auth driver. + * + * The user_auth driver provides a unified interface for the user_auth service to access the user_auth driver. + + * + * @since5.0 + */ + + /** + * @file UserAuthTypes.idl + * + * @brief Defines the enumeration values and data structures of the user_auth driver. + * + * @since 5.0 + */ + +package ohos.hdi.user_auth.v1_3; + +import ohos.hdi.user_auth.v1_2.UserAuthTypes; + +/** +* @brief Define credential enrollment ID information. +* +* @since 5.0 +* @version 1.3 +*/ +struct EnrolledState { + /** Desensitization Enrolled ID. */ + unsigned short credentialDigest; + + /** Number of Credential. */ + unsigned short credentialCount; +}; + +/** @} */ \ No newline at end of file -- Gitee From 6ab2d11ece1955164e855b043dab66f9dd4f567e Mon Sep 17 00:00:00 2001 From: lwx1281857 Date: Thu, 22 Feb 2024 11:40:29 +0800 Subject: [PATCH 042/210] Description: repair api description Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: lwx1281857 --- sensor/v1_0/ISensorCallback.idl | 1 - sensor/v1_1/ISensorCallback.idl | 1 - 2 files changed, 2 deletions(-) diff --git a/sensor/v1_0/ISensorCallback.idl b/sensor/v1_0/ISensorCallback.idl index db27e9cf..72c4aebb 100644 --- a/sensor/v1_0/ISensorCallback.idl +++ b/sensor/v1_0/ISensorCallback.idl @@ -41,7 +41,6 @@ import ohos.hdi.sensor.v1_0.SensorTypes; [callback] interface ISensorCallback { /** * @brief Defines the function for reporting sensor data. - * @param event Indicates the information about sensor event in the system. * * @since 2.2 */ diff --git a/sensor/v1_1/ISensorCallback.idl b/sensor/v1_1/ISensorCallback.idl index 10743fe7..fcf6add5 100755 --- a/sensor/v1_1/ISensorCallback.idl +++ b/sensor/v1_1/ISensorCallback.idl @@ -41,7 +41,6 @@ import ohos.hdi.sensor.v1_1.SensorTypes; [callback] interface ISensorCallback { /** * @brief Defines the function for reporting sensor data. - * @param event Indicates the information about sensor event in the system. * * @since 2.2 */ -- Gitee From 526772371f0b8583224ca2524666c0488eb01efc Mon Sep 17 00:00:00 2001 From: lwx1281857 Date: Thu, 22 Feb 2024 11:43:55 +0800 Subject: [PATCH 043/210] Description: repair api description Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: lwx1281857 --- motion/v1_1/IMotionInterface.idl | 1 - 1 file changed, 1 deletion(-) diff --git a/motion/v1_1/IMotionInterface.idl b/motion/v1_1/IMotionInterface.idl index 330ee52b..3bd8f5f8 100644 --- a/motion/v1_1/IMotionInterface.idl +++ b/motion/v1_1/IMotionInterface.idl @@ -58,7 +58,6 @@ interface IMotionInterface extends ohos.hdi.motion.v1_0.IMotionInterface { * * @param motionType Motion type. For details, see {@link HdfMotionTypeTag}. * @param data Motion wave config parameters for a trick. For details, see {@link WaveParam}. - * @param len length of data. * * @return Returns 0 if the operation is successful. * @return Returns a negative value if the operation fails. -- Gitee From f2b2b35cebd022bba3e36c4c33995c1c4c0953bf Mon Sep 17 00:00:00 2001 From: lwx1281857 Date: Thu, 22 Feb 2024 11:45:44 +0800 Subject: [PATCH 044/210] Description: repair api description Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: lwx1281857 --- motion/v1_1/IMotionInterface.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/motion/v1_1/IMotionInterface.idl b/motion/v1_1/IMotionInterface.idl index 3bd8f5f8..330ee52b 100644 --- a/motion/v1_1/IMotionInterface.idl +++ b/motion/v1_1/IMotionInterface.idl @@ -58,6 +58,7 @@ interface IMotionInterface extends ohos.hdi.motion.v1_0.IMotionInterface { * * @param motionType Motion type. For details, see {@link HdfMotionTypeTag}. * @param data Motion wave config parameters for a trick. For details, see {@link WaveParam}. + * @param len length of data. * * @return Returns 0 if the operation is successful. * @return Returns a negative value if the operation fails. -- Gitee From f2f6cbc9e04a5c979c00d8fb27d06fba7ac8248c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 22 Feb 2024 14:16:42 +0800 Subject: [PATCH 045/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- motion/v1_1/IMotionInterface.idl | 1 - 1 file changed, 1 deletion(-) diff --git a/motion/v1_1/IMotionInterface.idl b/motion/v1_1/IMotionInterface.idl index 330ee52b..3bd8f5f8 100644 --- a/motion/v1_1/IMotionInterface.idl +++ b/motion/v1_1/IMotionInterface.idl @@ -58,7 +58,6 @@ interface IMotionInterface extends ohos.hdi.motion.v1_0.IMotionInterface { * * @param motionType Motion type. For details, see {@link HdfMotionTypeTag}. * @param data Motion wave config parameters for a trick. For details, see {@link WaveParam}. - * @param len length of data. * * @return Returns 0 if the operation is successful. * @return Returns a negative value if the operation fails. -- Gitee From 3998070c41462cb91bd9e259abdf81416d14351f Mon Sep 17 00:00:00 2001 From: luzhiye Date: Thu, 22 Feb 2024 16:04:07 +0800 Subject: [PATCH 046/210] super slow motion Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 11 +++++++++++ camera/metadata/include/camera_metadata_item_info.h | 4 ++++ camera/metadata/src/camera_metadata_info.cpp | 2 ++ 3 files changed, 17 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 405009bb..2a45cd9a 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -264,6 +264,8 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, + OHOS_CONTROL_SUPER_SLOW_CHECK_AREA, + OHOS_STATUS_SUPER_SLOW_MOTION, OHOS_CAMERA_EFFECT_END, // camera secure related @@ -579,4 +581,13 @@ typedef enum camera_zoomsmooth_control_type { OHOS_CAMERA_ZOOMSMOOTH_PREPARE_ENABLE, } camera_zoomsmooth_control_type_t; +// OHOS_STATUS_SUPER_SLOW_MOTION enumeration values +typedef enum camera_super_slow_motion_stayus_type { + OHOS_CAMERA_SUPER_SLOW_MOTION_DISABLE = 0, + OHOS_CAMERA_SUPER_SLOW_MOTION_READY, + OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_DONE, + OHOS_CAMERA_SUPER_SLOW_MOTION_FINISH, + OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_START, +} camera_super_slow_motion_stayus_type_t; + #endif diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 28176d38..440b5bbd 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -295,6 +295,10 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT [OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE - OHOS_CAMERA_EFFECT_START] = {"cameraPhysicalApertureControlValue", META_TYPE_FLOAT, 1}, [OHOS_DEVICE_EXITCAMERA_EVENT - OHOS_CAMERA_EFFECT_START] = {"exitCameraEvent", META_TYPE_BYTE, 1}, + [OHOS_CONTROL_SUPER_SLOW_CHECK_AREA - + OHOS_CAMERA_EFFECT_START] = {"superSlowMotionCheckArea", META_TYPE_FLOAT, -1}, + [OHOS_STATUS_SUPER_SLOW_MOTION - + OHOS_CAMERA_EFFECT_START] = {"superSlowMotionStatus", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index f1671aa3..b5b76ac2 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -165,6 +165,8 @@ const std::vector g_metadataTags = { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, + OHOS_CONTROL_SUPER_SLOW_CHECK_AREA, + OHOS_STATUS_SUPER_SLOW_MOTION, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From ff34f17daa355f9ef11832c793adc8de5980c3d6 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Thu, 22 Feb 2024 08:34:00 +0000 Subject: [PATCH 047/210] update camera/metadata/include/camera_device_ability_items.h. Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 2a45cd9a..e93a0f60 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -582,12 +582,12 @@ typedef enum camera_zoomsmooth_control_type { } camera_zoomsmooth_control_type_t; // OHOS_STATUS_SUPER_SLOW_MOTION enumeration values -typedef enum camera_super_slow_motion_stayus_type { +typedef enum camera_super_slow_motion_status_type { OHOS_CAMERA_SUPER_SLOW_MOTION_DISABLE = 0, OHOS_CAMERA_SUPER_SLOW_MOTION_READY, OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_DONE, OHOS_CAMERA_SUPER_SLOW_MOTION_FINISH, OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_START, -} camera_super_slow_motion_stayus_type_t; +} camera_super_slow_motion_status_type_t; #endif -- Gitee From b56c83e131b0aed19e97af402e97850340af92af Mon Sep 17 00:00:00 2001 From: guoyuan Date: Wed, 21 Feb 2024 15:09:06 +0800 Subject: [PATCH 048/210] inter coex Signed-off-by: guoyuan --- wlan/bundle.json | 25 ++++++++++++++++++++ wlan/v1_3/BUILD.gn | 30 ++++++++++++++++++++++++ wlan/v1_3/IWlanInterface.idl | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 wlan/v1_3/BUILD.gn create mode 100644 wlan/v1_3/IWlanInterface.idl diff --git a/wlan/bundle.json b/wlan/bundle.json index 668b5f47..854f4104 100644 --- a/wlan/bundle.json +++ b/wlan/bundle.json @@ -28,6 +28,7 @@ "sub_component": [ "//drivers/interface/wlan/v1_1:wlan_idl_target", "//drivers/interface/wlan/v1_2:wlan_idl_target", + "//drivers/interface/wlan/v1_3:wlan_idl_target", "//drivers/interface/wlan/wpa/v1_0:wpa_idl_target", "//drivers/interface/wlan/hostapd/v1_0:hostapd_idl_target" ], @@ -82,6 +83,30 @@ "header_base": "//drivers/interface/wlan" } }, + { + "name": "//drivers/interfaceghgh/wlan/v1_3:libwpa_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/wpa/v1_3:wpa_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, + { + "name": "//drivers/interface/wlan/wpa/v1_3:libwpa_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan" + } + }, { "name": "//drivers/interface/wlan/wpa/v1_0:libwpa_proxy_1.0", "header": { diff --git a/wlan/v1_3/BUILD.gn b/wlan/v1_3/BUILD.gn new file mode 100644 index 00000000..1f28de36 --- /dev/null +++ b/wlan/v1_3/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (c) 2024 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("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libwlan_proxy_1.3") { + deps = [] + public_configs = [] + } +} else { + hdi("wlan") { + module_name = "wlan_service" + + sources = [ "IWlanInterface.idl" ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} diff --git a/wlan/v1_3/IWlanInterface.idl b/wlan/v1_3/IWlanInterface.idl new file mode 100644 index 00000000..7622b16a --- /dev/null +++ b/wlan/v1_3/IWlanInterface.idl @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file IWlanInterface.idl + * + * @brief Provides APIs to enable or disable a WLAN hotspot, scan for hotspots, connect to or disconnect from a WLAN hotspot, + * set the country code, and manage network devices. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.wlan.v1_3; + +import ohos.hdi.wlan.v1_2.IWlanInterface; + +interface IWlanInterface extends ohos.hdi.wlan.v1_2.IWlanInterface { + /** + * @brief get coex channel list. + * + * @param ifName Indicates the NIC name. + * @param parmeBuf coex channel list. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.3 + */ + GetCoexictenceChannelList([in] String ifName, [out] unsigned char[] paramBuf); +} +/** @} */ -- Gitee From 8caa38a1f8f98c26efb2320e2edb968694e7f099 Mon Sep 17 00:00:00 2001 From: liufeng Date: Fri, 23 Feb 2024 15:53:23 +0800 Subject: [PATCH 049/210] =?UTF-8?q?=E6=96=B0=E5=A2=9Etag=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/include/camera_device_ability_items.h | 8 +++++++- camera/metadata/include/camera_metadata_item_info.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index e93a0f60..a75fdfe1 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -106,10 +106,10 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_NIGHT_MODE_SUPPORTED_EXPOSURE_TIME, OHOS_CAMERA_MESURE_EXPOSURE_TIME, OHOS_CAMERA_EXPOSURE_MODE_PREVIEW_STATE, + OHOS_CAMERA_USER_ID, OHOS_ABILITY_MOON_CAPTURE_BOOST, OHOS_CONTROL_MOON_CAPTURE_BOOST, OHOS_STATUS_MOON_CAPTURE_DETECTION, - OHOS_CAMERA_USER_ID, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, @@ -575,6 +575,12 @@ typedef enum camera_macro_status_control_type { OHOS_CAMERA_MACRO_ENABLE, } camera_macro_status_control_type_t; +// OHOS_CONTROL_MOON_CAPTURE_BOOST enumeration values +typedef enum camera_moon_capture_boost_control_type { + OHOS_CAMERA_MOON_CAPTURE_BOOST_ENABLE = 0, + OHOS_CAMERA_MOON_CAPTURE_BOOST_DISABLE, +} camera_moon_capture_boost_control_type_t; + // OHOS_CONTROL_PREPARE_ZOOM enumeration values typedef enum camera_zoomsmooth_control_type { OHOS_CAMERA_ZOOMSMOOTH_PREPARE_DISABLE = 0, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 440b5bbd..4b0d3114 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -75,7 +75,7 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME [OHOS_ABILITY_AVAILABLE_COLOR_SPACES - OHOS_CAMERA_PROPERTIES_START] = {"availableColorSpaces", META_TYPE_INT32, -1}, [OHOS_ABILITY_MOON_CAPTURE_BOOST - - OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMoonCaptureBoost", META_TYPE_UINT32, 1}, + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMoonCaptureBoost", META_TYPE_UINT32, -1}, [OHOS_CONTROL_MOON_CAPTURE_BOOST - OHOS_CAMERA_PROPERTIES_START] = {"cameraControlMoonCaptureBoost", META_TYPE_UINT32, 1}, [OHOS_STATUS_MOON_CAPTURE_DETECTION - -- Gitee From ca5ef77d62fb0397df62df5d66d4169926a680b7 Mon Sep 17 00:00:00 2001 From: liuziwei Date: Thu, 22 Feb 2024 20:36:48 +0800 Subject: [PATCH 050/210] fix code Signed-off-by: liuziwei Change-Id: Ic0bfd6fc1232fed17d5db8da1fb1e0ccf241a2fe --- user_auth/v1_3/IUserAuthInterface.idl | 14 ++++++++++++++ user_auth/v1_3/UserAuthTypes.idl | 28 +++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/user_auth/v1_3/IUserAuthInterface.idl b/user_auth/v1_3/IUserAuthInterface.idl index ffcc6cf1..81a1a6ed 100644 --- a/user_auth/v1_3/IUserAuthInterface.idl +++ b/user_auth/v1_3/IUserAuthInterface.idl @@ -80,5 +80,19 @@ interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface */ UpdateAuthenticationResultWithEnrolledState([in] unsigned long contextId, [in] unsigned char[] scheduleResult, [out] struct AuthResultInfo info, [out] EnrolledState enrolledState); + + /** + * @brief Check if unlock result can be reused and return token. + * + * @param info Request information of reused unLock result. See {@link ReuseUnlockInfo}. + * @param token Authentication token. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.3 + */ + CheckReuseUnlockResult([in] struct ReuseUnlockInfo info, [out] unsigned char[] token); } /** @} */ diff --git a/user_auth/v1_3/UserAuthTypes.idl b/user_auth/v1_3/UserAuthTypes.idl index f2dd4aa4..efb6b71c 100644 --- a/user_auth/v1_3/UserAuthTypes.idl +++ b/user_auth/v1_3/UserAuthTypes.idl @@ -45,10 +45,34 @@ import ohos.hdi.user_auth.v1_2.UserAuthTypes; */ struct EnrolledState { /** Desensitization Enrolled ID. */ - unsigned short credentialDigest; - + unsigned long credentialDigest; /** Number of Credential. */ unsigned short credentialCount; }; +/** + * @brief Request information of reused unlock result. + * + * @since 5.0 + * @version 1.3 + */ +struct ReuseUnlockInfo { + /** User ID. */ + int userId; + /** Authentication trust level. */ + unsigned int authTrustLevel; + /** Authentication type. See @{AuthType}. */ + enum AuthType[] authTypes; + /** Challenge of the authentication. */ + unsigned char[] challenge; + /** Caller name. */ + String callerName; + /** Calling api version. */ + int apiVersion; + /** Valid duration of reused unlock result. */ + unsigned long reuseUnlockResultDuration; + /** Reuse unlock result mode. */ + unsigned int reuseUnlockResultMode; +}; + /** @} */ \ No newline at end of file -- Gitee From 909887b7edd235ce2fd8cd12e0dc289ee459b79c Mon Sep 17 00:00:00 2001 From: guoyuan Date: Thu, 29 Feb 2024 15:52:37 +0800 Subject: [PATCH 051/210] interface bundle.json Signed-off-by: guoyuan --- wlan/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlan/bundle.json b/wlan/bundle.json index 854f4104..4b4b14ef 100644 --- a/wlan/bundle.json +++ b/wlan/bundle.json @@ -84,7 +84,7 @@ } }, { - "name": "//drivers/interfaceghgh/wlan/v1_3:libwpa_proxy_1.3", + "name": "//drivers/interface/wlan/v1_3:libwpa_proxy_1.3", "header": { "header_files": [ ], -- Gitee From 73fa45c5c8fe0b51b313dd4dc6386400ba75b8b1 Mon Sep 17 00:00:00 2001 From: zhouge94 Date: Thu, 29 Feb 2024 19:04:51 +0800 Subject: [PATCH 052/210] add tag OHOS_CONTROL_VIDEO_DEBUG_SWITCH Signed-off-by: zhouge94 --- camera/metadata/include/camera_device_ability_items.h | 7 +++++++ camera/metadata/include/camera_metadata_item_info.h | 2 ++ camera/metadata/src/camera_metadata_info.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index a75fdfe1..71118fed 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -239,6 +239,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_VIDEO_STABILIZATION_MODES = OHOS_STREAM_VIDEO_START, OHOS_CONTROL_VIDEO_STABILIZATION_MODE, + OHOS_CONTROL_VIDEO_DEBUG_SWITCH, OHOS_STREAM_VIDEO_END, // camera effects & algorithms @@ -283,6 +284,12 @@ typedef enum camera_device_metadata_tag { OHOS_XMAGE_COLOR_MODES_END, } camera_device_metadata_tag_t; +// switch type tag enumeration values +typedef enum camera_switch_enum { + OHOS_CAMERA_SWTICH_OFF = 0, + OHOS_CAMERA_SWTICH_ON, +} camera_switch_enum_t; + // OHOS_ABILITY_CAMERA_POSITION enumeration values typedef enum camera_position_enum { OHOS_CAMERA_POSITION_FRONT = 0, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 4b0d3114..f0d08eac 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -249,6 +249,8 @@ static item_info_t g_ohosStreamVideo[OHOS_STREAM_VIDEO_END - OHOS_STREAM_VIDEO_S OHOS_STREAM_VIDEO_START] = {"videoAvailableStabilizationModes", META_TYPE_BYTE, -1}, [OHOS_CONTROL_VIDEO_STABILIZATION_MODE - OHOS_STREAM_VIDEO_START] = {"videoStabilizationMode", META_TYPE_BYTE, 1 }, + [OHOS_CONTROL_VIDEO_DEBUG_SWITCH - + OHOS_STREAM_VIDEO_START] = {"videoDebugSwitch", META_TYPE_BYTE, 1 }, }; static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT_START] { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index b5b76ac2..d67ec7bd 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -141,6 +141,7 @@ const std::vector g_metadataTags = { OHOS_ABILITY_VIDEO_STABILIZATION_MODES, OHOS_CONTROL_VIDEO_STABILIZATION_MODE, + OHOS_CONTROL_VIDEO_DEBUG_SWITCH, // camera effects & algorithms OHOS_ABILITY_SCENE_FILTER_TYPES, -- Gitee From 7224a3c9d290a4a7511140af6a2da7508c51aff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Fri, 1 Mar 2024 03:25:11 +0000 Subject: [PATCH 053/210] =?UTF-8?q?control=E6=9E=9A=E4=B8=BE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index a75fdfe1..ff855674 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -577,8 +577,8 @@ typedef enum camera_macro_status_control_type { // OHOS_CONTROL_MOON_CAPTURE_BOOST enumeration values typedef enum camera_moon_capture_boost_control_type { - OHOS_CAMERA_MOON_CAPTURE_BOOST_ENABLE = 0, - OHOS_CAMERA_MOON_CAPTURE_BOOST_DISABLE, + OHOS_CAMERA_MOON_CAPTURE_BOOST_DISABLE = 0, + OHOS_CAMERA_MOON_CAPTURE_BOOST_ENABLE, } camera_moon_capture_boost_control_type_t; // OHOS_CONTROL_PREPARE_ZOOM enumeration values -- Gitee From 9c93dca224522e986eed90ff33e8531a89ed7313 Mon Sep 17 00:00:00 2001 From: SubmarinePhantom Date: Sat, 2 Mar 2024 00:09:53 +0800 Subject: [PATCH 054/210] =?UTF-8?q?hostapd=E4=B8=B2=E8=A1=8C=E5=8C=96?= =?UTF-8?q?=E6=96=B9=E6=A1=88-drivers=5Finterface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SubmarinePhantom Change-Id: Ia57aa3fb9b3101bd8b5342f33cad86ac04b2440c --- wlan/hostapd/v1_0/IHostapdInterface.idl | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wlan/hostapd/v1_0/IHostapdInterface.idl b/wlan/hostapd/v1_0/IHostapdInterface.idl index d852c506..451328c0 100644 --- a/wlan/hostapd/v1_0/IHostapdInterface.idl +++ b/wlan/hostapd/v1_0/IHostapdInterface.idl @@ -70,6 +70,20 @@ interface IHostapdInterface { */ StartAp(); + /** + * @brief Start AP for different ifName. + * + * @param ifName Indicates the NIC name. + * @param id - ap id. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + StartApWithCmd([in] String ifName, [in] int id); + /** * @brief Stop AP. * @@ -216,6 +230,21 @@ interface IHostapdInterface { */ SetApMaxConn([in] String ifName, [in] int maxConn, [in] int id); + /** + * @brief To check the configuration information, deliver security parameters to + * the driver, and clear old AP information after set ap configuration information. + * + * @param ifName Indicates the NIC name. + * @param id - ap id. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + ReloadApConfigInfo([in] String ifName, [in] int id); + /** * @brief To set the blocklish filtering in AP mode to prohibit * the MAC address connection. -- Gitee From 3ad60233e563940baf6af48e349340d59099259b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 6 Mar 2024 14:40:14 +0800 Subject: [PATCH 055/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/BUILD.gn | 34 ++++++++++++++++ vibrator/v1_3/IVibratorInterface.idl | 58 ++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 vibrator/v1_3/BUILD.gn create mode 100644 vibrator/v1_3/IVibratorInterface.idl diff --git a/vibrator/v1_3/BUILD.gn b/vibrator/v1_3/BUILD.gn new file mode 100644 index 00000000..f246aa71 --- /dev/null +++ b/vibrator/v1_3/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2023 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. + +HDF_CORE_PATH = "../../../hdf_core" +import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libvibrator_proxy_1.3") { + deps = [] + public_configs = [] + } +} else { + hdi("vibrator") { + module_name = "vibrator_service" + imports = [ "ohos.hdi.vibrator.v1_2:vibrator" ] + + sources = [ + "IVibratorInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_vibrator" + } +} diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl new file mode 100644 index 00000000..2b05e346 --- /dev/null +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 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 Vibrator + * @{ + * + * @brief Provides a driver for upper-layer vibrator services. + * + * After obtaining a driver object or agent, a vibrator service get vibrator ability or + * set the vibrator effect using the functions provided by the driver object or agent. + * + * @since 5.0 + */ + +/** + * @file VibratorTypes.idl + * + * @brief Declares common APIs in the vibrator module. The APIs canObtains information about all the vibrator + * that support setting intensity and Start the vibrator according to the incoming vibration effect. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.vibrator.v1_2; + +import ohos.hdi.vibrator.v1_2.VibratorTypes; +import ohos.hdi.vibrator.v1_2.IVibratorInterface; + +interface IVibratorInterface extends ohos.hdi.vibrator.v1_2.IVibratorInterface{ + /** + * @brief Controls the vibrator to perform a periodic vibration with the preset effect. + * + * One-shot vibration is mutually exclusive with periodic vibration. Before using periodic vibration, + * exit one-shot vibration. + * + * @param effectType Indicates the pointer to the preset effect type. It is recommended that the + * maximum length be 64 bytes. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 2.2 + * @version 1.0 + */ + StartByIntensity([in] String effectType, [in] int Intensity); +} \ No newline at end of file -- Gitee From 1460286abd4894c8237661e12758578c836701e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 6 Mar 2024 14:41:47 +0800 Subject: [PATCH 056/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index 19ee2b16..fe60cbd8 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -28,7 +28,8 @@ "build": { "sub_component": [ "//drivers/interface/vibrator/v1_1:vibrator_idl_target", - "//drivers/interface/vibrator/v1_2:vibrator_idl_target" + "//drivers/interface/vibrator/v1_2:vibrator_idl_target", + "//drivers/interface/vibrator/v1_3:vibrator_idl_target" ], "test": [ ], @@ -80,6 +81,30 @@ ], "header_base": "//drivers/interface/vibrator" } + }, + { + "name": "//drivers/interface/vibrator/v1_3:libvibrator_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/vibrator" + } + }, + { + "name": "//drivers/interface/vibrator/v1_3:libvibrator_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/vibrator" + } + }, + { + "name": "//drivers/interface/vibrator/v1_3:vibrator_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/vibrator" + } } ] } -- Gitee From 5efc9b7fe304aba43dc0f64d4b8ed8b8f5514854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 7 Mar 2024 10:34:22 +0800 Subject: [PATCH 057/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/IVibratorInterface.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl index 2b05e346..740bbefa 100644 --- a/vibrator/v1_3/IVibratorInterface.idl +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -35,7 +35,7 @@ * @version 1.3 */ -package ohos.hdi.vibrator.v1_2; +package ohos.hdi.vibrator.v1_3; import ohos.hdi.vibrator.v1_2.VibratorTypes; import ohos.hdi.vibrator.v1_2.IVibratorInterface; -- Gitee From eea0b008a7f00daf9de2739224d30d14634f5d9c Mon Sep 17 00:00:00 2001 From: DKdragon Date: Fri, 8 Mar 2024 12:18:20 +0800 Subject: [PATCH 058/210] wpa vendor ext checkout other hdi Signed-off-by: DKdragon --- wlan/wpa/v1_0/IWpaCallback.idl | 11 +++++++++++ wlan/wpa/v1_0/IWpaInterface.idl | 14 ++++++++++++++ wlan/wpa/v1_0/WpaTypes.idl | 13 +++++++++++++ 3 files changed, 38 insertions(+) diff --git a/wlan/wpa/v1_0/IWpaCallback.idl b/wlan/wpa/v1_0/IWpaCallback.idl index b87214a0..ad171749 100644 --- a/wlan/wpa/v1_0/IWpaCallback.idl +++ b/wlan/wpa/v1_0/IWpaCallback.idl @@ -361,4 +361,15 @@ import ohos.hdi.wlan.wpa.v1_0.WpaTypes; * @version 1.0 */ OnEventStaNotify([in] String notifyParam, [in] String ifName); + + /** + * Used to Reporting WPA Information + * + * @param wpaMsgForCbInfo Parameters for reporting WPA information + * @param ifName Indicates the NIC name. + * + * @since 4.1 + * @version 1.0 + */ + OnEventVendorCb([in] WpaVendorInfo wpaVendorInfo, [in] String ifName); } \ No newline at end of file diff --git a/wlan/wpa/v1_0/IWpaInterface.idl b/wlan/wpa/v1_0/IWpaInterface.idl index ba53d76a..ffca499e 100644 --- a/wlan/wpa/v1_0/IWpaInterface.idl +++ b/wlan/wpa/v1_0/IWpaInterface.idl @@ -1175,4 +1175,18 @@ import ohos.hdi.wlan.wpa.v1_0.IWpaCallback; * @version 1.0 */ StaShellCmd([in] String ifName, [in] String cmd); + + /** + * @brief wpa vendor ext process cmd. + * + * @param ifName Indicates the NIC name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 4.1 + * @version 1.0 + */ + VendorProcessCmd([in] String ifname, [in] String cmd); + } \ No newline at end of file diff --git a/wlan/wpa/v1_0/WpaTypes.idl b/wlan/wpa/v1_0/WpaTypes.idl index 51105ffd..620a1f7e 100644 --- a/wlan/wpa/v1_0/WpaTypes.idl +++ b/wlan/wpa/v1_0/WpaTypes.idl @@ -463,4 +463,17 @@ struct HdiWpaAuthRejectParam { unsigned short authType; unsigned short authTransaction; unsigned short statusCode; +}; + +struct WpaVendorInfo { + int type; + int freq; + int width; + int id; + int status; + int reason; + unsigned char[] ssid; + unsigned char[] psk; + unsigned char[] devAddr; + unsigned char[] data; }; \ No newline at end of file -- Gitee From c7d137eaf5dd61f64d6c4e707650e49e26a73c5a Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Mon, 11 Mar 2024 17:24:13 +0800 Subject: [PATCH 059/210] specification addition Signed-off-by: lvqiang214 --- intelligent_voice/bundle.json | 50 ++++++++ intelligent_voice/engine/v1_2/BUILD.gn | 29 +++++ .../engine/v1_2/IIntellVoiceEngineAdapter.idl | 76 ++++++++++++ .../engine/v1_2/IIntellVoiceEngineManager.idl | 113 ++++++++++++++++++ .../engine/v1_2/IntellVoiceEngineTypes.idl | 102 ++++++++++++++++ intelligent_voice/trigger/v1_2/BUILD.gn | 26 ++++ .../trigger/v1_2/IntellVoiceTriggerTypes.idl | 54 +++++++++ 7 files changed, 450 insertions(+) create mode 100644 intelligent_voice/engine/v1_2/BUILD.gn create mode 100644 intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl create mode 100644 intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl create mode 100644 intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl create mode 100644 intelligent_voice/trigger/v1_2/BUILD.gn create mode 100644 intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl diff --git a/intelligent_voice/bundle.json b/intelligent_voice/bundle.json index 57072afe..faf681a7 100644 --- a/intelligent_voice/bundle.json +++ b/intelligent_voice/bundle.json @@ -26,14 +26,40 @@ }, "build": { "sub_component": [ + "//drivers/interface/intelligent_voice/engine/v1_2:intell_voice_engine_idl_target", "//drivers/interface/intelligent_voice/engine/v1_1:intell_voice_engine_idl_target", "//drivers/interface/intelligent_voice/engine/v1_0:intell_voice_engine_idl_target", + "//drivers/interface/intelligent_voice/trigger/v1_2:intell_voice_trigger_idl_target", "//drivers/interface/intelligent_voice/trigger/v1_1:intell_voice_trigger_idl_target", "//drivers/interface/intelligent_voice/trigger/v1_0:intell_voice_trigger_idl_target" ], "test": [ ], "inner_kits": [ + { + "name": "//drivers/interface/intelligent_voice/engine/v1_2:libintell_voice_engine_proxy_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/engine" + } + }, + { + "name": "//drivers/interface/intelligent_voice/engine/v1_2:libintell_voice_engine_stub_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/engine" + } + }, + { + "name": "//drivers/interface/intelligent_voice/engine/v1_2:intell_voice_engine_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/engine" + } + }, { "name": "//drivers/interface/intelligent_voice/engine/v1_1:libintell_voice_engine_proxy_1.1", "header": { @@ -82,6 +108,30 @@ "header_base": "//drivers/interface/intelligent_voice/engine" } }, + { + "name": "//drivers/interface/intelligent_voice/trigger/v1_2:libintell_voice_trigger_proxy_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/trigger" + } + }, + { + "name": "//drivers/interface/intelligent_voice/trigger/v1_2:libintell_voice_trigger_stub_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/trigger" + } + }, + { + "name": "//drivers/interface/intelligent_voice/trigger/v1_2:intell_voice_trigger_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/intelligent_voice/trigger" + } + }, { "name": "//drivers/interface/intelligent_voice/trigger/v1_1:libintell_voice_trigger_proxy_1.1", "header": { diff --git a/intelligent_voice/engine/v1_2/BUILD.gn b/intelligent_voice/engine/v1_2/BUILD.gn new file mode 100644 index 00000000..df8e08f7 --- /dev/null +++ b/intelligent_voice/engine/v1_2/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2023 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("../../../../hdf_core/adapter/uhdf2/hdi.gni") + +hdi("intell_voice_engine") { + module_name = "intell_voice_engine_service" + imports = [ "ohos.hdi.intelligent_voice.engine.v1_1:intell_voice_engine" ] + + sources = [ + "IIntellVoiceEngineAdapter.idl", + "IIntellVoiceEngineManager.idl", + "IntellVoiceEngineTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_intelligent_voice" +} diff --git a/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl b/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl new file mode 100644 index 00000000..40b69a14 --- /dev/null +++ b/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 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 HdiIntelligentVoiceEngine + * @{ + * + * @brief Provides unified APIs for intelligent voice framework services to access intelligent voice engine drivers. + * + * An intelligent voice framework service can obtain an intelligent voice engine driver object or agent and then call APIs provided by this object or agent to + * access different types of intelligent voice engine devices based on the intelligent voice engine IDs, thereby obtaining or sending intelligent voice engine information, + * creating or releasing an intelligent voice engine adapter, attaching or detaching the intelligent voice engine, + * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, + * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. + * + * @since 5.0 + * @version 1.2 + */ + +/** + * @file IIntellVoiceEngineAdapter.idl + * + * @brief Declares the APIs provided by the intelligent voice engine adapter for obtaining wakeup pcm and evaluating wakeup word. + * + * @since 5.0 + * @version 1.2 + */ + +package ohos.hdi.intelligent_voice.engine.v1_2; + +import ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter; +import ohos.hdi.intelligent_voice.engine.v1_2.IntellVoiceEngineTypes; + +/** + * @brief Defines the functions in intelligent voice engine adapter. + * + * The operations include obtaining wakeup pcm and evaluating wakeup word. + * + * @since 5.0 + * @version 1.2 + */ +interface IIntellVoiceEngineAdapter extends ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter { + /** + * @brief obtains wakeup pcm. + * @param data Indicates wakeup pcm. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + GetWakeupPcm([out] List data); + + /** + * @brief Evaluates wakeup word. + * @param word Indicates wakeup word. + * @param info Indicates evaluation result information. + * The information includes score, result code, see {@link EvaluationResultInfo}. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + Evaluate([in] String word, [out] EvaluationResultInfo info); +} \ No newline at end of file diff --git a/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl b/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl new file mode 100644 index 00000000..b763e655 --- /dev/null +++ b/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024 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 HdiIntelligentVoiceEngine + * @{ + * + * @brief Provides unified APIs for intelligent voice framework services to access intelligent voice engine drivers. + * + * An intelligent voice framework service can obtain an intelligent voice engine driver object or agent and then call APIs provided by this object or agent to + * access different types of intelligent voice engine devices based on the intelligent voice engine IDs, thereby obtaining or sending intelligent voice engine information, + * creating or releasing an intelligent voice engine adapter, attaching or detaching the intelligent voice engine, + * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, + * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. + * + * @since 5.0 + * @version 1.2 + */ + +/** + * @file IIntellVoiceEngineManager.idl + * + * @brief Declares the APIs provided by the intelligent voice engine manager for obtaining or sending intelligent voice engine information, + * creating or releasing an intelligent voice engine adapter. + * + * @since 5.0 + * @version 1.2 + */ + +package ohos.hdi.intelligent_voice.engine.v1_2; + +import ohos.hdi.intelligent_voice.engine.v1_1.IIntellVoiceEngineManager; +import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; +import ohos.hdi.intelligent_voice.engine.v1_2.IntellVoiceEngineTypes; +import ohos.hdi.intelligent_voice.engine.v1_2.IIntellVoiceEngineAdapter; + +/** + * @brief Defines the functions in intelligent voice engine manager. + * + * The operations include obtaining or sending intelligent voice engine information, creating or releasing an intelligent voice engine adapter. + * + * @since 5.0 + * @version 1.2 + */ +interface IIntellVoiceEngineManager extends ohos.hdi.intelligent_voice.engine.v1_1.IIntellVoiceEngineManager { + /** + * @brief Creates intelligent voice engine adapter. + * @param descriptor Indicates intelligent voice engine adapter description. + * The description includes intelligent voice engine adapter type, see {@link IntellVoiceEngineAdapterDescriptor}. + * @param adapter Indicates the pointer to the intelligent voice engine adapter to operate, see {@link IIntellVoiceEngineAdapter}. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + CreateAdapter_V_2([in] struct IntellVoiceEngineAdapterDescriptor descriptor, [out] IIntellVoiceEngineAdapter adapter); + + /** + * @brief Obtains files needed to upload. + * @param numMax Indicates the maximum count of files needed to upload. + * @param files Indicates the vector of files needed to upload. + * The file includes upload hdi file type, files description, files content, see {@link UploadHdiFile}. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + GetUploadFiles([in] int numMax, [out] List files); + + /** + * @brief Obtains clone files list. + * @param cloneFiles Indicates files list needed to clone. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + GetCloneFilesList([out] List cloneFiles); + + /** + * @brief Obtains clone file. + * @param filePath Indicates the path of file that will be cloned. + * @param buffer Indicates the content of file that will be cloned. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + GetCloneFile([in] String filePath, [out] List buffer); + + /** + * @brief Sends clone file. + * @param filePath Indicates the path of file that will be send. + * @param buffer Indicates the content of file that will be send. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 1.2 + */ + SendCloneFile([in] String filePath, [in] List buffer); +} diff --git a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl new file mode 100644 index 00000000..41c344be --- /dev/null +++ b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024 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 HdiIntelligentVoiceEngine + * @{ + * + * @brief Provides unified APIs for intelligent voice framework services to access intelligent voice engine drivers. + * + * An intelligent voice framework service can obtain an intelligent voice engine driver object or agent and then call APIs provided by this object or agent to + * access different types of intelligent voice engine devices based on the intelligent voice engine IDs, thereby obtaining or sending intelligent voice engine information, + * creating or releasing an intelligent voice engine adapter, attaching or detaching the intelligent voice engine, + * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, + * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. + * + * @since 5.0 + * @version 1.2 + */ + +/** + * @file IntellVoiceEngineTypes.idl + * + * @brief Defines the data used by the intelligent voice engine module, including the upload hdi file and evaluation result information. + * + * @since 5.0 + * @version 1.2 + */ + +package ohos.hdi.intelligent_voice.engine.v1_2; + +/** + * @brief Enumerates upload hdi file types. + * + * @since 5.0 + * @version 1.2 + */ +enum UploadHdiFileType { + FILE_TYPE_ENROLL = 0, /**< Enroll file */ + FILE_TYPE_WAKEUP = 1, /**< Wakeup file */ +}; + +/** + * @brief Enumerates evaluation result code. + * + * @since 5.0 + * @version 1.2 + */ +enum EvaluationResultCode { + UNKNOWN = 0, /**< Unknown */ + PASS = 1, /**< Pass */ + WORD_EMPTY = 2, /**< Word is empty */ + ONLY_SUPPORT_CHINESE = 3, /**< Only chinese is supported */ + INVALID_LENGTH = 4, /**< Invalid length */ + UNUSUAL_WORD = 5, /**< Unusual word */ + CONSECUTIVE_SAME_WORD = 6, /**< Consecutive same word */ + TOO_FEW_PHONES = 7, /**< Too few phonemes */ + TOO_MANY_PHONES = 8, /**< Too many phonemes */ + CONTAIN_COMMON_INSTRUCTION = 9, /**< Contain common instruction */ + CONTAIN_COMMON_SPOKEN_LANGUAGE = 10, /**< Contain common spoken language */ + CONTAIN_SENSITIVE_WORD = 11, /**< Contain sensitive word */ + NO_INITIAL_CONSONANT = 12, /**< Two consecutive words without initial consonant */ + CONTAIN_REPEATED_PHONE = 13, /**< Contain repeated phoneme */ +}; + +/** + * @brief Defines upload hdi file information. + * + * The upload hdi file information includes the type, description, content. + * + * @since 5.0 + * @version 1.2 + */ +struct UploadHdiFile { + UploadHdiFileType type; /**< upload hdi file type */ + String filesDescription; /**< files description */ + List filesContent; /**< files content */ +}; + +/** + * @brief Defines evaluation result information. + * + * The evaluation result information includes the score, result code. + * + * @since 5.0 + * @version 1.2 + */ +struct EvaluationResultInfo { + int score; /**< score */ + EvaluationResultCode resultCode; /**< result code */ +}; \ No newline at end of file diff --git a/intelligent_voice/trigger/v1_2/BUILD.gn b/intelligent_voice/trigger/v1_2/BUILD.gn new file mode 100644 index 00000000..f9032ee0 --- /dev/null +++ b/intelligent_voice/trigger/v1_2/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2024 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("../../../../hdf_core/adapter/uhdf2/hdi.gni") + +hdi("intell_voice_trigger") { + module_name = "intell_voice_trigger_service" + + imports = [ "ohos.hdi.intelligent_voice.trigger.v1_1:intell_voice_trigger" ] + + sources = [ "IntellVoiceTriggerTypes.idl" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_intelligent_voice" +} diff --git a/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl new file mode 100644 index 00000000..07a7d77e --- /dev/null +++ b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 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 HdiIntelligentVoiceTrigger + * @{ + * + * @brief Provides unified APIs for intelligent voice framework services to access intelligent voice trigger drivers. + * + * An intelligent voice framework service can obtain an intelligent voice trigger driver object or agent and then call APIs provided by this object or agent to + * access different types of intelligent voice trigger devices based on the intelligent voice trigger IDs, thereby loading or unloading intelligent voice trigger adapter, + * obtaining properties from intelligent voice trigger adapter, loading or unloading a trigger model, starting or stopping recognition, + * setting parameters to or getting parameters from intelligent voice trigger adapter. + * + * @since 4.0 + * @version 1.0 + */ + +/** + * @file IntellVoiceTriggerTypes.idl + * + * @brief Defines the data used by the intelligent voice trigger module, including intelligent voice trigger model type, recognition status, + * intelligent voice trigger adapter dsecriptor, intelligent voice trigger properties, intelligent voice trigger model, intelligent voice recognition event. + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.intelligent_voice.trigger.v1_2; + +import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; + +/** + * @brief Enumerates intelligent voice trigger model types. + * + * @since 5.0 + * @version 1.2 + */ +enum IntellVoiceTriggerModelType : ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerModelType { + VOICE_WAKEUP = 1, /**< Voice wakeup */ + PROXIMAL_WAKEUP = 2, /**< Proximal wakeup */ +}; \ No newline at end of file -- Gitee From 58cc5f4888116ed41ce05dd4d77a56369c34e6c5 Mon Sep 17 00:00:00 2001 From: zhongning5 Date: Mon, 11 Mar 2024 19:01:48 +0800 Subject: [PATCH 060/210] add innerapi_tags Signed-off-by: zhongning5 --- nnrt/v1_0/BUILD.gn | 1 + nnrt/v2_0/BUILD.gn | 1 + nnrt/v2_1/BUILD.gn | 1 + 3 files changed, 3 insertions(+) diff --git a/nnrt/v1_0/BUILD.gn b/nnrt/v1_0/BUILD.gn index 37977a26..e68e1f3a 100644 --- a/nnrt/v1_0/BUILD.gn +++ b/nnrt/v1_0/BUILD.gn @@ -23,6 +23,7 @@ hdi("nnrt") { ] language = "cpp" + innerapi_tags = [ "platformsdk" ] subsystem_name = "hdf" part_name = "drivers_interface_nnrt" } diff --git a/nnrt/v2_0/BUILD.gn b/nnrt/v2_0/BUILD.gn index b7ea7990..140d143d 100644 --- a/nnrt/v2_0/BUILD.gn +++ b/nnrt/v2_0/BUILD.gn @@ -23,6 +23,7 @@ hdi("nnrt") { ] language = "cpp" + innerapi_tags = [ "platformsdk" ] subsystem_name = "hdf" part_name = "drivers_interface_nnrt" } diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index 17f1dc57..cea0ed6d 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -23,6 +23,7 @@ hdi("nnrt") { ] language = "cpp" + innerapi_tags = [ "platformsdk" ] subsystem_name = "hdf" part_name = "drivers_interface_nnrt" } -- Gitee From 50446f720f586a339257b8d2f714cb0ef10b9080 Mon Sep 17 00:00:00 2001 From: guoyuan Date: Thu, 29 Feb 2024 16:34:56 +0800 Subject: [PATCH 061/210] fix bundle.json Signed-off-by: guoyuan --- wlan/bundle.json | 6 +++--- wlan/v1_3/IWlanInterface.idl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wlan/bundle.json b/wlan/bundle.json index 4b4b14ef..4ea55b17 100644 --- a/wlan/bundle.json +++ b/wlan/bundle.json @@ -84,7 +84,7 @@ } }, { - "name": "//drivers/interface/wlan/v1_3:libwpa_proxy_1.3", + "name": "//drivers/interface/wlan/v1_3:libwlan_proxy_1.3", "header": { "header_files": [ ], @@ -92,7 +92,7 @@ } }, { - "name": "//drivers/interface/wlan/wpa/v1_3:wpa_idl_headers", + "name": "//drivers/interface/wlan/v1_3:wlan_idl_headers", "header": { "header_files": [ ], @@ -100,7 +100,7 @@ } }, { - "name": "//drivers/interface/wlan/wpa/v1_3:libwpa_stub_1.3", + "name": "//drivers/interface/wlan/v1_3:libwlan_stub_1.3", "header": { "header_files": [ ], diff --git a/wlan/v1_3/IWlanInterface.idl b/wlan/v1_3/IWlanInterface.idl index 7622b16a..9334f10f 100644 --- a/wlan/v1_3/IWlanInterface.idl +++ b/wlan/v1_3/IWlanInterface.idl @@ -32,7 +32,7 @@ interface IWlanInterface extends ohos.hdi.wlan.v1_2.IWlanInterface { * @brief get coex channel list. * * @param ifName Indicates the NIC name. - * @param parmeBuf coex channel list. + * @param paramBuf coex channel list. * * @return Returns 0 if the operation is successful. * @return Returns a negative value if the operation fails. -- Gitee From bd6ec5d8a2c89789d13db56941c17bfbec2ddad6 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Mon, 11 Mar 2024 11:32:30 +0800 Subject: [PATCH 062/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8B=8D=E7=85=A7?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- camera/bundle.json | 26 ++++++ camera/v1_3/BUILD.gn | 43 +++++++++ camera/v1_3/ICameraDevice.idl | 48 ++++++++++ camera/v1_3/ICameraHost.idl | 49 ++++++++++ camera/v1_3/IStreamOperatorCallback.idl | 53 +++++++++++ camera/v1_3/Types.idl | 114 ++++++++++++++++++++++++ 6 files changed, 333 insertions(+) create mode 100644 camera/v1_3/BUILD.gn create mode 100644 camera/v1_3/ICameraDevice.idl create mode 100644 camera/v1_3/ICameraHost.idl create mode 100644 camera/v1_3/IStreamOperatorCallback.idl create mode 100644 camera/v1_3/Types.idl diff --git a/camera/bundle.json b/camera/bundle.json index 46954e39..5b9891f3 100644 --- a/camera/bundle.json +++ b/camera/bundle.json @@ -30,6 +30,7 @@ }, "build": { "sub_component": [ + "//drivers/interface/camera/v1_3:camera_idl_target", "//drivers/interface/camera/v1_2:camera_idl_target", "//drivers/interface/camera/v1_1:camera_idl_target", "//drivers/interface/camera/v1_0:camera_idl_target", @@ -37,6 +38,7 @@ "//drivers/interface/camera/sequenceable/buffer_handle:libbuffer_handle_sequenceable_1.0", "//drivers/interface/camera/sequenceable/map_data:libmap_data_sequenceable_1.0", "//drivers/interface/camera/metadata:metadata", + "//drivers/interface/camera/v1_3:libcamera_stub_1.3", "//drivers/interface/camera/v1_2:libcamera_stub_1.2", "//drivers/interface/camera/v1_1:libcamera_stub_1.1", "//drivers/interface/camera/v1_0:libcamera_stub_1.0" @@ -44,6 +46,30 @@ "test": [ ], "inner_kits": [ + { + "name": "//drivers/interface/camera/v1_3:libcamera_stub_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/camera" + } + }, + { + "name": "//drivers/interface/camera/v1_3:libcamera_proxy_1.3", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/camera" + } + }, + { + "name": "//drivers/interface/camera/v1_3:camera_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/camera" + } + }, { "name": "//drivers/interface/camera/v1_2:libcamera_stub_1.2", "header": { diff --git a/camera/v1_3/BUILD.gn b/camera/v1_3/BUILD.gn new file mode 100644 index 00000000..520e7510 --- /dev/null +++ b/camera/v1_3/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libcamera_proxy_1.3") { + deps = [] + public_configs = [] + } +} else { + hdi("camera") { + module_name = "camera_service" + imports = [ "ohos.hdi.camera.v1_2:camera" ] + + sources = [ + "ICameraDevice.idl", + "ICameraHost.idl", + "IStreamOperatorCallback.idl", + "Types.idl", + ] + + sequenceable_pub_deps = [ + "../sequenceable/buffer_handle:libbuffer_handle_sequenceable_1.0", + "../sequenceable/buffer_producer:libbuffer_producer_sequenceable_1.0", + "../sequenceable/map_data:libmap_data_sequenceable_1.0", + ] + sequenceable_ext_deps = [ "graphic_surface:surface" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_camera" + } +} diff --git a/camera/v1_3/ICameraDevice.idl b/camera/v1_3/ICameraDevice.idl new file mode 100644 index 00000000..d7f5da91 --- /dev/null +++ b/camera/v1_3/ICameraDevice.idl @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file icamera_device.h + * + * @brief Declares APIs for camera device operations. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.camera.v1_3; + +import ohos.hdi.camera.v1_2.ICameraDevice; +import ohos.hdi.camera.v1_3.IStreamOperatorCallback; +import ohos.hdi.camera.v1_2.IStreamOperator; + +interface ICameraDevice extends ohos.hdi.camera.v1_2.ICameraDevice { + /** + * @brief Obtains the stream operation handle. + * + * @param callback Indicates a stream callback. For details, see {@link IStreamOperatorCallback}. + * {@link OnCaptureStarted} and {@link OnCaptureEnded} are used to report the start and end of capture, + * and {@link OnCaptureError} is used to report a capture error. + * + * @param streamOperator Indicates the stream operation handle. + * + * @return Returns NO_ERROR if the operation is successful; returns an error code defined + * in {@link CamRetCode} otherwise. + * + * @since 5.0 + * @version 1.3 + */ + GetStreamOperator_V1_3([in] IStreamOperatorCallback callbackObj, [out] IStreamOperator streamOperator); +} diff --git a/camera/v1_3/ICameraHost.idl b/camera/v1_3/ICameraHost.idl new file mode 100644 index 00000000..334eadea --- /dev/null +++ b/camera/v1_3/ICameraHost.idl @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file icamera_host.h + * + * @brief Management class of the camera service that provides Hardware Driver Interfaces (HDIs) for the upper layer. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.camera.v1_3; + +import ohos.hdi.camera.v1_2.ICameraHost; +import ohos.hdi.camera.v1_3.ICameraDevice; +import ohos.hdi.camera.v1_0.ICameraDeviceCallback; + +interface ICameraHost extends ohos.hdi.camera.v1_2.ICameraHost { + /** + * @brief Opens a camera device. + * + * By calling this function, you can obtain the ICameraDevice instance and operate the + * specific camera device mapping to the instance. + * + * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}. + * @param callback Indicates the callback related to the camera. For details, see {@link ICameraDeviceCallback}. + * @param device Indicates the ICameraDevice instance corresponding to the ID of the camera device. + * + * @return Returns NO_ERROR if the operation is successful; returns an error code defined + * in {@link CamRetCode} otherwise. + * + * @since 5.0 + * @version 1.3 + */ + OpenCamera_V1_3([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); +} diff --git a/camera/v1_3/IStreamOperatorCallback.idl b/camera/v1_3/IStreamOperatorCallback.idl new file mode 100644 index 00000000..7ad80ce5 --- /dev/null +++ b/camera/v1_3/IStreamOperatorCallback.idl @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file istream_operator_callback.h + * + * @brief Declares callbacks related to {@link IStreamOperator}. The caller needs to implement these callbacks. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.camera.v1_3; + +import ohos.hdi.camera.v1_2.Types; + +[callback] interface IStreamOperatorCallback extends ohos.hdi.camera.v1_2.IStreamOperatorCallback { + /** + * @brief Called when the next capture get ready. + * + * @param captureId Indicates the ID of the capture request corresponding to the callback. + * @param streamIds Indicates the IDs of the streams corresponding to the callback. + * @Param timestamp Indicates the timestamp when the callback is invoked. + * + * @since 5.0 + * @version 1.3 + */ + OnCaptureReady([in] int captureId, [in] int[] streamIds, [in] unsigned long timestamp); + + /** + * @brief Called when the frameShutter ends. + * + * @param captureId Indicates the ID of the capture request corresponding to the callback. + * @param streamIds Indicates the IDs of the streams corresponding to the callback. + * @Param timestamp Indicates the timestamp when the callback is invoked. + * + * @since 5.0 + * @version 1.3 + */ + OnFrameShutterEnd([in] int captureId, [in] int[] streamIds, [in] unsigned long timestamp); +} diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl new file mode 100644 index 00000000..309a4a46 --- /dev/null +++ b/camera/v1_3/Types.idl @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file Types.h + * + * @brief Declares data types + * used by the Hardware Driver Interfaces (HDIs) of this module. + * + * @since 5.0 + * @version 1.3 + */ + +package ohos.hdi.camera.v1_3; + +import ohos.hdi.camera.v1_2.Types; + +sequenceable ohos.hdi.camera.v1_0.BufferHandleSequenceable; +sequenceable ohos.hdi.camera.v1_0.MapDataSequenceable; + +/** + * @brief Enumerates stream operation modes. + */ +enum OperationMode_V1_3 { + /** + * Normal mode, which supports both photo and video scenes + */ + NORMAL = 0, + + /** + * Capture mode, which dedicated to photo scene + * IF this mode is implemented, then the NORMAL mode should no longer be implemented + */ + CAPTURE = 1, + + /** + * Video mode, which dedicated to video secne + * IF this mode is implemented, then the NORMAL mode should no longer be implemented + */ + VIDEO = 2, + + /** + * Portrait mode, which dedicated to portrait photo secne + */ + PORTRAIT = 3, + + /** + * Night mode, which dedicated to night shooting scene + */ + NIGHT = 4, + + /** + * Professional mode, which dedicated to professional photo scene + * Abandoned, use the new operationMode below + */ + PROFESSIONAL = 5, + + /** + * Slow motion mode, which dedicated to capturing slow motion + */ + SLOW_MOTION = 6, + + /** + * Scan mode, which dedicated to scan code + */ + SCAN_CODE = 7, + + /** + * Macro mode, which dedicated to capture code + */ + CAPTURE_MACRO = 8, + + /** + * Macro mode, which dedicated to video code + */ + VIDEO_MACRO = 9, + + /** + * Super stabilization mode, which dedicated to use Suprt stabilization mode + */ + SUPER_STAB = 10, + + /** + * Professional mode, which dedicated to capture code + */ + PROFESSIONAL_PHOTO = 11, + + /** + * Professional mode, which dedicated to video code + */ + PROFESSIONAL_VIDEO = 12, + + /** + * Slow motion mode, which dedicated to video recording slow motion + */ + HIGH_FRAME_RATE = 13, + + /** + * Operation mode max + */ + OPERATION_MODE_MAX, +}; -- Gitee From 4fbb324f5ede51730558909396546df508cebd37 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Mon, 11 Mar 2024 11:58:29 +0800 Subject: [PATCH 063/210] fix:New enumerations Signed-off-by: fan-jingle --- display/bundle.json | 9 +++ display/composer/v1_2/BUILD.gn | 30 +++++++++ display/composer/v1_2/DisplayComposerType.idl | 62 +++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 display/composer/v1_2/BUILD.gn create mode 100644 display/composer/v1_2/DisplayComposerType.idl diff --git a/display/bundle.json b/display/bundle.json index c5c0230a..7e9e517c 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -48,6 +48,7 @@ "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", "//drivers/interface/display/composer/v1_1:display_composer_idl_target", "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", + "//drivers/interface/display/composer/v1_2:display_composer_idl_target", "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target", "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target" ], @@ -214,6 +215,14 @@ "header_base": "//drivers/interface/display/composer" } }, + { + "name": "//drivers/interface/display/composer/v1_2:display_composer_idl_headers_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, { "name": "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_headers", "header": { diff --git a/display/composer/v1_2/BUILD.gn b/display/composer/v1_2/BUILD.gn new file mode 100644 index 00000000..86f4ce29 --- /dev/null +++ b/display/composer/v1_2/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("display_composer") { + module_name = "display_composer" + imports = [ + "ohos.hdi.display.composer.v1_0:display_composer", + "ohos.hdi.display.composer.v1_1:display_composer", + ] + + sources = [ "DisplayComposerType.idl" ] + + sequenceable_pub_deps = [ "../hdifd_parcelable:libhdifd_parcelable" ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} diff --git a/display/composer/v1_2/DisplayComposerType.idl b/display/composer/v1_2/DisplayComposerType.idl new file mode 100644 index 00000000..ffc75428 --- /dev/null +++ b/display/composer/v1_2/DisplayComposerType.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 Display + * + * @brief Defines driver interfaces of the display module. + * + * This module provides driver interfaces for upper-layer graphics services, including layer management, device control, and display buffer management. + * + * @since 5.0 + * @version 1.2 + */ + +/** + * @file DisplayComposerType.idl + * + * @brief Declares the data types used by the interfaces related to display composer operations. + * + * @since 5.0 + * @version 1.2 + */ + +/** + * @brief Defines the package path of the display module interfaces. + * + * @since 5.0 + * @version 1.2 + */ +package ohos.hdi.display.composer.v1_2; +sequenceable OHOS.HDI.Display.HdifdParcelable; +import ohos.hdi.display.composer.v1_0.DisplayComposerType; +import ohos.hdi.display.composer.v1_1.DisplayComposerType; + +/** + * @brief Enumerates power status. + */ +enum DispPowerStatus : ohos.hdi.display.composer.v1_1.DispPowerStatus { + POWER_STATUS_PRE_ON = 5, /**< The power status is Enter pre-lit screen state */ + POWER_STATUS_PRE_OFF = 6, /**< The power status is Exit pre-lit sreen state */ + POWER_STATUS_BUTT_V1_2, /**< The power status is invalid */ +}; + +/** + * @brief Defines the buffer usage. + * + */ +enum BufferUsage : ohos.hdi.display.composer.v1_0.BufferUsage { + HBM_USE_CPU_HW_BOTH = (1ULL << 17), /**< For support cpu and hardware */ +}; \ No newline at end of file -- Gitee From 6b8eca5dd87c2487d45ebfec057bf43317eb73f2 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Wed, 13 Mar 2024 10:15:12 +0800 Subject: [PATCH 064/210] super slow motion Signed-off-by: luzhiye --- .../include/camera_device_ability_items.h | 31 +++++++++++++------ .../include/camera_metadata_item_info.h | 8 +++-- camera/metadata/src/camera_metadata_info.cpp | 5 +-- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 3efd7aac..f46cf8b4 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -265,8 +265,9 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, - OHOS_CONTROL_SUPER_SLOW_CHECK_AREA, - OHOS_STATUS_SUPER_SLOW_MOTION, + OHOS_STATUS_SLOW_MOTION_DETECTION, + OHOS_ABILITY_MOTION_DETECTION_SUPPORT, + OHOS_CONTROL_MOTION_DETECTION, OHOS_CAMERA_EFFECT_END, // camera secure related @@ -595,12 +596,24 @@ typedef enum camera_zoomsmooth_control_type { } camera_zoomsmooth_control_type_t; // OHOS_STATUS_SUPER_SLOW_MOTION enumeration values -typedef enum camera_super_slow_motion_status_type { - OHOS_CAMERA_SUPER_SLOW_MOTION_DISABLE = 0, - OHOS_CAMERA_SUPER_SLOW_MOTION_READY, - OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_DONE, - OHOS_CAMERA_SUPER_SLOW_MOTION_FINISH, - OHOS_CAMERA_SUPER_SLOW_MOTION_VIDEO_START, -} camera_super_slow_motion_status_type_t; +typedef enum camera_slow_motion_status_type { + OHOS_CONTROL_SLOW_MOTION_STATUS_DISABLE = 0, + OHOS_CONTROL_SLOW_MOTION_STATUS_READY, + OHOS_CONTROL_SLOW_MOTION_STATUS_START, + OHOS_CONTROL_SLOW_MOTION_STATUS_RECORDING, + OHOS_CONTROL_SLOW_MOTION_STATUS_FINISH, +} camera_slow_motion_status_type_t; + +// OHOS_ABILITY_MOTION_DETECTION_SUPPORT enumeration values +typedef enum camera_motion_detection_supported_type { + OHOS_CAMERA_MOTION_DETECTION_NOT_SUPPORTED = 0, + OHOS_CAMERA_MOTION_DETECTION_SUPPORTED, +} camera_motion_detection_supported_type_t; + +// OHOS_CONTROL_MOTION_DETECTION enumeration values +typedef enum camera_motion_detection_control_type { + OHOS_CAMERA_MOTION_DETECTION_DISABLE = 0, + OHOS_CAMERA_MOTION_DETECTION_ENABLE, +} camera_motion_detection_control_type_t; #endif diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index f0d08eac..fdd07d74 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -297,10 +297,12 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT [OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE - OHOS_CAMERA_EFFECT_START] = {"cameraPhysicalApertureControlValue", META_TYPE_FLOAT, 1}, [OHOS_DEVICE_EXITCAMERA_EVENT - OHOS_CAMERA_EFFECT_START] = {"exitCameraEvent", META_TYPE_BYTE, 1}, - [OHOS_CONTROL_SUPER_SLOW_CHECK_AREA - - OHOS_CAMERA_EFFECT_START] = {"superSlowMotionCheckArea", META_TYPE_FLOAT, -1}, - [OHOS_STATUS_SUPER_SLOW_MOTION - + [OHOS_STATUS_SLOW_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"superSlowMotionStatus", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_MOTION_DETECTION_SUPPORT - + OHOS_CAMERA_EFFECT_START] = {"motionDetectionSupportValue", META_TYPE_BYTE, 1}, + [OHOS_CONTROL_MOTION_DETECTION - + OHOS_CAMERA_EFFECT_START] = {"motionDetectionControlValue", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index d67ec7bd..93adec24 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -166,8 +166,9 @@ const std::vector g_metadataTags = { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, - OHOS_CONTROL_SUPER_SLOW_CHECK_AREA, - OHOS_STATUS_SUPER_SLOW_MOTION, + OHOS_STATUS_SLOW_MOTION_DETECTION, + OHOS_ABILITY_MOTION_DETECTION_SUPPORT, + OHOS_CONTROL_MOTION_DETECTION, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From ee5a84169983a233c97a16245c68ca6ab1e2223d Mon Sep 17 00:00:00 2001 From: dufresne_andy Date: Thu, 14 Mar 2024 11:48:04 +0800 Subject: [PATCH 065/210] Description:enhance host management to device Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: dufresne_andy --- usb/bundle.json | 17 +++++++- usb/v1_1/BUILD.gn | 33 ++++++++++++++++ usb/v1_1/IUsbInterface.idl | 79 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 usb/v1_1/BUILD.gn create mode 100644 usb/v1_1/IUsbInterface.idl diff --git a/usb/bundle.json b/usb/bundle.json index 037cda91..58730054 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -32,7 +32,8 @@ "sub_component": [ "//drivers/interface/usb/v1_0:usb_idl_target", "//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target", - "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target" + "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target", + "//drivers/interface/usb/v1_1:usb_idl_target" ], "test": [], "inner_kits": [ @@ -98,6 +99,20 @@ "header_files": [], "header_base": "//drivers/interface/usb/ddk" } + }, + { + "name": "//drivers/interface/usb/v1_1:libusb_proxy_1.1", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb" + } + }, + { + "name": "//drivers/interface/usb/v1_1:libusb_stub_1.1", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb" + } } ] } diff --git a/usb/v1_1/BUILD.gn b/usb/v1_1/BUILD.gn new file mode 100644 index 00000000..cda8dcc7 --- /dev/null +++ b/usb/v1_1/BUILD.gn @@ -0,0 +1,33 @@ +# 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/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libusb_proxy_1.1") { + deps = [] + public_configs = [] + } +} else { + hdi("usb") { + module_name = "usbd" + imports = [ "ohos.hdi.usb.v1_0:usb" ] + + sources = [ + "IUsbInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_usb" + } +} diff --git a/usb/v1_1/IUsbInterface.idl b/usb/v1_1/IUsbInterface.idl new file mode 100644 index 00000000..306776e5 --- /dev/null +++ b/usb/v1_1/IUsbInterface.idl @@ -0,0 +1,79 @@ +/* + * 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 HdiUsb + * @{ + * + * @brief Provides unified APIs for usb services to access usb drivers. + * + * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to + * access different types of usb devices based on the usb IDs, thereby obtaining usb information, + * subscribing to or unsubscribing from usb data, enabling or disabling a usb, + * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range. + * + * @since 5.0 + */ + +/* * + * @file IUsbInterface.idl + * + * @brief Declares the APIs provided by the usb module for obtaining usb information, subscribing to or + * unsubscribing from usb data, enabling or disabling a usb, setting the usb data reporting mode, + * and setting usb options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 1.1 + */ + +package ohos.hdi.usb.v1_1; + +import ohos.hdi.usb.v1_0.UsbTypes; +import ohos.hdi.usb.v1_0.IUsbdSubscriber; +import ohos.hdi.usb.v1_0.IUsbdBulkCallback; +import ohos.hdi.usb.v1_0.IUsbInterface; + +/* * + * @brief Defines the functions for performing basic operations on usb. + * + * The operations include obtaining usb information, subscribing to or unsubscribing from usb data, + * enabling or disabling a usb, setting the usb data reporting mode, and setting usb options such as + * the accuracy and measurement range. + */ +interface IUsbInterface extends ohos.hdi.usb.v1_0.IUsbInterface{ + + /* * + * @brief Obtains the USB device descriptor. + * + * @param dev Indicates the USB device address. + * @param interfaceid Indicates the interface ID of the USB device. + * @param unactivated Indicates whether the interface unactivated. + * + * @return Returns 0 if the operation is successful; returns a non-0 value if the operation fails. + * @since 5.0 + */ + GetInterfaceActiveStatus ([in] struct UsbDev dev, [in] unsigned char interfaceid, [out] boolean unactivated ); + + /* * + * @brief Obtains the USB device descriptor. + * + * @param dev Indicates the USB device address. + * @param speed Indicates the USB device speed. + * + * @return Returns 0 if the operation is successful; returns a non-0 value if the operation fails. + * @since 5.0 + */ + GetDeviceSpeed ([in] struct UsbDev dev, [out] unsigned char speed ); +} \ No newline at end of file -- Gitee From 5a9e8fe28e84830584e7be80571da021aa006632 Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Thu, 14 Mar 2024 15:41:26 +0800 Subject: [PATCH 066/210] specification addition Signed-off-by: lvqiang214 --- intelligent_voice/engine/v1_2/BUILD.gn | 4 ++-- intelligent_voice/trigger/v1_2/BUILD.gn | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intelligent_voice/engine/v1_2/BUILD.gn b/intelligent_voice/engine/v1_2/BUILD.gn index df8e08f7..1e19d20e 100644 --- a/intelligent_voice/engine/v1_2/BUILD.gn +++ b/intelligent_voice/engine/v1_2/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("../../../../hdf_core/adapter/uhdf2/hdi.gni") +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("intell_voice_engine") { module_name = "intell_voice_engine_service" diff --git a/intelligent_voice/trigger/v1_2/BUILD.gn b/intelligent_voice/trigger/v1_2/BUILD.gn index f9032ee0..3132ecb7 100644 --- a/intelligent_voice/trigger/v1_2/BUILD.gn +++ b/intelligent_voice/trigger/v1_2/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("../../../../hdf_core/adapter/uhdf2/hdi.gni") +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("intell_voice_trigger") { module_name = "intell_voice_trigger_service" -- Gitee From 7149daa432a3fd5ee0888f3f3e9fb8699aa2e0b2 Mon Sep 17 00:00:00 2001 From: liuziwei Date: Thu, 14 Mar 2024 15:06:48 +0800 Subject: [PATCH 067/210] fix Signed-off-by: liuziwei Change-Id: Ia6e21c00422dfdd0129fd17d7bdc2812fde760ff --- user_auth/v1_3/IUserAuthInterface.idl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/user_auth/v1_3/IUserAuthInterface.idl b/user_auth/v1_3/IUserAuthInterface.idl index 81a1a6ed..34ef88f1 100644 --- a/user_auth/v1_3/IUserAuthInterface.idl +++ b/user_auth/v1_3/IUserAuthInterface.idl @@ -85,7 +85,8 @@ interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface * @brief Check if unlock result can be reused and return token. * * @param info Request information of reused unLock result. See {@link ReuseUnlockInfo}. - * @param token Authentication token. + * @param info Indicates authentication result information. See {@link AuthResultInfo}. + * @param enrolledState EnrolledID information. * * @return Returns 0 if the operation is successful. * @return Returns a non-zero value if the operation fails. @@ -93,6 +94,7 @@ interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface * @since 5.0 * @version 1.3 */ - CheckReuseUnlockResult([in] struct ReuseUnlockInfo info, [out] unsigned char[] token); + CheckReuseUnlockResult([in] struct ReuseUnlockInfo info, [out] enum AuthType authType, + [out] struct AuthResultInfo info, [out] EnrolledState enrolledState); } /** @} */ -- Gitee From 84dc1d1192fd52720e0fb02a635981007b2a927f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 15 Mar 2024 11:32:28 +0800 Subject: [PATCH 068/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/IVibratorInterface.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl index 740bbefa..f3b42f5e 100644 --- a/vibrator/v1_3/IVibratorInterface.idl +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -54,5 +54,5 @@ interface IVibratorInterface extends ohos.hdi.vibrator.v1_2.IVibratorInterface{ * @since 2.2 * @version 1.0 */ - StartByIntensity([in] String effectType, [in] int Intensity); + StartByIntensity([in] String effectType, [in] unsigned short intensity); } \ No newline at end of file -- Gitee From bf5f164c2208fa4e584a15e3aa741753653c55f7 Mon Sep 17 00:00:00 2001 From: dufresne_andy Date: Fri, 15 Mar 2024 12:01:28 +0800 Subject: [PATCH 069/210] Description:enhance host management to device Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: dufresne_andy --- usb/v1_1/IUsbInterface.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usb/v1_1/IUsbInterface.idl b/usb/v1_1/IUsbInterface.idl index 306776e5..c4439208 100644 --- a/usb/v1_1/IUsbInterface.idl +++ b/usb/v1_1/IUsbInterface.idl @@ -55,7 +55,7 @@ import ohos.hdi.usb.v1_0.IUsbInterface; interface IUsbInterface extends ohos.hdi.usb.v1_0.IUsbInterface{ /* * - * @brief Obtains the USB device descriptor. + * @brief Obtain the activation information of the USB device interface. * * @param dev Indicates the USB device address. * @param interfaceid Indicates the interface ID of the USB device. @@ -67,7 +67,7 @@ interface IUsbInterface extends ohos.hdi.usb.v1_0.IUsbInterface{ GetInterfaceActiveStatus ([in] struct UsbDev dev, [in] unsigned char interfaceid, [out] boolean unactivated ); /* * - * @brief Obtains the USB device descriptor. + * @brief Obtains USB device speed. * * @param dev Indicates the USB device address. * @param speed Indicates the USB device speed. -- Gitee From e10ed86448b82371bf2476902c58f66c1353c43c Mon Sep 17 00:00:00 2001 From: liuziwei Date: Fri, 15 Mar 2024 14:06:36 +0800 Subject: [PATCH 070/210] fix Signed-off-by: liuziwei Change-Id: I3459fb75b1d9f1eec0ceb29398601ddc3ad7cd20 --- user_auth/v1_3/IUserAuthInterface.idl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/user_auth/v1_3/IUserAuthInterface.idl b/user_auth/v1_3/IUserAuthInterface.idl index 34ef88f1..81a1a6ed 100644 --- a/user_auth/v1_3/IUserAuthInterface.idl +++ b/user_auth/v1_3/IUserAuthInterface.idl @@ -85,8 +85,7 @@ interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface * @brief Check if unlock result can be reused and return token. * * @param info Request information of reused unLock result. See {@link ReuseUnlockInfo}. - * @param info Indicates authentication result information. See {@link AuthResultInfo}. - * @param enrolledState EnrolledID information. + * @param token Authentication token. * * @return Returns 0 if the operation is successful. * @return Returns a non-zero value if the operation fails. @@ -94,7 +93,6 @@ interface IUserAuthInterface extends ohos.hdi.user_auth.v1_2.IUserAuthInterface * @since 5.0 * @version 1.3 */ - CheckReuseUnlockResult([in] struct ReuseUnlockInfo info, [out] enum AuthType authType, - [out] struct AuthResultInfo info, [out] EnrolledState enrolledState); + CheckReuseUnlockResult([in] struct ReuseUnlockInfo info, [out] unsigned char[] token); } /** @} */ -- Gitee From 4984d0419e742332882ff6f95fd014da66282422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 15 Mar 2024 14:52:20 +0800 Subject: [PATCH 071/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index fe60cbd8..4abd470c 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -11,7 +11,7 @@ "scripts": {}, "component": { "name": "drivers_interface_vibrator", - "subsystem": "hdf", + "subsystem": "drivers", "syscap": [], "adapted_system_type": ["standard"], "rom": "675KB", -- Gitee From 51e8f226469fc3893772aca1939f6047ad575765 Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Fri, 15 Mar 2024 15:22:43 +0800 Subject: [PATCH 072/210] specification addition Signed-off-by: lvqiang214 --- .../engine/v1_2/IntellVoiceEngineTypes.idl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl index 41c344be..103245b1 100644 --- a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl +++ b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl @@ -61,17 +61,17 @@ enum EvaluationResultCode { UNKNOWN = 0, /**< Unknown */ PASS = 1, /**< Pass */ WORD_EMPTY = 2, /**< Word is empty */ - ONLY_SUPPORT_CHINESE = 3, /**< Only chinese is supported */ + CHINESE_ONLY = 3, /**< Only chinese is supported */ INVALID_LENGTH = 4, /**< Invalid length */ UNUSUAL_WORD = 5, /**< Unusual word */ CONSECUTIVE_SAME_WORD = 6, /**< Consecutive same word */ - TOO_FEW_PHONES = 7, /**< Too few phonemes */ - TOO_MANY_PHONES = 8, /**< Too many phonemes */ - CONTAIN_COMMON_INSTRUCTION = 9, /**< Contain common instruction */ - CONTAIN_COMMON_SPOKEN_LANGUAGE = 10, /**< Contain common spoken language */ - CONTAIN_SENSITIVE_WORD = 11, /**< Contain sensitive word */ + TOO_FEW_PHONEMES = 7, /**< Too few phonemes */ + TOO_MANY_PHONEMES = 8, /**< Too many phonemes */ + COMMON_INSTRUCTION = 9, /**< Contain common instruction */ + COMMON_SPOKEN_LANGUAGE = 10, /**< Contain common spoken language */ + SENSITIVE_WORD = 11, /**< Contain sensitive word */ NO_INITIAL_CONSONANT = 12, /**< Two consecutive words without initial consonant */ - CONTAIN_REPEATED_PHONE = 13, /**< Contain repeated phoneme */ + REPEATED_PHONEME = 13, /**< Contain repeated phoneme */ }; /** -- Gitee From 220608561069ebcb94dd1490978c5ccf699eea7f Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 15 Mar 2024 15:26:56 +0800 Subject: [PATCH 073/210] commit msg Signed-off-by: xuxuehai --- audio/bundle.json | 8 +- audio/v3_0/AudioTypes.idl | 515 ++++++++++++++++++++++++++++++++++ audio/v3_0/BUILD.gn | 38 +++ audio/v3_0/IAudioAdapter.idl | 260 +++++++++++++++++ audio/v3_0/IAudioCallback.idl | 67 +++++ audio/v3_0/IAudioCapture.idl | 381 +++++++++++++++++++++++++ audio/v3_0/IAudioManager.idl | 86 ++++++ audio/v3_0/IAudioRender.idl | 474 +++++++++++++++++++++++++++++++ 8 files changed, 1825 insertions(+), 4 deletions(-) create mode 100644 audio/v3_0/AudioTypes.idl create mode 100644 audio/v3_0/BUILD.gn create mode 100644 audio/v3_0/IAudioAdapter.idl create mode 100644 audio/v3_0/IAudioCallback.idl create mode 100644 audio/v3_0/IAudioCapture.idl create mode 100644 audio/v3_0/IAudioManager.idl create mode 100644 audio/v3_0/IAudioRender.idl diff --git a/audio/bundle.json b/audio/bundle.json index cad30a25..3b39e056 100644 --- a/audio/bundle.json +++ b/audio/bundle.json @@ -26,7 +26,7 @@ "build": { "sub_component": [ "//drivers/interface/audio/effect/v1_0:libeffect_proxy_1.0", - "//drivers/interface/audio/v2_0:libaudio_proxy_2.0" + "//drivers/interface/audio/v3_0:libaudio_proxy_2.0" ], "test": [ ], @@ -56,7 +56,7 @@ } }, { - "name": "//drivers/interface/audio/v2_0:libaudio_proxy_2.0", + "name": "//drivers/interface/audio/v3_0:libaudio_proxy_3.0", "header": { "header_files": [ ], @@ -64,7 +64,7 @@ } }, { - "name": "//drivers/interface/audio/v2_0:audio_idl_headers", + "name": "//drivers/interface/audio/v3_0:audio_idl_headers", "header": { "header_files": [ ], @@ -72,7 +72,7 @@ } }, { - "name": "//drivers/interface/audio/v2_0:libaudio_stub_2.0", + "name": "//drivers/interface/audio/v3_0:libaudio_stub_3.0", "header": { "header_files": [ ], diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl new file mode 100644 index 00000000..e01c0759 --- /dev/null +++ b/audio/v3_0/AudioTypes.idl @@ -0,0 +1,515 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +/** + * @brief Enumerates the audio port type. + */ +enum AudioPortDirection { + PORT_OUT = 1, /**< Output port */ + PORT_IN = 2, /**< Input port */ + PORT_OUT_IN = 3, /**< Input/output port, supporting both audio input and output */ +}; + +/** + * @brief Enumerates the pin of an audio adapter. + */ +enum AudioPortPin { + PIN_NONE = 0, /**< Invalid pin */ + PIN_OUT_SPEAKER = 1 << 0, /**< Speaker output pin */ + PIN_OUT_HEADSET = 1 << 1, /**< Wired headset pin for output */ + PIN_OUT_LINEOUT = 1 << 2, /**< Line-out pin */ + PIN_OUT_HDMI = 1 << 3, /**< HDMI output pin */ + PIN_OUT_USB = 1 << 4, /**< USB output pin */ + PIN_OUT_USB_EXT = 1 << 5, /**< Extended USB output pin*/ + PIN_OUT_EARPIECE = 1 << 5 | 1 << 4, /**< Earpiece output pin */ + PIN_OUT_BLUETOOTH_SCO = 1 << 6, /**< Bluetooth SCO output pin */ + PIN_OUT_DAUDIO_DEFAULT = 1 << 7, /**< Daudio default output pin */ + PIN_OUT_HEADPHONE = 1 << 8, /**< Wired headphone output pin*/ + PIN_OUT_USB_HEADSET = 1 << 9, /**< ARM USB out pin */ + PIN_OUT_BLUETOOTH_A2DP = 1 << 10, /**< Bluetooth A2DP output pin */ + PIN_OUT_DP = 1 << 11, /**< Dp output pin */ + PIN_IN_MIC = 1 << 27 | 1 << 0, /**< Microphone input pin */ + PIN_IN_HS_MIC = 1 << 27 | 1 << 1, /**< Wired headset microphone pin for input */ + PIN_IN_LINEIN = 1 << 27 | 1 << 2, /**< Line-in pin */ + PIN_IN_USB_EXT = 1 << 27 | 1 << 3, /**< Extended USB input pin*/ + PIN_IN_BLUETOOTH_SCO_HEADSET = 1 << 27 | 1 << 4, /**< Bluetooth SCO headset input pin */ + PIN_IN_DAUDIO_DEFAULT = 1 << 27 | 1 << 5, /**< Daudio default input pin */ + PIN_IN_USB_HEADSET = 1 << 27 | 1 << 6, /**< ARM USB input pin */ +}; + +/** + * @brief Enumerates the audio category. + */ +enum AudioCategory { + AUDIO_IN_MEDIA = 0, /**< Media */ + AUDIO_IN_COMMUNICATION = 1, /**< Communications */ + AUDIO_IN_RINGTONE = 2, /**< Ringtone */ + AUDIO_IN_CALL = 3, /**< Call */ + AUDIO_MMAP_NOIRQ = 4, /**< Mmap mode */ + AUDIO_OFFLOAD = 5, /**< Offload */ + AUDIO_MULTI_CHANNEL = 6, /**< Multi channel */ + AUDIO_DP = 7, /**< Audio dp */ +}; + +/** + * @brief Enumerates the audio format. + */ +enum AudioFormat { + AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8-bit PCM */ + AUDIO_FORMAT_TYPE_PCM_16_BIT = 1 << 1, /**< 16-bit PCM */ + AUDIO_FORMAT_TYPE_PCM_24_BIT = 1 << 1 | 1 << 0, /**< 24-bit PCM */ + AUDIO_FORMAT_TYPE_PCM_32_BIT = 1 << 2, /**< 32-bit PCM */ + AUDIO_FORMAT_TYPE_PCM_FLOAT = 1 << 2 | 1 << 0, /**< FLOAT PCM */ + AUDIO_FORMAT_TYPE_MP3 = 1 << 24, /**< MP3 */ + AUDIO_FORMAT_TYPE_AAC_MAIN = 1 << 24 | 1 << 0, /**< AAC main */ + AUDIO_FORMAT_TYPE_AAC_LC = 1 << 24 | 1 << 1, /**< AAC LC */ + AUDIO_FORMAT_TYPE_AAC_LD = 1 << 24 | 1 << 1 | 1 << 0, /**< AAC LD */ + AUDIO_FORMAT_TYPE_AAC_ELD = 1 << 24 | 1 << 2, /**< AAC ELD */ + AUDIO_FORMAT_TYPE_AAC_HE_V1 = 1 << 24 | 1 << 2 | 1 << 0, /**< AAC HE_V1 */ + AUDIO_FORMAT_TYPE_AAC_HE_V2 = 1 << 24 | 1 << 2 | 1 << 1, /**< AAC HE_V2 */ + AUDIO_FORMAT_TYPE_G711A = 1 << 25 | 1 << 0, /**< G711A */ + AUDIO_FORMAT_TYPE_G711U = 1 << 25 | 1 << 1, /**< G711u */ + AUDIO_FORMAT_TYPE_G726 = 1 << 25 | 1 << 1 | 1 << 0, /**< G726 */ +}; + +/** + * @brief Enumerates the audio channel mask. + * + * A mask describes an audio channel position. + */ +enum AudioChannelMask { + AUDIO_CHANNEL_FRONT_LEFT = 1, /**< Front left channel */ + AUDIO_CHANNEL_FRONT_RIGHT = 2, /**< Front right channel */ + AUDIO_CHANNEL_MONO = 1, /**< Mono channel */ + AUDIO_CHANNEL_STEREO = 3, /**< Stereo channel, consisting of front left and front right channels */ +}; + +/** + * @brief Enumerates masks of audio sampling rates. + */ +enum AudioSampleRatesMask { + AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8 kHz */ + AUDIO_SAMPLE_RATE_MASK_12000 = 1 << 1, /**< 12 kHz */ + AUDIO_SAMPLE_RATE_MASK_11025 = 1 << 2, /**< 11.025 kHz */ + AUDIO_SAMPLE_RATE_MASK_16000 = 1 << 3, /**< 16 kHz */ + AUDIO_SAMPLE_RATE_MASK_22050 = 1 << 4, /**< 22.050 kHz */ + AUDIO_SAMPLE_RATE_MASK_24000 = 1 << 5, /**< 24 kHz */ + AUDIO_SAMPLE_RATE_MASK_32000 = 1 << 6, /**< 32 kHz */ + AUDIO_SAMPLE_RATE_MASK_44100 = 1 << 7, /**< 44.1 kHz */ + AUDIO_SAMPLE_RATE_MASK_48000 = 1 << 8, /**< 48 kHz */ + AUDIO_SAMPLE_RATE_MASK_64000 = 1 << 9, /**< 64 kHz */ + AUDIO_SAMPLE_RATE_MASK_96000 = 1 << 10, /**< 96 kHz */ + AUDIO_SAMPLE_RATE_MASK_INVALID = 4294967295, /**< Invalid sampling rate */ +}; + +/** + * @brief Enumerates the passthrough data transmission mode of an audio port. + */ +enum AudioPortPassthroughMode { + PORT_PASSTHROUGH_LPCM = 1 << 0, /**< Stereo PCM */ + PORT_PASSTHROUGH_RAW = 1 << 1, /**< HDMI passthrough */ + PORT_PASSTHROUGH_HBR2LBR = 1 << 2, /**< Blu-ray next-generation audio output with reduced specifications */ + PORT_PASSTHROUGH_AUTO = 1 << 3, /**< Mode automatically matched based on the HDMI EDID */ +}; + +/** + * @brief Defines formats of raw audio samples. + */ +enum AudioSampleFormat { + /* 8 bits */ + AUDIO_SAMPLE_FORMAT_S8 = 0, /**< signed 8 bit sample */ + AUDIO_SAMPLE_FORMAT_S8P = 1, /**< signed 8 bit planar sample */ + AUDIO_SAMPLE_FORMAT_U8 = 2, /**< unsigned 8 bit sample */ + AUDIO_SAMPLE_FORMAT_U8P = 3, /**< unsigned 8 bit planar sample */ + /* 16 bits */ + AUDIO_SAMPLE_FORMAT_S16 = 4, /**< signed 16 bit sample */ + AUDIO_SAMPLE_FORMAT_S16P = 5, /**< signed 16 bit planar sample */ + AUDIO_SAMPLE_FORMAT_U16 = 6, /**< unsigned 16 bit sample */ + AUDIO_SAMPLE_FORMAT_U16P = 7, /**< unsigned 16 bit planar sample */ + /* 24 bits */ + AUDIO_SAMPLE_FORMAT_S24 = 8, /**< signed 24 bit sample */ + AUDIO_SAMPLE_FORMAT_S24P = 9, /**< signed 24 bit planar sample */ + AUDIO_SAMPLE_FORMAT_U24 = 10, /**< unsigned 24 bit sample */ + AUDIO_SAMPLE_FORMAT_U24P = 11, /**< unsigned 24 bit planar sample */ + /* 32 bits */ + AUDIO_SAMPLE_FORMAT_S32 = 12, /**< signed 32 bit sample */ + AUDIO_SAMPLE_FORMAT_S32P = 13, /**< signed 32 bit planar sample */ + AUDIO_SAMPLE_FORMAT_U32 = 14, /**< unsigned 32 bit sample */ + AUDIO_SAMPLE_FORMAT_U32P = 15, /**< unsigned 32 bit planar sample */ + /* 64 bits */ + AUDIO_SAMPLE_FORMAT_S64 = 16, /**< signed 64 bit sample */ + AUDIO_SAMPLE_FORMAT_S64P = 17, /**< signed 64 bit planar sample */ + AUDIO_SAMPLE_FORMAT_U64 = 18, /**< unsigned 64 bit sample */ + AUDIO_SAMPLE_FORMAT_U64P = 19, /**< unsigned 64 bit planar sample */ + /* float double */ + AUDIO_SAMPLE_FORMAT_F32 = 20, /**< float 32 bit sample */ + AUDIO_SAMPLE_FORMAT_F32P = 21, /**< float 32 bit planar sample */ + AUDIO_SAMPLE_FORMAT_F64 = 22, /**< double 64 bit sample */ + AUDIO_SAMPLE_FORMAT_F64P = 23, /**< double 64 bit planar sample */ +}; + +/** + * @brief Enumerates channel modes for audio rendering. + * + * @attention The following modes are set for rendering dual-channel audios. Others are not supported. + */ +enum AudioChannelMode { + AUDIO_CHANNEL_NORMAL = 0, /**< Normal mode. No processing is required. */ + AUDIO_CHANNEL_BOTH_LEFT = 1, /**< Two left channels */ + AUDIO_CHANNEL_BOTH_RIGHT = 2, /**< Two right channels */ + AUDIO_CHANNEL_EXCHANGE = 3, /**< Data exchange between the left and right channels. The left channel takes the audio + * stream of the right channel, and the right channel takes that of the left channel. + */ + AUDIO_CHANNEL_MIX = 4, /**< Mix of streams of the left and right channels */ + AUDIO_CHANNEL_LEFT_MUTE = 5, /**< Left channel muted. The stream of the right channel is output. */ + AUDIO_CHANNEL_RIGHT_MUTE = 6, /**< Right channel muted. The stream of the left channel is output. */ + AUDIO_CHANNEL_BOTH_MUTE = 7, /**< Both left and right channels are muted */ +}; + +/** + * @brief Enumerates the execution types of the DrainBuffer function. + */ +enum AudioDrainNotifyType { + AUDIO_DRAIN_NORMAL_MODE = 0, /**< The DrainBuffer function returns after all data finishes playback. */ + AUDIO_DRAIN_EARLY_MODE = 1, /**< The DrainBuffer function returns before all the data of the current track + * finishes playback to reserve time for a smooth track switch by the audio service. + */ + +}; + +/** + * @brief Enumerates callback notification events. + */ +enum AudioCallbackType { + AUDIO_NONBLOCK_WRITE_COMPLETED = 0, /**< The non-block write is complete. */ + AUDIO_DRAIN_COMPLETED = 1, /**< The draining is complete. */ + AUDIO_FLUSH_COMPLETED = 2, /**< The flush is complete. */ + AUDIO_RENDER_FULL = 3, /**< The render buffer is full.*/ + AUDIO_ERROR_OCCUR = 4, /**< An error occurs.*/ +}; + +/** + * @brief Describes AudioPortRole. + */ +enum AudioPortRole { + AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< Unassigned port role */ + AUDIO_PORT_SOURCE_ROLE = 1, /**< Assigned source role */ + AUDIO_PORT_SINK_ROLE = 2, /**< Assigned sink role */ +}; + +/** + * @brief Describes AudioPortType. + */ +enum AudioPortType { + AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< Unassigned port type */ + AUDIO_PORT_DEVICE_TYPE = 1, /**< Assigned device type */ + AUDIO_PORT_MIX_TYPE = 2, /**< Assigned mix type */ + AUDIO_PORT_SESSION_TYPE = 3, /**< Assigned session type */ +}; + +/** + * @brief Describes AudioSessionType. + */ +enum AudioSessionType { + AUDIO_OUTPUT_STAGE_SESSION = 0, /**< Assigned output stage session */ + AUDIO_OUTPUT_MIX_SESSION = 1, /**< Assigned output mix session */ + AUDIO_ALLOCATE_SESSION = 2, /**< Assigned allocate session */ + AUDIO_INVALID_SESSION = 3, /**< Assigned invalid session */ +}; + +/** + * @brief Describes AudioDeviceType. + */ +enum AudioDeviceType { + AUDIO_LINEOUT = 1 << 0, /**< Assigned lineout device type */ + AUDIO_HEADPHONE = 1 << 1, /**< Assigned headphone device type */ + AUDIO_HEADSET = 1 << 2, /**< Assigned headset device type */ + AUDIO_USB_HEADSET = 1 << 3, /**< Assigned usb headset device type */ + AUDIO_USB_HEADPHONE = 1 << 4, /**< Assigned usb headphone device type */ + AUDIO_USBA_HEADSET = 1 << 5, /**< Assigned usba headset device type */ + AUDIO_USBA_HEADPHONE = 1 << 6, /**< Assigned usba headphone device type */ + AUDIO_PRIMARY_DEVICE = 1 << 7, /**< Assigned primary device type */ + AUDIO_USB_DEVICE = 1 << 8, /**< Assigned usb device type */ + AUDIO_A2DP_DEVICE = 1 << 9, /**< Assigned a2dp device type */ + AUDIO_HDMI_DEVICE = 1 << 10, /**< Assigned hdmi device type */ + AUDIO_ADAPTER_DEVICE = 1 << 11, /**< Assigned adapter device type */ + AUDIO_DP_DEVICE = 1 << 12, /**< Assigned dp device type */ + AUDIO_DEVICE_UNKNOWN, /**< Assigned unknown device type */ +}; + +/** + * @brief Describes AudioEventType. + */ +enum AudioEventType { + AUDIO_DEVICE_ADD = 1, /**< Assigned add device event type */ + AUDIO_DEVICE_REMOVE = 2, /**< Assigned remove device event type */ + AUDIO_LOAD_SUCCESS = 3, /**< Assigned load sucess event type */ + AUDIO_LOAD_FAILURE = 4, /**< Assigned load failure event type */ + AUDIO_UNLOAD = 5, /**< Assigned unload event type */ + AUDIO_SERVICE_VALID = 7, /**< Assigned valid service event type */ + AUDIO_SERVICE_INVALID = 8, /**< Assigned invalid service event type */ + AUDIO_CAPTURE_THRESHOLD = 9, /**< Assigned threshold capture event type */ + AUDIO_EVENT_UNKNOWN = 10, /**< Assigned unknown event type */ +}; + +/** + * @brief Enumerates the restricted key type of the parameters + */ +enum AudioExtParamKey { + AUDIO_EXT_PARAM_KEY_NONE = 0, /**< Distributed audio extra param key none */ + AUDIO_EXT_PARAM_KEY_VOLUME = 1, /**< Distributed audio extra param key volume event */ + AUDIO_EXT_PARAM_KEY_FOCUS = 2, /**< Distributed audio extra param key focus event */ + AUDIO_EXT_PARAM_KEY_BUTTON = 3, /**< Distributed audio extra param key media button event */ + AUDIO_EXT_PARAM_KEY_EFFECT = 4, /**< Distributed audio extra param key audio effect event */ + AUDIO_EXT_PARAM_KEY_STATUS = 5, /**< Distributed audio extra param key device status event */ + AUDIO_EXT_PARAM_KEY_USB_DEVICE = 101, /**< Check USB device type ARM or HIFI */ + AUDIO_EXT_PARAM_KEY_PERF_INFO = 201, /**< Distributed audio extra param key dsp load event */ + AUDIO_EXT_PARAM_KEY_MMI = 301, /**< Distributed audio extra param key Man-Machine interface Test */ + AUDIO_EXT_PARAM_KEY_LOWPOWER = 1000, /**< Low power event type */ +}; + +/** + * @brief Describes status of audio deivce.@link enum AudioDeviceType + */ +struct AudioDeviceStatus { + unsigned int pnpStatus; /**< Audio pnp status */ +}; + +/** + * @brief Describes the audio scene. + */ +union SceneDesc { + unsigned int id; /**< Audio scene ID */ +}; + +/** + * @brief Defines the audio port. + */ +struct AudioPort { + enum AudioPortDirection dir; /**< Audio port type. For details, see {@link AudioPortDirection} */ + unsigned int portId; /**< Audio port ID */ + String portName; /**< Audio port name */ +}; + +/** + * @brief Defines the audio adapter descriptor. + * + * An audio adapter is a set of port drivers for a sound card, including the output and input ports. + * One port corresponds to multiple pins, and each pin belongs to a physical component (such as a + * speaker or a wired headset). + */ +struct AudioAdapterDescriptor { + String adapterName; /**< Name of the audio adapter */ + struct AudioPort[] ports; /**< List of ports supported by an audio adapter */ +}; + +/** + * @brief Defines the audio device descriptor. + */ +struct AudioDeviceDescriptor { + unsigned int portId; /**< Audio port ID */ + enum AudioPortPin pins; /**< Pins of audio ports (input and output). For details, see {@link AudioPortPin}. */ + String desc; /**< Audio device name */ +}; + +/** + * @brief Defines the audio scene descriptor. + */ +struct AudioSceneDescriptor { + union SceneDesc scene; /**< Describes the audio scene */ + struct AudioDeviceDescriptor desc; /**< Audio device descriptor */ +}; + +/** + * @brief Defines audio input type. + */ +enum AudioInputType { + AUDIO_INPUT_DEFAULT_TYPE = 0, /**< Assigned default input type */ + AUDIO_INPUT_MIC_TYPE = 1 << 0, /**< Assigned mic input type */ + AUDIO_INPUT_SPEECH_WAKEUP_TYPE = 1 << 1, /**< Assigned speech wakeup input type */ + AUDIO_INPUT_VOICE_COMMUNICATION_TYPE = 1 << 2, /**< Assigned voice communication input type */ + AUDIO_INPUT_VOICE_RECOGNITION_TYPE = 1 << 3, /**< Assigned voice recognition input type */ + AUDIO_INPUT_VOICE_UPLINK_TYPE = 1 << 4, /**< Assigned voice uplink input type */ + AUDIO_INPUT_VOICE_DOWNLINK_TYPE = 1 << 5, /**< Assigned voice downlink input type */ + AUDIO_INPUT_VOICE_CALL_TYPE = 1 << 6, /**< Assigned voice call input type */ + AUDIO_INPUT_CAMCORDER_TYPE = 1 << 7, /**< Assigned camcorder input type */ +}; + +/** + * @brief Defines audio offload attributes. + */ +struct AudioOffloadInfo +{ + unsigned int sampleRate; /**< Audio sampling rate */ + unsigned int channelCount; /**< Number of audio channels */ + unsigned long channelLayout; /**< Audio channel layout */ + unsigned int bitRate; /**< bitRate of compressed audio data */ + unsigned int bitWidth; /**< bitwidth of audio data */ + enum AudioFormat format; /**< Audio data format. */ + unsigned int offloadBufferSize; /**< buffersize for offload audio data */ + unsigned long duration; /** audio duration, unit is nanosecond*/ +}; + +/** + * @brief Defines audio sampling attributes. + */ +struct AudioSampleAttributes { + enum AudioCategory type; /**< Audio type. For details, see {@link AudioCategory} */ + boolean interleaved; /**< Interleaving flag of audio data */ + enum AudioFormat format; /**< Audio data format. For details, see {@link AudioFormat}. */ + unsigned int sampleRate; /**< Audio sampling rate */ + unsigned int channelCount; /**< Number of audio channels. For example, for the mono channel, the value is 1, + * and for the stereo channel, the value is 2. + */ + unsigned long channelLayout; /**< Audio channel layout */ + unsigned int period; /**< Audio sampling period */ + unsigned int frameSize; /**< Frame size of the audio data */ + boolean isBigEndian; /**< Big endian flag of audio data */ + boolean isSignedData; /**< Signed or unsigned flag of audio data */ + unsigned int startThreshold; /**< Audio render start threshold. */ + unsigned int stopThreshold; /**< Audio render stop threshold. */ + unsigned int silenceThreshold; /**< Audio capture buffer threshold. */ + int streamId; /**< Audio Identifier of render or capture */ + int sourceType; /**< Audio sourceType of render or capture */ + struct AudioOffloadInfo offloadInfo; /**< offload info for offload stream */ +}; + +/** + * @brief Defines the audio timestamp, which is a substitute for POSIX timespec. + */ +struct AudioTimeStamp { + long tvSec; /**< Seconds */ + long tvNSec; /**< Nanoseconds */ +}; + +/** + * @brief Defines the sub-port capability. + */ +struct AudioSubPortCapability { + unsigned int portId; /**< Sub-port ID */ + String desc; /**< Sub-port name */ + enum AudioPortPassthroughMode mask; /**< Passthrough mode of data transmission. For details, + * see {@link AudioPortPassthroughMode}. + */ +}; + +/** + * @brief Defines the audio port capability. + */ +struct AudioPortCapability { + unsigned int deviceType; /**< Device type (output or input) */ + unsigned int deviceId; /**< Device ID used for device binding */ + boolean hardwareMode; /**< Whether to support device binding */ + unsigned int formatNum; /**< Number of the supported audio formats */ + enum AudioFormat[] formats; /**< Supported audio formats. For details, see {@link AudioFormat}. */ + unsigned int sampleRateMasks; /**< Supported audio sampling rates (8 kHz, 16 kHz, 32 kHz, and 48 kHz) */ + enum AudioChannelMask channelMasks; /**< Audio channel layout mask of the device. For details, + * see {@link AudioChannelMask}. + */ + unsigned int channelCount; /**< Supported maximum number of audio channels */ + struct AudioSubPortCapability[] subPorts; /**< List of supported sub-ports */ + enum AudioSampleFormat[] supportSampleFormats; /**< Supported audio sample formats. For details, + * see {@link AudioSampleFormat}. + */ +}; + +/** + * @brief Describes a mmap buffer. + */ +struct AudioMmapBufferDescriptor { + byte[] memoryAddress; /**< Pointer to the mmap buffer */ + FileDescriptor memoryFd; /**< File descriptor of the mmap buffer */ + int totalBufferFrames; /**< Total size of the mmap buffer (unit: frame )*/ + int transferFrameSize; /**< Transfer size (unit: frame) */ + int isShareable; /**< Whether the mmap buffer can be shared among processes */ + unsigned int offset; /**< off set */ + String filePath; /**< file path */ +}; + +/** + * @brief Describes AudioDevExtInfo. + */ +struct AudioDevExtInfo { + int moduleId; /**< Identifier of the module stream is attached to */ + enum AudioPortPin type; /**< Device type For details, see {@link AudioPortPin}. */ + String desc; /**< Address */ +}; + +/** + * @brief Describes AudioMixInfo. + */ +struct AudioMixExtInfo { + int moduleId; /**< Identifier of the module stream is attached to */ + int streamId; /**< Identifier of the capture or render passed by caller */ +}; + +/** + * @brief Describes AudioSessionExtInfo. + */ +struct AudioSessionExtInfo { + enum AudioSessionType sessionType; /**< Audio session type */ +}; + +/** + * @brief Describes AudioInfo. + */ +struct AudioInfo { + struct AudioDevExtInfo device; /* Specific Device Ext info */ + struct AudioMixExtInfo mix; /* Specific mix info */ + struct AudioSessionExtInfo session; /* session specific info */ +}; + +/** + * @brief Describes AudioRouteNode. + */ +struct AudioRouteNode { + int portId; /**< Audio port ID */ + enum AudioPortRole role; /**< Audio port as a sink or a source */ + enum AudioPortType type; /**< device, mix ... */ + struct AudioInfo ext; /**< The ext object */ +}; + +/** + * @brief Describes AudioRoute. + */ +struct AudioRoute { + struct AudioRouteNode[] sources; /**< List of sources */ + struct AudioRouteNode[] sinks; /**< List of sinks */ +}; + +/** + * @brief Describes AudioEvent. + */ +struct AudioEvent { + unsigned int eventType; /**< @link enum AudioEventType */ + unsigned int deviceType; /**< @link enum AudioDeviceType */ +}; diff --git a/audio/v3_0/BUILD.gn b/audio/v3_0/BUILD.gn new file mode 100644 index 00000000..87d06952 --- /dev/null +++ b/audio/v3_0/BUILD.gn @@ -0,0 +1,38 @@ +# Copyright (c) 2023 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("../../../hdf_core/adapter/uhdf2/hdi.gni") + +if (defined(ohos_lite)) { + group("libaudio_proxy_3.0") { + deps = [] + public_configs = [] + } +} else { + hdi("audio") { + module_name = "audio_service" + + sources = [ + "AudioTypes.idl", + "IAudioAdapter.idl", + "IAudioCallback.idl", + "IAudioCapture.idl", + "IAudioManager.idl", + "IAudioRender.idl", + ] + + language = "c" + subsystem_name = "hdf" + part_name = "drivers_interface_audio" + } +} diff --git a/audio/v3_0/IAudioAdapter.idl b/audio/v3_0/IAudioAdapter.idl new file mode 100644 index 00000000..a32f7b62 --- /dev/null +++ b/audio/v3_0/IAudioAdapter.idl @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +import ohos.hdi.audio.v3_0.AudioTypes; +import ohos.hdi.audio.v3_0.IAudioRender; +import ohos.hdi.audio.v3_0.IAudioCapture; +import ohos.hdi.audio.v3_0.IAudioCallback; + +/** + * @brief Provides audio adapter capabilities, including initializing ports, creating rendering and capturing tasks, + * and obtaining the port capability set. + * + * @see IAudioRender + * @see IAudioCapture + * @since 5.0 + * @version 3.0 + */ +interface IAudioAdapter { + /** + * @brief Initializes all ports of an audio adapter. + * + * Call this function before calling other driver functions to check whether the initialization is complete. + * If the initialization is not complete, wait for a while (for example, 100 ms) and perform the check again + * until the port initialization is complete. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @return Returns 0 if the initialization is successful; returns a negative value otherwise. + */ + InitAllPorts(); + + /** + * @brief Creates an IAudioRender object. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param desc Indicates the pointer to the descriptor of the audio adapter to start. + * @param attrs Indicates the pointer to the audio sampling attributes to open. + * @param render Indicates the double pointer to the IAudioRender object. + * @return Returns 0 if the IAudioRender object is created successfully; + * returns a negative value otherwise. + * @see GetPortCapability + * @see DestroyRender + */ + CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioRender render, [out] unsigned int renderId); + + /** + * @brief Destroys an IAudioRender object. + * + * @attention Do not destroy the object during audio rendering. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param render Indicates the pointer to the IAudioRender object to operate. + * @return Returns 0 if the IAudioRender object is destroyed; returns a negative value otherwise. + * @see CreateRender + */ + DestroyRender([in] unsigned int renderId); + + /** + * @brief Creates an IAudioCapture object. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param desc Indicates the pointer to the descriptor of the audio adapter to start. + * @param attrs Indicates the pointer to the audio sampling attributes to open. + * @param capture Indicates the double pointer to the IAudioCapture object. + * @return Returns 0 if the IAudioCapture object is created successfully; + * returns a negative value otherwise. + * @see GetPortCapability + * @see DestroyCapture + */ + CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, + [out] IAudioCapture capture, [out] unsigned int captureId); + + /** + * @brief Destroys an IAudioCapture object. + * + * @attention Do not destroy the object during audio capturing. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param capture Indicates the pointer to the IAudioCapture object to operate. + * @return Returns 0 if the IAudioCapture object is destroyed; returns a negative value otherwise. + * @see CreateCapture + */ + DestroyCapture([in] unsigned int captureId); + + /** + * @brief Obtains the capability set of the port driver for the audio adapter. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param port Indicates the pointer to the port. + * @param capability Indicates the pointer to the capability set to obtain. + * @return Returns 0 if the capability set is successfully obtained; returns a negative value otherwise. + */ + GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); + + /** + * @brief Sets the passthrough data transmission mode of the audio port driver. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param port Indicates the pointer to the port. + * @param mode Indicates the passthrough transmission mode to set. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetPassthroughMode + */ + SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); + + /** + * @brief Obtains the passthrough data transmission mode of the audio port driver. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param port Indicates the pointer to the port. + * @param mode Indicates the pointer to the passthrough transmission mode to obtain. + * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. + * @see SetPassthroughMode + */ + GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); + + /** + * @brief Get the device status of an adapter. + * + * @param adapter Indicates the audio adapter. + * @param status Indicates the status of device . + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetDeviceStatus([out] struct AudioDeviceStatus status); + + /** + * @brief Update audio route on several source and sink ports. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param route Indicates route information. + * @param routeHandle Indicates route handle. + * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. + * @see SetPassthroughMode + */ + UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); + + /** + * @brief Release an audio route. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param routeHandle Indicates route handle. + * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. + * @see SetPassthroughMode + */ + ReleaseAudioRoute([in] int routeHandle); + + /** + * @brief Sets the mute operation for the audio. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param mute Specifies whether to mute the audio. Value true means to mute the audio, + * and false means the opposite. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetMute + */ + SetMicMute([in] boolean mute); + + /** + * @brief Obtains the mute operation set for the audio. + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param mute Indicates the pointer to the mute operation set for the audio. Value true means that + * the audio is muted, and false means the opposite. + * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. + * @see SetMute + */ + GetMicMute([out] boolean mute); + + /** + * @brief Sets the audio volume for voice call. + * + * The volume ranges from 0.0 to 1.0. If the volume level in an audio service ranges from 0 to 15, + * 0.0 indicates that the audio is muted, and 1.0 indicates the maximum volume level (15). + * + * @param adapter Indicates the pointer to the audio adapter to operate. + * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetVolume + */ + SetVoiceVolume([in] float volume); + + /** + * @brief Sets extra audio parameters. + * + * @param adapter Indicates the audio adapter. + * @param key Indicates what kind of parameter type will be set. + * @param condition Indicates the specific extend parameter condition of AudioExtParamKey. + * @param value Indicates the value of the specified condition. + * + * The format of condition is key=value. Separate multiple key-value pairs by semicolons (;). + * When key equals to AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME, the format of condition must be like this: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE indicates sub volume event type: SetVolume = 1; SetMute = 4; + * VOLUME_GROUP_ID indicates which volume group will be set; + * AUDIO_VOLUME_TYPE indicates which volume type will be set; + * + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); + + /** + * @brief Get extra audio parameters. + * + * @param adapter Indicates the audio adapter. + * @param key Indicates what kind of parameter type will be get. + * @param condition Indicates the specific extend parameter condition of AudioExtParamKey. + * @param value Indicates the value of the specified condition. + * @param lenth Indicates the length of the value pointer. + * + * The format of condition is key=value. Separate multiple key-value pairs by semicolons (;). + * When key equals to AudioExtParamKey::AUDIO_EXT_PARAM_KEY_VOLUME, the format of condition must be like this: + * "EVENT_TYPE=xxx;VOLUME_GROUP_ID=xxx;AUDIO_VOLUME_TYPE=xxx;" + * EVENT_TYPE indicates sub volume event type: GetVolume = 1; GetMinVolume = 2; GetMaxVolume = 3; IsStreamMute = 4; + * VOLUME_GROUP_ID indicates which volume group want get; + * AUDIO_VOLUME_TYPE indicates which volume type want get; + * + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); + + /** + * @brief Register extra audio parameters observer. + * + * @param adapter Indicates the audio adapter. + * @param callback Indicates param observer. + * @param cookie Indicates the pointer to the callback parameters; + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); +} +/** @} */ \ No newline at end of file diff --git a/audio/v3_0/IAudioCallback.idl b/audio/v3_0/IAudioCallback.idl new file mode 100644 index 00000000..151ae418 --- /dev/null +++ b/audio/v3_0/IAudioCallback.idl @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +import ohos.hdi.audio.v3_0.AudioTypes; + +/** + * @brief Called when an event defined in {@link AudioCallbackType} occurs. + * + * @param AudioCallbackType Indicates the occurred event that triggers this callback. + * @param reserved Indicates the pointer to a reserved field. + * @param cookie Indicates the pointer to the cookie for data transmission. + * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. + * @see RegCallback + */ +[callback] interface IAudioCallback { +/** + * @brief Called when an event defined in {@link AudioCallbackType} occurs. + * + * @param AudioCallbackType Indicates the occurred event that triggers this callback. + * @param reserved Indicates the pointer to a reserved field. + * @param cookie Indicates the pointer to the cookie for data transmission. + * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. + * @see RegCallback + */ + RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); + +/** + * @brief Register audio extra param callback that will be invoked during audio param event. + * + * @param key Indicates param change event. + * @param condition Indicates the param condition. + * @param value Indicates the param value. + * @param reserved Indicates reserved param. + * @param cookie Indicates the pointer to the callback parameters; + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); +} diff --git a/audio/v3_0/IAudioCapture.idl b/audio/v3_0/IAudioCapture.idl new file mode 100644 index 00000000..81bc1b03 --- /dev/null +++ b/audio/v3_0/IAudioCapture.idl @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +import ohos.hdi.audio.v3_0.AudioTypes; + + +/** + * @brief Provides capabilities for audio capturing, including controlling the capturing, setting audio attributes, + * scenes, and volume, and capturing audio frames. + * @since 5.0 + * @version 3.0 + */ +interface IAudioCapture { + /** + * @brief Reads a frame of input data (uplink data) from the audio driver for capturing. + * + * @param capture Indicates the pointer to the IAudioCapture object to operate. + * @param frame Indicates the pointer to the input data to read. + * @param requestBytes Indicates the size of the input data, in bytes. + * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to read. + * @return Returns 0 if the input data is read successfully; returns a negative value otherwise. + */ + CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of input audio frames. + * + * @param capture Indicates the pointer to the IAudioCapture object to operate. + * @param frames Indicates the pointer to the last number of input audio frames. + * @param time Indicates the pointer to the timestamp associated with the frame. + * @return Returns 0 if the last number is obtained; returns a negative value otherwise. + * @see CaptureFrame + */ + GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief Checks whether the configuration of an audio scene is supported. + * + * @param handle Indicates the audio handle. + * @param scene Indicates the pointer to the descriptor of the audio scene. + * @param supported Indicates the pointer to the variable specifying whether the configuration is supported. + * Value true means that the configuration is supported, and false means the opposite. + * @return Returns 0 if the result is obtained; returns a negative value otherwise. + * @see SelectScene + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief Selects an audio scene. + * + *
    + *
  • To select a specific audio scene, you need to specify both the application scenario and output device. + * For example, to select a scene using a smartphone speaker as the output device, set scene according + * to the scenarios where the speaker is used. For example:
  • + *
      + *
    • For media playback, set the value to media_speaker.
    • + *
    • For a voice call, set the value to voice_speaker.
    • + *
    + *
  • To select only the application scenario, such as media playback, movie, or gaming, you can set + * scene to media, movie, or game, respectively.
  • + *
  • To select only the output device, such as media receiver, speaker, or headset, you can set + * scene to receiver, speaker, or headset, respectively.
  • + *
+ * @param handle Indicates the audio handle. + * @param scene Indicates the pointer to the descriptor of the audio scene to select. + * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. + * @see CheckSceneCapability + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief Sets the mute operation for the audio. + * + * @param handle Indicates the audio handle. + * @param mute Specifies whether to mute the audio. Value true means to mute the audio, + * and false means the opposite. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetMute + */ + SetMute([in] boolean mute); + + /** + * @brief Obtains the mute operation set for the audio. + * + * @param handle Indicates the audio handle. + * @param mute Indicates the pointer to the mute operation set for the audio. Value true means that + * the audio is muted, and false means the opposite. + * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. + * @see SetMute + */ + GetMute([out] boolean mute); + + /** + * @brief Sets the audio volume. + * + * The volume ranges from 0.0 to 1.0. If the volume level in an audio service ranges from 0 to 15, + * 0.0 indicates that the audio is muted, and 1.0 indicates the maximum volume level (15). + * + * @param handle Indicates the audio handle. + * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetVolume + */ + SetVolume([in] float volume); + + /** + * @brief Obtains the audio volume. + * + * @param handle Indicates the audio handle. + * @param volume Indicates the pointer to the volume to obtain. The value ranges from 0.0 to 1.0. + * @return Returns 0 if the volume is obtained; returns a negative value otherwise. + * @see SetVolume + */ + GetVolume([out] float volume); + + /** + * @brief Obtains the range of the audio gain. + * + * The audio gain can be expressed in one of the following two ways (depending on the chip platform), + * corresponding to two types of value ranges: + *
    + *
  • Actual audio gain values, for example, ranging from -50 to 6 dB
  • + *
  • Float numbers ranging from 0.0 to 1.0, where 0.0 means to mute the audio, + * and 1.0 means the maximum gain value, for example, 6 dB
  • + *
+ * @param handle Indicates the audio handle. + * @param min Indicates the pointer to the minimum value of the range. + * @param max Indicates the pointer to the maximum value of the range. + * @return Returns 0 if the range is obtained; returns a negative value otherwise. + * @see GetGain + * @see SetGain + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief Obtains the audio gain. + * + * @param handle Indicates the audio handle. + * @param gain Indicates the pointer to the audio gain. + * @return Returns 0 if the audio gain is obtained; returns a negative value otherwise. + * @see GetGainThreshold + * @see SetGain + */ + GetGain([out] float gain); + + /** + * @brief Sets the audio gain. + * + * @param handle Indicates the audio handle. + * @param gain Indicates the audio gain to set. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetGainThreshold + * @see GetGain + */ + SetGain([in] float gain); + + /** + * @brief Obtains the audio frame size, that is, the length (in bytes) of a frame. + * + * @param handle Indicates the audio handle. + * @param size Indicates the pointer to the audio frame size (in bytes). + * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief Obtains the number of audio frames in the audio buffer. + * + * @param handle Indicates the audio handle. + * @param count Indicates the pointer to the number of audio frames in the audio buffer. + * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief Sets audio sampling attributes. + * + * @param handle Indicates the audio handle. + * @param attrs Indicates the pointer to the audio sampling attributes to set, such as the sampling rate, + * sampling precision, and channel. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetSampleAttributes + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief Obtains audio sampling attributes. + * + * @param handle Indicates the audio handle. + * @param attrs Indicates the pointer to the audio sampling attributes, such as the sampling rate, + * sampling precision, and channel. + * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. + * @see SetSampleAttributes + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief Obtains the data channel ID of the audio. + * + * @param handle Indicates the audio handle. + * @param channelId Indicates the pointer to the data channel ID. + * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief Sets extra audio parameters. + * + * @param handle Indicates the audio handle. + * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. + * The format is key=value. Separate multiple key-value pairs by semicolons (;). + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief Obtains extra audio parameters. + * + * @param handle Indicates the audio handle. + * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. + * The format is key=value. Separate multiple key-value pairs by semicolons (;). + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief Requests a mmap buffer. + * + * @param handle Indicates the audio handle. + * @param reqSize Indicates the size of the request mmap buffer. + * @param desc Indicates the pointer to the mmap buffer descriptor. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief Obtains the read/write position of the current mmap buffer. + * + * @param handle Indicates the audio handle. + * @param frames Indicates the pointer to the frame where the read/write starts. + * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief Add the audio effect which the effectid indicated. + * + * @param handle Indicates the audio handle. + * @param effectid Indicates the audio effect instance identifier which is going to be added. + * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief Remove the audio effect which the effectid indicated. + * + * @param handle Indicates the audio handle. + * @param effectid Indicates the audio effect which is going to be removed. + * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief Get the buffer size of render or capturer + * + * @param handle Indicates the audio handle. + * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief Starts audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully started; + * returns a negative value otherwise. + * @see Stop + */ + Start(); + + /** + * @brief Stops audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully stopped; + * returns a negative value otherwise. + * @see Start + */ + Stop(); + + /** + * @brief Pauses audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully paused; + * returns a negative value otherwise. + * @see Resume + */ + Pause(); + + /** + * @brief Resumes audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully resumed; + * returns a negative value otherwise. + * @see Pause + */ + Resume(); + + /** + * @brief Flushes data in the audio buffer. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the flush is successful; returns a negative value otherwise. + */ + Flush(); + + /** + * @brief Sets or cancels the standby mode of the audio device. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is + * canceled; returns a negative value if the setting fails. + */ + TurnStandbyMode(); + + /** + * @brief Dumps information about the audio device. + * + * @param handle Indicates the audio handle. + * @param range Indicates the range of the device information to dump, which can be brief or full information. + * @param fd Indicates the file to which the device information will be dumped. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief Query whether the vendor support pause and resume. + * + * @param handle Indicates the audio handle. + * @param supportPause Indicates the state whether the vendor supports pausing. Value true means that + * the vendor supports, and false means the opposite. + * @param supportResume Indicates the state whether the vendor supports resuming. Value true means that + * the vendor supports, and false means the opposite. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @see IsSupportsPauseAndResume + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); +} diff --git a/audio/v3_0/IAudioManager.idl b/audio/v3_0/IAudioManager.idl new file mode 100644 index 00000000..fe134e63 --- /dev/null +++ b/audio/v3_0/IAudioManager.idl @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +import ohos.hdi.audio.v3_0.AudioTypes; +import ohos.hdi.audio.v3_0.IAudioAdapter; + +/** + * @brief Manages audio adapters through a specific adapter driver program loaded based on the given audio + * adapter descriptor. + * + * @see IAudioAdapter + * @since 5.0 + * @version 3.0 + */ +interface IAudioManager { + /** + * @brief Obtains the list of all adapters supported by an audio driver. + * + * @param manager Indicates the pointer to the audio adapter manager to operate. + * @param descs Indicates the double pointer to the audio adapter list. + * @param size Indicates the pointer to the length of the list. + * @return Returns 0 if the list is obtained successfully; returns a negative value otherwise. + * @see LoadAdapter + */ + GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); + + /** + * @brief Loads the driver for an audio adapter. + * + * For example, to load a USB driver, you may need to load a dynamic-link library (*.so) in specific implementation. + * + * @param manager Indicates the pointer to the audio adapter manager to operate. + * @param desc Indicates the pointer to the descriptor of the audio adapter. + * @param adapter Indicates the double pointer to the audio adapter. + * @return Returns 0 if the driver is loaded successfully; returns a negative value otherwise. + * @see GetAllAdapters + * @see UnloadAdapter + */ + LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); + + /** + * @brief Unloads the driver of an audio adapter. + * + * @param manager Indicates the pointer to the audio adapter manager to operate. + * @param adapter Indicates the pointer to the audio adapter whose driver will be unloaded. + * @see LoadAdapter + */ + UnloadAdapter([in] String adapterName); + + /** + * @brief Release the IAudioManager Object. + * + * @param object Indicates the pointer to the audio adapter manager to operate. + * @return Returns true if the Object is released; returns false otherwise. + */ + ReleaseAudioManagerObject(); +} diff --git a/audio/v3_0/IAudioRender.idl b/audio/v3_0/IAudioRender.idl new file mode 100644 index 00000000..8312a0f6 --- /dev/null +++ b/audio/v3_0/IAudioRender.idl @@ -0,0 +1,474 @@ +/* + * Copyright (c) 2023 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 HdiAudio + * @{ + * + * @brief Provides unified APIs for audio services to access audio drivers. + * + * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to + * access different types of audio devices based on the audio IDs, thereby obtaining audio information, + * subscribing to or unsubscribing from audio data, enabling or disabling an audio, + * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. + * + * @since 5.0 + * @version 3.0 + */ + +package ohos.hdi.audio.v3_0; + +import ohos.hdi.audio.v3_0.AudioTypes; +import ohos.hdi.audio.v3_0.IAudioCallback; + +/** + * @brief Provides capabilities for audio rendering, including controlling the rendering, setting audio attributes, + * scenes, and volume, obtaining hardware latency, and rendering audio frames. + * + * @since 5.0 + * @version 3.0 + */ +interface IAudioRender { + /** + * @brief Obtains the estimated latency of the audio device driver. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param ms Indicates the pointer to the latency (in milliseconds) to be obtained. + * @return Returns 0 if the latency is obtained; returns a negative value otherwise. + */ + GetLatency([out] unsigned int ms); + + /** + * @brief Writes a frame of output data (downlink data) into the audio driver for rendering. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param frame Indicates the pointer to the frame to write. + * @param requestBytes Indicates the size of the frame, in bytes. + * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to write. + * @return Returns 0 if the data is written successfully; returns a negative value otherwise. + */ + RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); + + /** + * @brief Obtains the last number of output audio frames. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param frames Indicates the pointer to the last number of output audio frames. + * @param time Indicates the pointer to the timestamp associated with the frame. + * @return Returns 0 if the last number is obtained; returns a negative value otherwise. + * @see RenderFrame + */ + GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief Sets the audio rendering speed. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param speed Indicates the rendering speed to set. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetRenderSpeed + */ + SetRenderSpeed([in] float speed); + + /** + * @brief Obtains the current audio rendering speed. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param speed Indicates the pointer to the current rendering speed to obtain. + * @return Returns 0 if the speed is successfully obtained; returns a negative value otherwise. + * @see SetRenderSpeed + */ + GetRenderSpeed([out] float speed); + + /** + * @brief Sets the channel mode for audio rendering. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param mode Indicates the channel mode to set. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetChannelMode + */ + SetChannelMode([in] enum AudioChannelMode mode); + + /** + * @brief Obtains the current channel mode for audio rendering. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param mode Indicates the pointer to the channel mode to obtain. + * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. + * @see SetChannelMode + */ + GetChannelMode([out] enum AudioChannelMode mode); + + /** + * @brief Registers an audio callback that will be invoked during playback when buffer data writing or + * buffer drain is complete. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param callback Indicates the callback to register. + * @param cookie Indicates the pointer to the callback parameters. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @see RegCallback + */ + RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); + + /** + * @brief Drains the buffer. + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param type Indicates the pointer to the execution type of this function. For details, + * see {@link AudioDrainNotifyType}. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @see RegCallback + */ + DrainBuffer([out] enum AudioDrainNotifyType type); + + /** + * @brief query whether the vendor supports draining buffer + * + * @param render Indicates the pointer to the IAudioRender object to operate. + * @param support indicates the state whether the vendor supports draining buffer. Value true means that + * the vendor supports, and false means the opposite. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @see IsSupportsDrain + */ + IsSupportsDrain([out] boolean support); + + /** + * @brief Checks whether the configuration of an audio scene is supported. + * + * @param handle Indicates the audio handle. + * @param scene Indicates the pointer to the descriptor of the audio scene. + * @param supported Indicates the pointer to the variable specifying whether the configuration is supported. + * Value true means that the configuration is supported, and false means the opposite. + * @return Returns 0 if the result is obtained; returns a negative value otherwise. + * @see SelectScene + */ + CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); + + /** + * @brief Selects an audio scene. + * + *
    + *
  • To select a specific audio scene, you need to specify both the application scenario and output device. + * For example, to select a scene using a smartphone speaker as the output device, set scene according + * to the scenarios where the speaker is used. For example:
  • + *
      + *
    • For media playback, set the value to media_speaker.
    • + *
    • For a voice call, set the value to voice_speaker.
    • + *
    + *
  • To select only the application scenario, such as media playback, movie, or gaming, you can set + * scene to media, movie, or game, respectively.
  • + *
  • To select only the output device, such as media receiver, speaker, or headset, you can set + * scene to receiver, speaker, or headset, respectively.
  • + *
+ * @param handle Indicates the audio handle. + * @param scene Indicates the pointer to the descriptor of the audio scene to select. + * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. + * @see CheckSceneCapability + */ + SelectScene([in] struct AudioSceneDescriptor scene); + + /** + * @brief Sets the mute operation for the audio. + * + * @param handle Indicates the audio handle. + * @param mute Specifies whether to mute the audio. Value true means to mute the audio, + * and false means the opposite. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetMute + */ + SetMute([in] boolean mute); + + /** + * @brief Obtains the mute operation set for the audio. + * + * @param handle Indicates the audio handle. + * @param mute Indicates the pointer to the mute operation set for the audio. Value true means that + * the audio is muted, and false means the opposite. + * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. + * @see SetMute + */ + GetMute([out] boolean mute); + + /** + * @brief Sets the audio volume. + * + * The volume ranges from 0.0 to 1.0. If the volume level in an audio service ranges from 0 to 15, + * 0.0 indicates that the audio is muted, and 1.0 indicates the maximum volume level (15). + * + * @param handle Indicates the audio handle. + * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetVolume + */ + SetVolume([in] float volume); + + /** + * @brief Obtains the audio volume. + * + * @param handle Indicates the audio handle. + * @param volume Indicates the pointer to the volume to obtain. The value ranges from 0.0 to 1.0. + * @return Returns 0 if the volume is obtained; returns a negative value otherwise. + * @see SetVolume + */ + GetVolume([out] float volume); + + /** + * @brief Obtains the range of the audio gain. + * + * The audio gain can be expressed in one of the following two ways (depending on the chip platform), + * corresponding to two types of value ranges: + *
    + *
  • Actual audio gain values, for example, ranging from -50 to 6 dB
  • + *
  • Float numbers ranging from 0.0 to 1.0, where 0.0 means to mute the audio, + * and 1.0 means the maximum gain value, for example, 6 dB
  • + *
+ * @param handle Indicates the audio handle. + * @param min Indicates the pointer to the minimum value of the range. + * @param max Indicates the pointer to the maximum value of the range. + * @return Returns 0 if the range is obtained; returns a negative value otherwise. + * @see GetGain + * @see SetGain + */ + GetGainThreshold([out] float min, [out] float max); + + /** + * @brief Obtains the audio gain. + * + * @param handle Indicates the audio handle. + * @param gain Indicates the pointer to the audio gain. + * @return Returns 0 if the audio gain is obtained; returns a negative value otherwise. + * @see GetGainThreshold + * @see SetGain + */ + GetGain([out] float gain); + + /** + * @brief Sets the audio gain. + * + * @param handle Indicates the audio handle. + * @param gain Indicates the audio gain to set. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetGainThreshold + * @see GetGain + */ + SetGain([in] float gain); + + /** + * @brief Obtains the audio frame size, that is, the length (in bytes) of a frame. + * + * @param handle Indicates the audio handle. + * @param size Indicates the pointer to the audio frame size (in bytes). + * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. + */ + GetFrameSize([out] unsigned long size); + + /** + * @brief Obtains the number of audio frames in the audio buffer. + * + * @param handle Indicates the audio handle. + * @param count Indicates the pointer to the number of audio frames in the audio buffer. + * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. + */ + GetFrameCount([out] unsigned long count); + + /** + * @brief Sets audio sampling attributes. + * + * @param handle Indicates the audio handle. + * @param attrs Indicates the pointer to the audio sampling attributes to set, such as the sampling rate, + * sampling precision, and channel. + * @return Returns 0 if the setting is successful; returns a negative value otherwise. + * @see GetSampleAttributes + */ + SetSampleAttributes([in] struct AudioSampleAttributes attrs); + + /** + * @brief Obtains audio sampling attributes. + * + * @param handle Indicates the audio handle. + * @param attrs Indicates the pointer to the audio sampling attributes, such as the sampling rate, + * sampling precision, and channel. + * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. + * @see SetSampleAttributes + */ + GetSampleAttributes([out] struct AudioSampleAttributes attrs); + + /** + * @brief Obtains the data channel ID of the audio. + * + * @param handle Indicates the audio handle. + * @param channelId Indicates the pointer to the data channel ID. + * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. + */ + GetCurrentChannelId([out] unsigned int channelId); + + /** + * @brief Sets extra audio parameters. + * + * @param handle Indicates the audio handle. + * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. + * The format is key=value. Separate multiple key-value pairs by semicolons (;). + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + SetExtraParams([in] String keyValueList); + + /** + * @brief Obtains extra audio parameters. + * + * @param handle Indicates the audio handle. + * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. + * The format is key=value. Separate multiple key-value pairs by semicolons (;). + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetExtraParams([out] String keyValueList); + + /** + * @brief Requests a mmap buffer. + * + * @param handle Indicates the audio handle. + * @param reqSize Indicates the size of the request mmap buffer. + * @param desc Indicates the pointer to the mmap buffer descriptor. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); + + /** + * @brief Obtains the read/write position of the current mmap buffer. + * + * @param handle Indicates the audio handle. + * @param frames Indicates the pointer to the frame where the read/write starts. + * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); + + /** + * @brief Add the audio effect which the effectid indicated. + * + * @param handle Indicates the audio handle. + * @param effectid Indicates the audio effect instance identifier which is going to be added. + * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. + */ + AddAudioEffect([in] unsigned long effectid); + + /** + * @brief Remove the audio effect which the effectid indicated. + * + * @param handle Indicates the audio handle. + * @param effectid Indicates the audio effect which is going to be removed. + * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. + */ + RemoveAudioEffect([in] unsigned long effectid); + + /** + * @brief Get the buffer size of render or capturer + * + * @param handle Indicates the audio handle. + * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + GetFrameBufferSize([out] unsigned long bufferSize); + + /** + * @brief Starts audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully started; + * returns a negative value otherwise. + * @see Stop + */ + Start(); + + /** + * @brief Stops audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully stopped; + * returns a negative value otherwise. + * @see Start + */ + Stop(); + + /** + * @brief Pauses audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully paused; + * returns a negative value otherwise. + * @see Resume + */ + Pause(); + + /** + * @brief Resumes audio rendering or capturing. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the rendering or capturing is successfully resumed; + * returns a negative value otherwise. + * @see Pause + */ + Resume(); + + /** + * @brief Flushes data in the audio buffer. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the flush is successful; returns a negative value otherwise. + */ + Flush(); + + /** + * @brief Sets or cancels the standby mode of the audio device. + * + * @param handle Indicates the audio handle. + * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is + * canceled; returns a negative value if the setting fails. + */ + TurnStandbyMode(); + + /** + * @brief Dumps information about the audio device. + * + * @param handle Indicates the audio handle. + * @param range Indicates the range of the device information to dump, which can be brief or full information. + * @param fd Indicates the file to which the device information will be dumped. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + AudioDevDump([in] int range, [in] int fd); + + /** + * @brief Query whether the vendor support pause and resume. + * + * @param handle Indicates the audio handle. + * @param supportPause Indicates the state whether the vendor supports pausing. Value true means that + * the vendor supports, and false means the opposite. + * @param supportResume Indicates the state whether the vendor supports resuming. Value true means that + * the vendor supports, and false means the opposite. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @see IsSupportsPauseAndResume + */ + IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); + + /** + * @brief Set offload buffer size. + * + * @param handle Indicates the audio handle. + * @param size Indicates the buffer size which contains the audio data. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + */ + SetBufferSize([in] unsigned int size); +} -- Gitee From 52bcb7d9ed54dd7adfea516e0c3396c2c80d4b45 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 15 Mar 2024 15:30:05 +0800 Subject: [PATCH 074/210] commit msg Signed-off-by: xuxuehai --- audio/v3_0/AudioTypes.idl | 2 +- audio/v3_0/BUILD.gn | 2 +- audio/v3_0/IAudioAdapter.idl | 2 +- audio/v3_0/IAudioCallback.idl | 2 +- audio/v3_0/IAudioCapture.idl | 2 +- audio/v3_0/IAudioManager.idl | 2 +- audio/v3_0/IAudioRender.idl | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index e01c0759..b1566661 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/audio/v3_0/BUILD.gn b/audio/v3_0/BUILD.gn index 87d06952..e7f3a018 100644 --- a/audio/v3_0/BUILD.gn +++ b/audio/v3_0/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 diff --git a/audio/v3_0/IAudioAdapter.idl b/audio/v3_0/IAudioAdapter.idl index a32f7b62..e53a82da 100644 --- a/audio/v3_0/IAudioAdapter.idl +++ b/audio/v3_0/IAudioAdapter.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/audio/v3_0/IAudioCallback.idl b/audio/v3_0/IAudioCallback.idl index 151ae418..207685da 100644 --- a/audio/v3_0/IAudioCallback.idl +++ b/audio/v3_0/IAudioCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/audio/v3_0/IAudioCapture.idl b/audio/v3_0/IAudioCapture.idl index 81bc1b03..392108ff 100644 --- a/audio/v3_0/IAudioCapture.idl +++ b/audio/v3_0/IAudioCapture.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/audio/v3_0/IAudioManager.idl b/audio/v3_0/IAudioManager.idl index fe134e63..4bb8648c 100644 --- a/audio/v3_0/IAudioManager.idl +++ b/audio/v3_0/IAudioManager.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/audio/v3_0/IAudioRender.idl b/audio/v3_0/IAudioRender.idl index 8312a0f6..767f8764 100644 --- a/audio/v3_0/IAudioRender.idl +++ b/audio/v3_0/IAudioRender.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From aa687f7a6ad7507f7eab0b5fba8d7aa3744c6f64 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Fri, 15 Mar 2024 15:32:02 +0800 Subject: [PATCH 075/210] commit msg Signed-off-by: xuxuehai --- audio/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/bundle.json b/audio/bundle.json index 3b39e056..fbc4df05 100644 --- a/audio/bundle.json +++ b/audio/bundle.json @@ -26,7 +26,7 @@ "build": { "sub_component": [ "//drivers/interface/audio/effect/v1_0:libeffect_proxy_1.0", - "//drivers/interface/audio/v3_0:libaudio_proxy_2.0" + "//drivers/interface/audio/v3_0:libaudio_proxy_3.0" ], "test": [ ], -- Gitee From f7b02414459a2e79bcd0f2881be12c774d8f76c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 15 Mar 2024 15:41:23 +0800 Subject: [PATCH 076/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index 4abd470c..fe60cbd8 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -11,7 +11,7 @@ "scripts": {}, "component": { "name": "drivers_interface_vibrator", - "subsystem": "drivers", + "subsystem": "hdf", "syscap": [], "adapted_system_type": ["standard"], "rom": "675KB", -- Gitee From 57060c1b4dacb1831f8b17fbeac49119265df152 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Fri, 15 Mar 2024 07:47:30 +0000 Subject: [PATCH 077/210] update usb/v1_1/BUILD.gn. Signed-off-by: Zhao Zhen --- usb/v1_1/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/usb/v1_1/BUILD.gn b/usb/v1_1/BUILD.gn index cda8dcc7..f3193765 100644 --- a/usb/v1_1/BUILD.gn +++ b/usb/v1_1/BUILD.gn @@ -22,9 +22,7 @@ if (defined(ohos_lite)) { module_name = "usbd" imports = [ "ohos.hdi.usb.v1_0:usb" ] - sources = [ - "IUsbInterface.idl", - ] + sources = [ "IUsbInterface.idl" ] language = "cpp" subsystem_name = "hdf" -- Gitee From b3c7600599f5560c87b80a65c7dfa1a6bb9a6068 Mon Sep 17 00:00:00 2001 From: yangkan Date: Fri, 8 Mar 2024 16:07:46 +0800 Subject: [PATCH 078/210] uv_offset Signed-off-by: yangkan --- .../v1_1/hdi_impl/display_buffer_hdi_impl.h | 2 +- display/buffer/v1_2/BUILD.gn | 68 +++++++++++++++++ display/buffer/v1_2/DisplayBufferType.idl | 36 +++++++++ display/buffer/v1_2/IMapper.idl | 33 ++++++++ .../v1_2/hdi_impl/display_buffer_hdi_impl.cpp | 36 +++++++++ .../v1_2/hdi_impl/display_buffer_hdi_impl.h | 75 +++++++++++++++++++ display/buffer/v1_2/include/idisplay_buffer.h | 47 ++++++++++++ display/bundle.json | 66 ++++++++++++---- 8 files changed, 346 insertions(+), 17 deletions(-) create mode 100644 display/buffer/v1_2/BUILD.gn create mode 100644 display/buffer/v1_2/DisplayBufferType.idl create mode 100644 display/buffer/v1_2/IMapper.idl create mode 100644 display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp create mode 100644 display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h create mode 100644 display/buffer/v1_2/include/idisplay_buffer.h diff --git a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h index 08b1b0b9..983059ae 100644 --- a/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h +++ b/display/buffer/v1_1/hdi_impl/display_buffer_hdi_impl.h @@ -97,8 +97,8 @@ public: } private: using BaseType1_0 = V1_0::DisplayBufferHdiImpl; - using BaseType1_0::WAIT_TIME_INTERVAL; protected: + using BaseType1_0::WAIT_TIME_INTERVAL; sptr metadata_; }; using HdiDisplayBufferImpl = DisplayBufferHdiImpl; diff --git a/display/buffer/v1_2/BUILD.gn b/display/buffer/v1_2/BUILD.gn new file mode 100644 index 00000000..7b9a4c22 --- /dev/null +++ b/display/buffer/v1_2/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("display_buffer") { + module_name = "display_buffer" + imports = [ "ohos.hdi.display.buffer.v1_0:display_buffer" ] + + sources = [ + "DisplayBufferType.idl", + "IMapper.idl", + ] + innerapi_tags = [ + "chipsetsdk_indirect", + "platformsdk_indirect", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} + +config("libdisplay_buffer_hdi_impl_config") { + include_dirs = [ "./../" ] +} + +ohos_shared_library("libdisplay_buffer_hdi_impl_v1_2") { + sources = [ + "../v1_0/hdi_impl/display_buffer_hdi_impl.cpp", + "../v1_1/hdi_impl/display_buffer_hdi_impl.cpp", + "./hdi_impl/display_buffer_hdi_impl.cpp", + ] + + public_configs = [ ":libdisplay_buffer_hdi_impl_config" ] + + deps = [ + ":libdisplay_buffer_proxy_1.2", + "../v1_0:libdisplay_buffer_proxy_1.0", + "../v1_1:libdisplay_buffer_proxy_1.1", + ] + + external_deps = [ + "c_utils:utils", + "graphic_surface:buffer_handle", + "hdf_core:libhdi", + "hdf_core:libpub_utils", + "hilog:libhilog", + "ipc:ipc_single", + ] + + install_images = [ "system" ] + subsystem_name = "hdf" + innerapi_tags = [ + "chipsetsdk_indirect", + "platformsdk_indirect", + ] + part_name = "drivers_interface_display" +} diff --git a/display/buffer/v1_2/DisplayBufferType.idl b/display/buffer/v1_2/DisplayBufferType.idl new file mode 100644 index 00000000..a1b87ded --- /dev/null +++ b/display/buffer/v1_2/DisplayBufferType.idl @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 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.display.buffer.v1_2; +import ohos.hdi.display.buffer.v1_0.DisplayBufferType; + +/** + * @brief Defines information about the uv offset. + * + */ +struct ImagePlane { + unsigned int offset; /* 偏移量 */ + unsigned int hStride; /* 水平增量 */ + unsigned int vStride; /* 垂直增量 */ +}; + +/** + * @brief Defines information about farmat and position. + * + */ +struct ImageLayout { + unsigned int pixelFormat; /**< 图像格式 */ + struct ImagePlane[] planes; /**< 平面数据 */ +}; diff --git a/display/buffer/v1_2/IMapper.idl b/display/buffer/v1_2/IMapper.idl new file mode 100644 index 00000000..fe01d210 --- /dev/null +++ b/display/buffer/v1_2/IMapper.idl @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 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.display.buffer.v1_2; +import ohos.hdi.display.buffer.v1_2.DisplayBufferType; +import ohos.hdi.display.buffer.v1_0.IMapper; + +interface IMapper extends ohos.hdi.display.buffer.v1_0.IMapper { + /** + * @brief get iamge position + * + * @param handle The input buffer handle + * @param layout the iamge position data + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 5.0 + * @version 1.2 + */ + GetImageLayout([in] NativeBuffer handle, [out] struct ImageLayout layout); +} diff --git a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp new file mode 100644 index 00000000..be38135e --- /dev/null +++ b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.cpp @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 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. + */ + +#include "display_buffer_hdi_impl.h" +namespace OHOS { +namespace HDI { +namespace Display { +namespace Buffer { +namespace V1_2 { +using namespace OHOS::HDI::Display::Buffer::V1_2; +IDisplayBuffer *IDisplayBuffer::Get() +{ + IDisplayBuffer *instance = new V1_2::HdiDisplayBufferImpl(); + if (instance == nullptr) { + return nullptr; + } + return instance; +} + +} // namespace V1_2 +} // namespace Buffer +} // namespace Display +} // namespace HDI +} // namespace OHOS diff --git a/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h new file mode 100644 index 00000000..7dde8320 --- /dev/null +++ b/display/buffer/v1_2/hdi_impl/display_buffer_hdi_impl.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_DISPLAY_BUFFER_HDI_IMPL_H +#define OHOS_HDI_DISPLAY_V1_2_DISPLAY_BUFFER_HDI_IMPL_H + +#include +#include +#include "hdf_log.h" +#include "hilog/log.h" +#include "v1_0/hdi_impl/display_buffer_hdi_impl.h" +#include "v1_0/imapper.h" +#include "v1_2/imapper.h" +#include "v1_1/include/idisplay_buffer.h" +#include "v1_2/include/idisplay_buffer.h" +#include "v1_1/hdi_impl/display_buffer_hdi_impl.h" + +#undef LOG_TAG +#define LOG_TAG "DISP_HDI_BUFF" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Buffer { +namespace V1_2 { +template +class DisplayBufferHdiImpl : public V1_1::DisplayBufferHdiImpl { +public: + explicit DisplayBufferHdiImpl(bool isAllocLocal = false) : BaseType2_0(isAllocLocal), mapper_v1_2_(nullptr) + { + while ((mapper_v1_2_ = IMapper::Get(true)) == nullptr) { + // Waiting for metadata service ready + usleep(WAIT_TIME_INTERVAL); + } + } + virtual ~DisplayBufferHdiImpl() {}; + + int32_t GetImageLayout(const BufferHandle& handle, ImageLayout& layout) const override + { + CHECK_NULLPOINTER_RETURN_VALUE(mapper_v1_2_, HDF_FAILURE); + sptr hdiBuffer = new NativeBuffer(); + CHECK_NULLPOINTER_RETURN_VALUE(hdiBuffer, HDF_FAILURE); + hdiBuffer->SetBufferHandle(const_cast(&handle)); + int32_t ret = mapper_v1_2_->GetImageLayout(hdiBuffer, layout); + return ret; + } + +private: + using BaseType2_0 = V1_1::DisplayBufferHdiImpl; +protected: + using BaseType2_0::WAIT_TIME_INTERVAL; + sptr mapper_v1_2_; +}; +using HdiDisplayBufferImpl = DisplayBufferHdiImpl; +} // namespace V1_2 +} // namespace Buffer +} // namespace Display +} // namespace HDI +} // namespace OHOS + +#endif // OHOS_HDI_DISPLAY_V1_1_DISPLAY_BUFFER_HDI_IMPL_H diff --git a/display/buffer/v1_2/include/idisplay_buffer.h b/display/buffer/v1_2/include/idisplay_buffer.h new file mode 100644 index 00000000..0a68609f --- /dev/null +++ b/display/buffer/v1_2/include/idisplay_buffer.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_IDISPLAY_BUFFER_H +#define OHOS_HDI_DISPLAY_V1_2_IDISPLAY_BUFFER_H + +#include "v1_0/include/idisplay_buffer.h" +#include "v1_1/include/idisplay_buffer.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Buffer { +namespace V1_2 { +class IDisplayBuffer : public V1_1::IDisplayBuffer { +public: + virtual ~IDisplayBuffer() = default; + + /** + * @brief Obtains all interfaces of IDisplayBuffer. + * + * @return Returns IDisplayBuffer* if the operation is successful; returns an null point otherwise. + * @since 5.0 + * @version 1.2 + */ + static IDisplayBuffer *Get(); + virtual int32_t GetImageLayout(const BufferHandle& handle, ImageLayout& layout) const = 0; +}; +} // namespace V1_2 +} // namespace Buffer +} // namespace Display +} // namespace HDI +} // namespace OHOS + +#endif // OHOS_HDI_DISPLAY_V1_1_IDISPLAY_BUFFER_H diff --git a/display/bundle.json b/display/bundle.json index c5c0230a..324ded16 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -43,6 +43,8 @@ "//drivers/interface/display/buffer/v1_0:libdisplay_buffer_hdi_impl", "//drivers/interface/display/buffer/v1_1:display_buffer_idl_target", "//drivers/interface/display/buffer/v1_1:libdisplay_buffer_hdi_impl_v1_1", + "//drivers/interface/display/buffer/v1_2:display_buffer_idl_target", + "//drivers/interface/display/buffer/v1_2:libdisplay_buffer_hdi_impl_v1_2", "//drivers/interface/display/composer/cache_manager:libcomposer_buffer_cache", "//drivers/interface/display/composer/v1_0:display_composer_idl_target", "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", @@ -128,18 +130,50 @@ }, { "name": "//drivers/interface/display/buffer/v1_1:libdisplay_buffer_hdi_impl_v1_1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/display/buffer" + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/buffer" + } + }, + { + "name": "//drivers/interface/display/buffer/v1_2:libdisplay_buffer_proxy_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/buffer" + } + }, + { + "name": "//drivers/interface/display/buffer/v1_2:libdisplay_buffer_stub_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/buffer" + } + }, + { + "name": "//drivers/interface/display/buffer/v1_2:display_buffer_idl_headers_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/buffer" + } + }, + { + "name": "//drivers/interface/display/buffer/v1_2:libdisplay_buffer_hdi_impl_v1_2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/buffer" } }, { "name": "//drivers/interface/display/composer/cache_manager:libcomposer_buffer_cache", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/display/composer" + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" } }, { @@ -176,10 +210,10 @@ }, { "name": "//drivers/interface/display/composer/v1_0:libdisplay_composer_hdi_impl", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/display/composer" + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" } }, { @@ -208,10 +242,10 @@ }, { "name": "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/display/composer" + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" } }, { -- Gitee From 8c4904b92188c8f743ee363e47db904c958ef9e5 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Fri, 15 Mar 2024 10:47:52 +0000 Subject: [PATCH 079/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/bundle.json b/usb/bundle.json index 58730054..73353a08 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -33,7 +33,7 @@ "//drivers/interface/usb/v1_0:usb_idl_target", "//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target", "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target", - "//drivers/interface/usb/v1_1:usb_idl_target" + "//drivers/interface/usb/ddk/v1_1:usb_idl_target" ], "test": [], "inner_kits": [ -- Gitee From 34556c1ba52b3d9914c2e2561f12b78626eb8d64 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Fri, 15 Mar 2024 11:19:23 +0000 Subject: [PATCH 080/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usb/bundle.json b/usb/bundle.json index 73353a08..ab5378c0 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -31,9 +31,9 @@ "build": { "sub_component": [ "//drivers/interface/usb/v1_0:usb_idl_target", + "//drivers/interface/usb/v1_1:usb_idl_target" "//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target", - "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target", - "//drivers/interface/usb/ddk/v1_1:usb_idl_target" + "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target" ], "test": [], "inner_kits": [ -- Gitee From 7813032211c9c9bd02724f21855e5c589b2e84bd Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Fri, 15 Mar 2024 12:02:37 +0000 Subject: [PATCH 081/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/bundle.json b/usb/bundle.json index ab5378c0..06cef161 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -31,7 +31,7 @@ "build": { "sub_component": [ "//drivers/interface/usb/v1_0:usb_idl_target", - "//drivers/interface/usb/v1_1:usb_idl_target" + "//drivers/interface/usb/v1_1:usb_idl_target", "//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target", "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target" ], -- Gitee From cf0962534688f53fa34def4dd36dd2b75fae1bb1 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Fri, 15 Mar 2024 15:48:26 +0000 Subject: [PATCH 082/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/bundle.json b/usb/bundle.json index 06cef161..bb2e693d 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -11,7 +11,7 @@ "scripts": {}, "component": { "name": "drivers_interface_usb", - "subsystem": "hdf", + "subsystem": "drivers", "syscap": [], "adapted_system_type": [ "standard", -- Gitee From bce17d2fc1c2e04df61cd554cec85b59a9bbbe00 Mon Sep 17 00:00:00 2001 From: fzj Date: Tue, 6 Feb 2024 14:56:33 +0800 Subject: [PATCH 083/210] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sim=20secure=5Felemen?= =?UTF-8?q?t=20hdi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fzj --- secure_element/bundle.json | 27 +++- .../sim_secure_element/v1_0/BUILD.gn | 27 ++++ .../v1_0/ISecureElementCallback.idl | 33 +++++ .../v1_0/ISecureElementInterface.idl | 116 ++++++++++++++++++ .../v1_0/SecureElementTypes.idl | 57 +++++++++ 5 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 secure_element/sim_secure_element/v1_0/BUILD.gn create mode 100644 secure_element/sim_secure_element/v1_0/ISecureElementCallback.idl create mode 100644 secure_element/sim_secure_element/v1_0/ISecureElementInterface.idl create mode 100644 secure_element/sim_secure_element/v1_0/SecureElementTypes.idl diff --git a/secure_element/bundle.json b/secure_element/bundle.json index 7df5b84a..1f68f019 100644 --- a/secure_element/bundle.json +++ b/secure_element/bundle.json @@ -26,7 +26,8 @@ }, "build": { "sub_component": [ - "//drivers/interface/secure_element/v1_0:secure_element_idl_target" + "//drivers/interface/secure_element/v1_0:secure_element_idl_target", + "//drivers/interface/secure_element/sim_secure_element/v1_0:sim_secure_element_idl_target" ], "test": [ ], @@ -54,6 +55,30 @@ ], "header_base": "//drivers/interface/secure_element" } + }, + { + "name": "//drivers/interface/secure_element/sim_secure_element/v1_0:libsim_secure_element_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/secure_element/sim_secure_element" + } + }, + { + "name": "//drivers/interface/secure_element/sim_secure_element/v1_0:sim_secure_element_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/secure_element/sim_secure_element" + } + }, + { + "name": "//drivers/interface/secure_element/sim_secure_element/v1_0:libsim_secure_element_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/secure_element/sim_secure_element" + } } ] } diff --git a/secure_element/sim_secure_element/v1_0/BUILD.gn b/secure_element/sim_secure_element/v1_0/BUILD.gn new file mode 100644 index 00000000..756694ef --- /dev/null +++ b/secure_element/sim_secure_element/v1_0/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("sim_secure_element") { + module_name = "sim_secure_element_service" + + sources = [ + "ISecureElementCallback.idl", + "ISecureElementInterface.idl", + "SecureElementTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_secure_element" +} diff --git a/secure_element/sim_secure_element/v1_0/ISecureElementCallback.idl b/secure_element/sim_secure_element/v1_0/ISecureElementCallback.idl new file mode 100644 index 00000000..8049997a --- /dev/null +++ b/secure_element/sim_secure_element/v1_0/ISecureElementCallback.idl @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 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.secure_element.sim_secure_element.v1_0; + +/** + * @brief Declares callbacks for reporting state from the SecureElement HDF to the SecureElement service. + * + * @since 5.0 + * @version 1.0 + */ +[callback] interface ISecureElementCallback { + /** + * @brief Notifies the secure element state changed. + * @param connected Indicates the secure element connected or not. + * + * @since 5.0 + * @version 1.0 + */ + OnSeStateChanged([in] boolean connected); +} diff --git a/secure_element/sim_secure_element/v1_0/ISecureElementInterface.idl b/secure_element/sim_secure_element/v1_0/ISecureElementInterface.idl new file mode 100644 index 00000000..f1dda1a6 --- /dev/null +++ b/secure_element/sim_secure_element/v1_0/ISecureElementInterface.idl @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 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.secure_element.sim_secure_element.v1_0; + +import ohos.hdi.secure_element.sim_secure_element.v1_0.ISecureElementCallback; +import ohos.hdi.secure_element.sim_secure_element.v1_0.SecureElementTypes; + +/** + * @brief Declares the APIs provided by the SecureElement module for obtaining SecureElement operations, + * see "Open Mobile API Specification". + * + * @since 5.0 + * @version 1.0 + */ +interface ISecureElementInterface { + + /** + * Initializes the secure element. + * + * @param callback The callback used to notify the secure element status changed. + * @param status The status code to initialize the secure element. + * @since 5.0 + * @version 1.0 + */ + init([in] ISecureElementCallback clientCallback, [out] enum SecureElementStatus status); + + /** + * Get the ATR of this SE. + * + * @return response The ATR or empty array SHALL be returned if the ATR for this SE is not available. + * @since 5.0 + * @version 1.0 + */ + getAtr([out] List response); + + /** + * Checks if a SE is present in this reader. + * + * @param present True if the SE is present, false otherwise. + * @since 5.0 + * @version 1.0 + */ + isSecureElementPresent([out] boolean present); + + /** + * Open a logical channel with the SE, selecting the applet represented by the given AID (when the AID is not + * Null and the length of the AID is not 0). + * + * @param aid The AID of the applet to be selected on this channel, as a byte array. + * @param p2 The P2 parameter of the SELECT APDU executed on this channel. + * @param response The response to SELECT command, or empty if failure. + * @param channelNumber The channel number of new logical channel. + * @param status The status code to open logical channel. + * @since 5.0 + * @version 1.0 + */ + openLogicalChannel([in] List aid, [in] unsigned char p2, [out] List response, + [out] unsigned char channelNumber, [out] enum SecureElementStatus status); + + /** + * Get access to the basic channel, as defined in [ISO 7816-4] (the one that has number 0). The obtained object + * is an instance of the channel class. + * + * @param aid The AID of the applet to be selected on this channel, as a byte array. + * @param p2 The P2 parameter of the SELECT APDU executed on this channel. + * @param response The response to SELECT command, or empty if failure. + * @param status The status code to open basic channel. + * @since 5.0 + * @version 1.0 + */ + openBasicChannel([in] List aid, [in] unsigned char p2, [out] List response, + [out] enum SecureElementStatus status); + + /** + * Closes this logical channel to the SE. + * Closing a basic channel must return SecureElementStatus::FAILED. + * + * @param channelNumber The logical channel number to be closed + * @param status The status code to close the logical channel. + * @since 5.0 + * @version 1.0 + */ + closeChannel([in] unsigned char channelNumber, [out] enum SecureElementStatus status); + + /** + * Transmit an APDU command (as per ISO/IEC 7816) to the SE. + * + * @param command The APDU command to be transmitted, as a byte array. + * @param response The response received, as a byte array. + * @param status The status code to transmit command. + * @since 5.0 + * @version 1.0 + */ + transmit([in] List command, [out] List response, [out] enum SecureElementStatus status); + + /** + * Transmit an APDU command (as per ISO/IEC 7816) to the SE. + * + * @param status The status code to reset the secure element. + * @since 5.0 + * @version 1.0 + */ + reset([out] enum SecureElementStatus status); +} diff --git a/secure_element/sim_secure_element/v1_0/SecureElementTypes.idl b/secure_element/sim_secure_element/v1_0/SecureElementTypes.idl new file mode 100644 index 00000000..094008e4 --- /dev/null +++ b/secure_element/sim_secure_element/v1_0/SecureElementTypes.idl @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @file SecureElementTypes.idl + * + * @brief The error types defined in Open Mobile API Specification. + * + * @since 5.0 + * @version 1.0 + */ + +package ohos.hdi.secure_element.sim_secure_element.v1_0; + +/** + * @brief The error types defined in Open Mobile API Specification. + * + * @since 5.0 + * @version 1.0 + */ +enum SecureElementStatus { + /* success to access se */ + SE_SUCCESS = 0, + /* return null pointer */ + SE_NULL_POINTER_ERROR, + /* paramter is invalid */ + SE_ILLEGAL_PARAMETER_ERROR, + /* unknown state */ + SE_ILLEGAL_STATE_ERROR, + /* denied to access se */ + SE_SECURITY_ERROR, + /* no available channel */ + SE_CHANNEL_NOT_AVAILABLE_ERROR, + /* se is not present */ + SE_NO_SUCH_ELEMENT_ERROR, + /* no reference data */ + SE_ILLEGAL_REFERENCE_ERROR, + /* invalid operation */ + SE_OPERATION_NOT_SUPPORTED_ERROR, + /* interface error */ + SE_IO_ERROR, + /* other error */ + SE_GENERAL_ERROR, +}; + -- Gitee From 38b193a201fabe3bf9ef6569025092c9dba1e8b0 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Sat, 16 Mar 2024 01:15:55 +0000 Subject: [PATCH 084/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/bundle.json b/usb/bundle.json index bb2e693d..06cef161 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -11,7 +11,7 @@ "scripts": {}, "component": { "name": "drivers_interface_usb", - "subsystem": "drivers", + "subsystem": "hdf", "syscap": [], "adapted_system_type": [ "standard", -- Gitee From a3ae115d892e0b6adb576c2b1eded8a5860fb3c1 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Sat, 16 Mar 2024 01:40:45 +0000 Subject: [PATCH 085/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/usb/bundle.json b/usb/bundle.json index 06cef161..c0fce91e 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -1,7 +1,7 @@ { "name": "@ohos/drivers_interface_usb", "description": "drivers interface usb", - "version": "3.1", + "version": "5.0", "license": "Apache License 2.0", "publishAs": "code-segment", "segment": { @@ -113,7 +113,14 @@ "header_files": [], "header_base": "//drivers/interface/usb" } - } + }, + { + "name": "//drivers/interface/usb/v1_1:usb_idl_headers", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb" + } + }, ] } } -- Gitee From 663a62cdb48bc0c2bb63e201e7bf8d567296549d Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Sat, 16 Mar 2024 01:44:51 +0000 Subject: [PATCH 086/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/bundle.json b/usb/bundle.json index c0fce91e..033d97aa 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -120,7 +120,7 @@ "header_files": [], "header_base": "//drivers/interface/usb" } - }, + } ] } } -- Gitee From 47d214a53579020e1450571c75e1e1c0b87005eb Mon Sep 17 00:00:00 2001 From: zhouge94 Date: Sat, 16 Mar 2024 16:31:42 +0800 Subject: [PATCH 087/210] add xmage format and camera format Signed-off-by: zhouge94 --- camera/metadata/include/camera_device_ability_items.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index f46cf8b4..6f227c66 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -441,10 +441,13 @@ typedef enum camera_format { OHOS_CAMERA_FORMAT_RGBA_8888 = 1, OHOS_CAMERA_FORMAT_YCBCR_420_888, OHOS_CAMERA_FORMAT_YCRCB_420_SP, + OHOS_CAMERA_FORMAT_YCBCR_420_SP, OHOS_CAMERA_FORMAT_JPEG, OHOS_CAMERA_FORMAT_YCBCR_P010, OHOS_CAMERA_FORMAT_YCRCB_P010, - OHOS_CAMERA_FORMAT_IMPLEMENTATION_DEFINED, + OHOS_CAMERA_FORMAT_422_YUYV, + OHOS_CAMERA_FORMAT_DNG, + OHOS_CAMERA_FORMAT_IMPLEMENTATION_DEFINED = 0x1000, } camera_format_t; // OHOS_ABILITY_STREAM_QUICK_THUMBNAIL_AVAILABLE enumeration values @@ -562,6 +565,7 @@ typedef enum camera_xmage_color_type { CAMERA_CUSTOM_COLOR_NORMAL = 0, CAMERA_CUSTOM_COLOR_BRIGHT, CAMERA_CUSTOM_COLOR_SOFT, + CAMERA_CUSTOM_COLOR_MONO, } camera_xmage_color_type_t; // OHOS_ABILITY_CAMERA_FOLDSCREEN_TYPE enumeration values -- Gitee From 6d2c9a8f8dcf4dd2198fb8d467648b345283d292 Mon Sep 17 00:00:00 2001 From: suyongliang Date: Mon, 18 Mar 2024 09:56:58 +0800 Subject: [PATCH 088/210] VideoPortCap of codec interface add some features Signed-off-by: suyongliang --- codec/v2_0/CodecTypes.idl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codec/v2_0/CodecTypes.idl b/codec/v2_0/CodecTypes.idl index cf1f8aa7..53f2c1b8 100644 --- a/codec/v2_0/CodecTypes.idl +++ b/codec/v2_0/CodecTypes.idl @@ -286,6 +286,10 @@ struct CodecVideoPortCap { For details, see {@link BitRateMode}. */ struct RangeValue frameRate; /**< Frame rate range. */ int[] measuredFrameRate; /**< Frame rate measured. */ + boolean isSupportLowLatency; /**< Whether supports low-latency feature */ + boolean isSupportTSVC; /**< Whether supports temporal level scale feature */ + boolean isSupportLTR; /**< Whether supports long-term reference feature */ + int maxLTRFrameNum; /**< Maximum long-term reference frame numbers supported */ }; /** -- Gitee From 7f69c045a18c2b8e0c454ff21d4b057f53b6e2ce Mon Sep 17 00:00:00 2001 From: suyongliang Date: Mon, 18 Mar 2024 10:10:13 +0800 Subject: [PATCH 089/210] VideoPortCap of codec interface add some features Signed-off-by: suyongliang --- codec/v2_0/CodecTypes.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codec/v2_0/CodecTypes.idl b/codec/v2_0/CodecTypes.idl index 53f2c1b8..773e5162 100644 --- a/codec/v2_0/CodecTypes.idl +++ b/codec/v2_0/CodecTypes.idl @@ -287,9 +287,9 @@ struct CodecVideoPortCap { struct RangeValue frameRate; /**< Frame rate range. */ int[] measuredFrameRate; /**< Frame rate measured. */ boolean isSupportLowLatency; /**< Whether supports low-latency feature */ - boolean isSupportTSVC; /**< Whether supports temporal level scale feature */ - boolean isSupportLTR; /**< Whether supports long-term reference feature */ - int maxLTRFrameNum; /**< Maximum long-term reference frame numbers supported */ + boolean isSupportTSVC; /**< Whether supports temporal level scale feature */ + boolean isSupportLTR; /**< Whether supports long-term reference feature */ + int maxLTRFrameNum; /**< Maximum long-term reference frame numbers supported */ }; /** -- Gitee From 07da4b126c0fa1c446674fb333be1212040d07bc Mon Sep 17 00:00:00 2001 From: dufresne_andy Date: Mon, 18 Mar 2024 11:44:20 +0800 Subject: [PATCH 090/210] Description:slove compilation error Feature or Bugfix:Bugfix Binary Source: No Signed-off-by: dufresne_andy --- usb/bundle.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/usb/bundle.json b/usb/bundle.json index 033d97aa..794cfce5 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -113,13 +113,6 @@ "header_files": [], "header_base": "//drivers/interface/usb" } - }, - { - "name": "//drivers/interface/usb/v1_1:usb_idl_headers", - "header": { - "header_files": [], - "header_base": "//drivers/interface/usb" - } } ] } -- Gitee From e18de555cdba0c9f154042e833ab1d8c177eeb4e Mon Sep 17 00:00:00 2001 From: qinjihong Date: Mon, 18 Mar 2024 11:39:26 +0800 Subject: [PATCH 091/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- camera/metadata/include/camera_device_ability_items.h | 2 ++ camera/metadata/include/camera_metadata_item_info.h | 4 ++++ camera/metadata/src/camera_metadata_info.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index f46cf8b4..a77bce09 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -110,6 +110,8 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_MOON_CAPTURE_BOOST, OHOS_CONTROL_MOON_CAPTURE_BOOST, OHOS_STATUS_MOON_CAPTURE_DETECTION, + OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, + OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index fdd07d74..6f855139 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -82,6 +82,10 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusMoonCaptureDetection", META_TYPE_UINT32, 1}, [OHOS_CAMERA_USER_ID - OHOS_CAMERA_PROPERTIES_START] = {"cameraUserId", META_TYPE_INT32, -1}, + [OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED - + OHOS_CAMERA_PROPERTIES_START] = {"captureDurationSupported", META_TYPE_BYTE, 1}, + [OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION - + OHOS_CAMERA_PROPERTIES_START] = {"customSnapshotDuration", META_TYPE_UINT32, 1}, }; static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 93adec24..a5ee2ad3 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -42,6 +42,8 @@ const std::vector g_metadataTags = { OHOS_ABILITY_MOON_CAPTURE_BOOST, OHOS_CONTROL_MOON_CAPTURE_BOOST, OHOS_STATUS_MOON_CAPTURE_DETECTION, + OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, + OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, -- Gitee From 1f323bbc130f6c2d7a9c8a90217cf346f56b2cc6 Mon Sep 17 00:00:00 2001 From: Zhao Zhen Date: Mon, 18 Mar 2024 04:55:34 +0000 Subject: [PATCH 092/210] update usb/bundle.json. Signed-off-by: Zhao Zhen --- usb/bundle.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usb/bundle.json b/usb/bundle.json index 794cfce5..8fdca89e 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -113,6 +113,13 @@ "header_files": [], "header_base": "//drivers/interface/usb" } + }, + { + "name": "//drivers/interface/usb/v1_1:usb_idl_headers_1.1", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb" + } } ] } -- Gitee From b704ff22080751013e5ff7d65a793245880d4fae Mon Sep 17 00:00:00 2001 From: xuedong Date: Tue, 27 Feb 2024 20:46:23 +0800 Subject: [PATCH 093/210] =?UTF-8?q?[Bug]:=E4=BF=AE=E8=AE=A2HDRBuffer?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发生了什么问题: 【必现】修订HDR Buffer属性 期望行为是什么: 更新HDR Buffer属性 如何复现该缺陷: 必现 Signed-off-by: xuedong --- display/bundle.json | 11 +- display/graphic/common/v2_0/BUILD.gn | 28 ++++ .../common/v2_0/BufferHandleMetaKeyType.idl | 65 ++++++++ display/graphic/common/v2_0/CMColorSpace.idl | 151 ++++++++++++++++++ .../graphic/common/v2_0/HdrStaticMetadata.idl | 47 ++++++ 5 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 display/graphic/common/v2_0/BUILD.gn create mode 100644 display/graphic/common/v2_0/BufferHandleMetaKeyType.idl create mode 100644 display/graphic/common/v2_0/CMColorSpace.idl create mode 100644 display/graphic/common/v2_0/HdrStaticMetadata.idl diff --git a/display/bundle.json b/display/bundle.json index c5c0230a..ebc4dfc4 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -49,7 +49,8 @@ "//drivers/interface/display/composer/v1_1:display_composer_idl_target", "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target", - "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target" + "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target", + "//drivers/interface/display/graphic/common/v2_0:display_commontype_idl_target" ], "inner_kits": [ { @@ -237,6 +238,14 @@ ], "header_base": "//drivers/interface/display/graphic/common" } + }, + { + "name": "//drivers/interface/display/graphic/common/v2_0:display_commontype_idl_headers_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/graphic/common" + } } ] } diff --git a/display/graphic/common/v2_0/BUILD.gn b/display/graphic/common/v2_0/BUILD.gn new file mode 100644 index 00000000..41536469 --- /dev/null +++ b/display/graphic/common/v2_0/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("display_commontype") { + module_name = "display_commontype" + + sources = [ + "BufferHandleMetaKeyType.idl", + "CMColorSpace.idl", + "HdrStaticMetadata.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} diff --git a/display/graphic/common/v2_0/BufferHandleMetaKeyType.idl b/display/graphic/common/v2_0/BufferHandleMetaKeyType.idl new file mode 100644 index 00000000..503877c3 --- /dev/null +++ b/display/graphic/common/v2_0/BufferHandleMetaKeyType.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 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 HdiDisplay + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.display.graphic.common.v2_0; + +struct BufferHandleMetaRegion { + unsigned int left; + unsigned int top; + unsigned int width; + unsigned int height; +}; + +enum BufferHandleAttrKey { + /* 0-2047 OS standard meta type */ + ATTRKEY_COLORSPACE_INFO = 1, // value: CM_ColorSpaceInfo + ATTRKEY_COLORSPACE_TYPE, // value: CM_ColorSpaceType + ATTRKEY_HDR_METADATA_TYPE, // value: CM_HDRMetaDataType + + ATTRKEY_HDR_STATIC_METADATA, // value: HdrStaticMetadata + ATTRKEY_HDR_DYNAMIC_METADATA, // byte stream of SEI in video stream + + ATTRKEY_HDR_PROCESSED, // value: int + ATTRKEY_CROP_REGION, // value: Meta_Rect_Region + ATTRKEY_EXPECT_FPS, // value: int + ATTRKEY_DATA_ACCESS, // value: int + + ATTRKEY_REQUEST_ACCESS_TYPE = 10, // value: current request frame mode + ATTRKEY_ACCESS_TYPE = 11, // value: current data frame mode + + /* vendor internal extended meta type */ + ATTRKEY_VENDOR_EXT_START = 2048, + + /* temporarily extended meta type, between system and vendor */ + ATTRKEY_OEM_EXT_START = 4096, + ATTRKEY_END = 8192 +}; + +/** + * @brief Enumerates the Gralloc Hebc Access types. + * + */ +enum HebcAccessType { + HEBC_ACCESS_UNINIT = 0, // not configured frame mode + HEBC_ACCESS_CPU_ACCESS, // cpu is accessible; hebc is not accessible + HEBC_ACCESS_HW_ONLY, // hardware_only: cpu is not accessible; hebc is accessible +}; diff --git a/display/graphic/common/v2_0/CMColorSpace.idl b/display/graphic/common/v2_0/CMColorSpace.idl new file mode 100644 index 00000000..533e2dec --- /dev/null +++ b/display/graphic/common/v2_0/CMColorSpace.idl @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 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 HdiDisplay + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.display.graphic.common.v2_0; + +/** + * @brief defines color gamut. + * + */ +enum CM_ColorPrimaries { + COLORPRIMARIES_BT709 = 1, // map to H.273 Chapter 8.1 table 2; index = 1 + COLORPRIMARIES_SRGB = 1, // equal to COLORPRIMARIES_BT709 + COLORPRIMARIES_BT601_P, // map to H.273 Chapter 8.1 table 2; index = 5 + COLORPRIMARIES_BT601_N, // map to H.273 Chapter 8.1 table 2; index = 6 + COLORPRIMARIES_BT2020 = 4, // map to H.273 Chapter 8.1 table 2; index = 9 + COLORPRIMARIES_BT2100 = 4, // equal to COLORPRIMARIES_BT2020 + COLORPRIMARIES_P3_DCI, // map to H.273 Chapter 8.1 table 2; index = 11 + COLORPRIMARIES_P3_D65, // map to H.273 Chapter 8.1 table 2; index = 12 + COLORPRIMARIES_MONO, // for example, gain map data + COLORPRIMARIES_ADOBERGB = 23 +}; + +/** + * @brief control the linear/non-linear color convert, nick named gamma function. + * + */ +enum CM_TransFunc { + TRANSFUNC_BT709 = 1, // map to H.273 Chapter 8.2 table 3; index = 1/6/14/15 + TRANSFUNC_SRGB = 2, // map to H.273 Chapter 8.2 table 3; index = 13 + TRANSFUNC_LINEAR = 3, // map to H.273 Chapter 8.2 table 3; index = 8 + TRANSFUNC_PQ, // map to H.273 Chapter 8.2 table 3; index = 16 + TRANSFUNC_HLG, // map to H.273 Chapter 8.2 table 3; index = 18 + TRANSFUNC_ADOBERGB, + TRANSFUNC_GAMMA2_2, + TRANSFUNC_GAMMA2_4, +}; + +enum CM_Range { + RANGE_UNKNOW = 0, + RANGE_FULL, // full/wide Range + RANGE_LIMITED, // limited/narrow Range + RANGE_EXTEND, +}; + +/** + * @brief control yuv<-->rgb conversion + * + */ +enum CM_Matrix { + MATRIX_ADOBERGB = 0, + MATRIX_BT709 = 1, // map to H.273 Chapter 8.3 table 4; index = 1 + MATRIX_BT601_P, // map to H.273 Chapter 8.3 table 4; index = 5 + MATRIX_BT601_N = 3, // map to H.273 Chapter 8.3 table 4; index = 6 + MATRIX_P3 = 3, // equal to MATRIX_BT601_N + MATRIX_BT2020 = 4, // map to H.273 Chapter 8.3 table 4; index = 9 + MATRIX_BT2100 = 4, // equal to MATRIX_BT2020 + MATRIX_BT2100_ICTCP // map to H.273 Chapter 8.3 table 4; index = 14 +}; + +struct CM_ColorSpaceInfo { + enum CM_ColorPrimaries primaries; + enum CM_TransFunc transfunc; + enum CM_Matrix matrix; + enum CM_Range range; +}; + +enum CM_ColorSpaceType { + CM_COLORSPACE_NONE, + + CM_BT601_EBU_FULL = 2 | (1 << 8) | (2 << 16) | (1 << 21), // COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_FULL << 21) + CM_BT601_SMPTE_C_FULL = 3 | (1 << 8) | (3 << 16) | (1 << 21), // COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21) + CM_BT709_FULL = 1 | (1 << 8) | (1 << 16) | (1 << 21), // COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_FULL << 21) + CM_BT2020_HLG_FULL = 4 | (5 << 8) | (4 << 16) | (1 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) + CM_BT2020_PQ_FULL = 4 | (4 << 8) | (4 << 16) | (1 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) + + CM_BT601_EBU_LIMIT = 2 | (1 << 8) | (2 << 16) | (2 << 21), // COLORPRIMARIES_BT601_P | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_P << 16) | (RANGE_LIMITED << 21) + CM_BT601_SMPTE_C_LIMIT = 3 | (1 << 8) | (3 << 16) | (2 << 21), // COLORPRIMARIES_BT601_N | (TRANSFUNC_BT709 << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) + CM_BT709_LIMIT = 1 | (1 << 8) | (1 << 16) | (2 << 21), // COLORPRIMARIES_BT709 | (TRANSFUNC_BT709 << 8) | (MATRIX_BT709 << 16) | (RANGE_LIMITED << 21) + CM_BT2020_HLG_LIMIT = 4 | (5 << 8) | (4 << 16) | (2 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_HLG << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) + CM_BT2020_PQ_LIMIT = 4 | (4 << 8) | (4 << 16) | (2 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_PQ << 8) | (MATRIX_BT2020 << 16) | (RANGE_LIMITED << 21) + + CM_SRGB_FULL = 1 | (2 << 8) | (3 << 16) | (1 << 21), // COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_FULL << 21) + CM_P3_FULL = 6 | (2 << 8) | (3 << 16) | (1 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) + CM_P3_HLG_FULL = 6 | (5 << 8) | (3 << 16) | (1 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) + CM_P3_PQ_FULL = 6 | (4 << 8) | (3 << 16) | (1 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_FULL << 21) + CM_ADOBERGB_FULL = 23 | (6 << 8) | (0 << 16) | (1 << 21), // COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_FULL << 21) + + CM_SRGB_LIMIT = 1 | (2 << 8) | (3 << 16) | (2 << 21), // COLORPRIMARIES_SRGB | (TRANSFUNC_SRGB << 8) | (MATRIX_BT601_N << 16) | (RANGE_LIMITED << 21) + CM_P3_LIMIT = 6 | (2 << 8) | (3 << 16) | (2 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_SRGB << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) + CM_P3_HLG_LIMIT = 6 | (5 << 8) | (3 << 16) | (2 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_HLG << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) + CM_P3_PQ_LIMIT = 6 | (4 << 8) | (3 << 16) | (2 << 21), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_PQ << 8) | (MATRIX_P3 << 16) | (RANGE_LIMITED << 21) + CM_ADOBERGB_LIMIT = 23 | (6 << 8) | (0 << 16) | (2 << 21), // COLORPRIMARIES_ADOBERGB | (TRANSFUNC_ADOBERGB << 8) | (MATRIX_ADOBERGB << 16) | (RANGE_LIMITED << 21) + + CM_LINEAR_SRGB = 1 | (3 << 8), // COLORPRIMARIES_SRGB | (TRANSFUNC_LINEAR << 8) + CM_LINEAR_BT709 = 1 | (3 << 8), // equal to CM_LINEAR_SRGB + CM_LINEAR_P3 = 6 | (3 << 8), // COLORPRIMARIES_P3_D65 | (TRANSFUNC_LINEAR << 8) + CM_LINEAR_BT2020 = 4 | (3 << 8), // COLORPRIMARIES_BT2020 | (TRANSFUNC_LINEAR << 8) + + CM_DISPLAY_SRGB = 1 | (2 << 8) | (3 << 16) | (1 << 21), // equal to CM_SRGB_FULL + CM_DISPLAY_P3_SRGB = 6 | (2 << 8) | (3 << 16) | (1 << 21), // equal to CM_P3_FULL + CM_DISPLAY_P3_HLG = 6 | (5 << 8) | (3 << 16) | (1 << 21), // equal to CM_P3_HLG_FULL + CM_DISPLAY_P3_PQ = 6 | (4 << 8) | (3 << 16) | (1 << 21), // equal to CM_P3_PQ_FULL + CM_DISPLAY_BT2020_SRGB = 4 | (2 << 8) | (4 << 16) | (1 << 21), // COLORPRIMARIES_BT2020 | (TRANSFUNC_SRGB << 8) | (MATRIX_BT2020 << 16) | (RANGE_FULL << 21) + CM_DISPLAY_BT2020_HLG = 4 | (5 << 8) | (4 << 16) | (1 << 21), // equal to CM_BT2020_HLG_FULL + CM_DISPLAY_BT2020_PQ = 4 | (4 << 8) | (4 << 16) | (1 << 21) // equal to CM_BT2020_PQ_FULL +}; + +enum CM_ColorSpaceMask { + CM_PRIMARIES_MASK = 255, // 0-7 8bit + CM_TRANSFUNC_MASK = 255 << 8, // 8-15 8bit + CM_MATRIX_MASK = 31 << 16, // 16-20 5bit + CM_RANGE_MASK = 7 << 21 // 21-23 3bit +}; + +enum CM_HDR_Metadata_Type { + CM_METADATA_NONE, // SDR + + /* video HDR metadata type */ + CM_VIDEO_HLG, // HLG + CM_VIDEO_HDR10, // HDR10 + CM_VIDEO_HDR_VIVID, // video HDR vivid + + /* image HDR vivid metadata type */ + CM_IMAGE_HDR_VIVID_SDR = 20, // image HDR vivid SDR + CM_IMAGE_HDR_VIVID_GAINMAP, // image HDR vivid gainmap + CM_IMAGE_HDR_VIVID_HDR, // image HDR vivid HDR + + /* image HDR iso metadata type */ + CM_IMAGE_HDR_ISO_SDR = 40, // image HDR iso SDR + CM_IMAGE_HDR_ISO_GAINMAP, // image HDR iso gainmap + CM_IMAGE_HDR_ISO_HDR, // image HDR iso HDR +}; diff --git a/display/graphic/common/v2_0/HdrStaticMetadata.idl b/display/graphic/common/v2_0/HdrStaticMetadata.idl new file mode 100644 index 00000000..4875f688 --- /dev/null +++ b/display/graphic/common/v2_0/HdrStaticMetadata.idl @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 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 HdiDisplay + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.display.graphic.common.v2_0; + +struct ColorXY { + float x; + float y; +}; + +struct Smpte2086_Metadata { + struct ColorXY displayPrimaryRed; + struct ColorXY displayPrimaryGreen; + struct ColorXY displayPrimaryBlue; + struct ColorXY whitePoint; + float maxLuminance; + float minLuminance; +}; + +struct Cta861_3_Metadata { + float maxContentLightLevel; + float maxFrameAverageLightLevel; +}; + +struct HdrStaticMetadata { + struct Smpte2086_Metadata smpte2086; + struct Cta861_3_Metadata cta861; +}; \ No newline at end of file -- Gitee From c9d852f5164ab9f699232614d55cce9f38820af7 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Mon, 18 Mar 2024 15:51:51 +0800 Subject: [PATCH 094/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=93=E4=B8=9A?= =?UTF-8?q?=E6=8B=8D=E7=85=A7/=E5=BD=95=E5=83=8F=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- .../include/camera_device_ability_items.h | 26 +++++++++++++++++++ .../include/camera_metadata_item_info.h | 24 +++++++++++++++++ camera/metadata/src/camera_metadata_info.cpp | 16 ++++++++++++ camera/v1_3/Types.idl | 21 +++++++++++++++ 4 files changed, 87 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index a77bce09..340367e9 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -157,6 +157,8 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, OHOS_CONTROL_AE_AVAILABLE_MODES, OHOS_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + OHOS_ABILITY_AE_COMPENSATION_RANGE, + OHOS_ABILITY_AE_COMPENSATION_STEP, OHOS_CONTROL_AE_COMPENSATION_RANGE, OHOS_CONTROL_AE_COMPENSATION_STEP, OHOS_CONTROL_AF_AVAILABLE_MODES, @@ -171,6 +173,12 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_NIGHT_MODE_TRY_AE, OHOS_CONTROL_MANUAL_EXPOSURE_TIME, OHOS_STATUS_CAMERA_CURRENT_FPS, + OHOS_ABILITY_ISO_VALUES, + OHOS_CONTROL_ISO_VALUE, + OHOS_STATUS_ISO_VALUE, + OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, + OHOS_CONTROL_SENSOR_EXPOSURE_TIME, + OHOS_STATUS_SENSOR_EXPOSURE_TIME, OHOS_DEVICE_CONTROL_END, // Camera device image acquisition related @@ -190,6 +198,10 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_FOCUS_MODE, OHOS_ABILITY_FOCAL_LENGTH, OHOS_ABILITY_SCENE_FOCUS_MODES, + OHOS_ABILITY_FOCUS_ASSIST_FLASH_SUPPORTED_MODES, + OHOS_CONTROL_FOCUS_ASSIST_FLASH_SUPPORTED_MODE, + OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, + OHOS_CONTROL_LENS_FOCUS_DISTANCE, OHOS_DEVICE_FOCUS_END, OHOS_ABILITY_DEVICE_AVAILABLE_AWBMODES = OHOS_DEVICE_WHITE_BLANCE_START, @@ -270,6 +282,10 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, + OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED, + OHOS_CONTROL_EXPOSURE_HINT_MODE, + OHOS_STATU_ALGO_MEAN_Y, + OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_CAMERA_EFFECT_END, // camera secure related @@ -334,6 +350,14 @@ typedef enum camera_focus_mode_enum { OHOS_CAMERA_FOCUS_MODE_LOCKED } camera_focus_mode_enum_t; +// OHOS_ABILITY_FOCUS_ASSIST_FLASH_SUPPORTED_MODES enumeration values +typedef enum camera_focus_assist_flash_mode_enum { + OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_DEFAULT = 0, + OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_AUTO, + OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_ON, + OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_OFF +} camera_focus_assist_flash_mode_enum_t; + // OHOS_CONTROL_FLASHMODE and OHOS_ABILITY_FLASH_MODES enumeration values typedef enum camera_flash_mode_enum { OHOS_CAMERA_FLASH_MODE_CLOSE = 0, @@ -446,6 +470,7 @@ typedef enum camera_format { OHOS_CAMERA_FORMAT_JPEG, OHOS_CAMERA_FORMAT_YCBCR_P010, OHOS_CAMERA_FORMAT_YCRCB_P010, + OHOS_CAMERA_FORMAT_DNG, OHOS_CAMERA_FORMAT_IMPLEMENTATION_DEFINED, } camera_format_t; @@ -467,6 +492,7 @@ typedef enum camera_meter_mode { OHOS_CAMERA_SPOT_METERING = 0, OHOS_CAMERA_REGION_METERING, OHOS_CAMERA_OVERALL_METERING, + OHOS_CAMERA_CENTER_WEIGHTED_METERING, } camera_meter_mode_t; typedef enum camera_exposure_state { diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 6f855139..6a4d5e60 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -149,6 +149,10 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON OHOS_DEVICE_CONTROL_START] = {"aeCompensationRange", META_TYPE_INT32, -1}, [OHOS_CONTROL_AE_COMPENSATION_STEP - OHOS_DEVICE_CONTROL_START] = {"aeCompensationStep", META_TYPE_RATIONAL, 1 }, + [OHOS_ABILITY_AE_COMPENSATION_RANGE - + OHOS_DEVICE_CONTROL_START] = {"abilityAeCompensationRange", META_TYPE_INT32, -1}, + [OHOS_ABILITY_AE_COMPENSATION_STEP - + OHOS_DEVICE_CONTROL_START] = {"abilityAeCompensationStep", META_TYPE_RATIONAL, 1 }, [OHOS_CONTROL_AF_AVAILABLE_MODES - OHOS_DEVICE_CONTROL_START] = {"afAvailableModes", META_TYPE_BYTE, -1}, [OHOS_CONTROL_AWB_AVAILABLE_MODES - @@ -164,6 +168,14 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON [OHOS_CONTROL_NIGHT_MODE_TRY_AE - OHOS_DEVICE_CONTROL_START] = {"nightModeTryAe", META_TYPE_BYTE, 1 }, [OHOS_CONTROL_MANUAL_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"manualExposureTime", META_TYPE_UINT32, -1}, [OHOS_STATUS_CAMERA_CURRENT_FPS - OHOS_DEVICE_CONTROL_START] = {"currentFps", META_TYPE_UINT32, 1}, + [OHOS_ABILITY_ISO_VALUES - OHOS_DEVICE_CONTROL_START] = {"supportedIsoValues", META_TYPE_INT32, -1}, + [OHOS_CONTROL_ISO_VALUE - OHOS_DEVICE_CONTROL_START] = {"isoValues", META_TYPE_INT32, 1}, + [OHOS_STATUS_ISO_VALUE - OHOS_DEVICE_CONTROL_START] = {"currentIsoValues", META_TYPE_INT32, 1}, + [OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE - + OHOS_DEVICE_CONTROL_START] = {"sensorExposureTimeRange", META_TYPE_RATIONAL, -1}, + [OHOS_CONTROL_SENSOR_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"sensorExposureTime", META_TYPE_RATIONAL, 1}, + [OHOS_STATUS_SENSOR_EXPOSURE_TIME - + OHOS_DEVICE_CONTROL_START] = {"currentSensorExposureTime", META_TYPE_RATIONAL, 1}, }; static item_info_t g_ohosDeviceExposure[OHOS_DEVICE_EXPOSURE_END - OHOS_DEVICE_EXPOSURE_START] = { @@ -186,6 +198,13 @@ static item_info_t g_ohosDeviceFocus[OHOS_DEVICE_FOCUS_END - OHOS_DEVICE_FOCUS_S [OHOS_CONTROL_FOCUS_MODE - OHOS_DEVICE_FOCUS_START] = {"fMode", META_TYPE_BYTE, 1 }, [OHOS_ABILITY_FOCAL_LENGTH - OHOS_DEVICE_FOCUS_START] = {"focalLength", META_TYPE_FLOAT, 1 }, [OHOS_ABILITY_SCENE_FOCUS_MODES - OHOS_DEVICE_FOCUS_START] = {"sceneFocusSupportiveModes", META_TYPE_BYTE, -1}, + [OHOS_ABILITY_FOCUS_ASSIST_FLASH_SUPPORTED_MODES - + OHOS_DEVICE_FOCUS_START] = {"focusAssistFlashSupportedModes", META_TYPE_BYTE, -1}, + [OHOS_CONTROL_FOCUS_ASSIST_FLASH_SUPPORTED_MODE - + OHOS_DEVICE_FOCUS_START] = {"sceneFocusSupportiveModes", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE - + OHOS_DEVICE_FOCUS_START] = {"lensInfoMinimumFocusDistance", META_TYPE_FLOAT, 1}, + [OHOS_CONTROL_LENS_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensFocusDistance", META_TYPE_FLOAT, 1}, }; static item_info_t g_ohosDeviceWhite[OHOS_DEVICE_WHITE_BLANCE_END - OHOS_DEVICE_WHITE_BLANCE_START] = { @@ -307,6 +326,11 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"motionDetectionSupportValue", META_TYPE_BYTE, 1}, [OHOS_CONTROL_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"motionDetectionControlValue", META_TYPE_BYTE, 1}, + [OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED - OHOS_CAMERA_EFFECT_START] = {"exposureHintSupported", META_TYPE_BYTE, 1}, + [OHOS_CONTROL_EXPOSURE_HINT_MODE - OHOS_CAMERA_EFFECT_START] = {"exposureHintMode", META_TYPE_BYTE, 1}, + [OHOS_STATU_ALGO_MEAN_Y - OHOS_CAMERA_EFFECT_START] = {"algoMeanY", META_TYPE_UINT32, 1}, + [OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID - + OHOS_CAMERA_EFFECT_START] = {"previewPhysicalCameraId", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index a5ee2ad3..d9e00bb9 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -87,6 +87,8 @@ const std::vector g_metadataTags = { OHOS_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, OHOS_CONTROL_AE_COMPENSATION_RANGE, OHOS_CONTROL_AE_COMPENSATION_STEP, + OHOS_ABILITY_AE_COMPENSATION_RANGE, + OHOS_ABILITY_AE_COMPENSATION_STEP, OHOS_CONTROL_AF_AVAILABLE_MODES, OHOS_CONTROL_AWB_AVAILABLE_MODES, OHOS_CONTROL_CAPTURE_MIRROR_SUPPORTED, @@ -95,6 +97,12 @@ const std::vector g_metadataTags = { OHOS_CONTROL_METER_POINT, OHOS_CONTROL_METER_MODE, OHOS_CONTROL_EXPOSURE_STATE, + OHOS_ABILITY_ISO_VALUES, + OHOS_CONTROL_ISO_VALUE, + OHOS_STATUS_ISO_VALUE, + OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, + OHOS_CONTROL_SENSOR_EXPOSURE_TIME, + OHOS_STATUS_SENSOR_EXPOSURE_TIME, // Camera device image acquisition related OHOS_ABILITY_DEVICE_AVAILABLE_EXPOSUREMODES, @@ -108,6 +116,10 @@ const std::vector g_metadataTags = { OHOS_ABILITY_FOCUS_MODES, OHOS_CONTROL_FOCUS_MODE, OHOS_ABILITY_FOCAL_LENGTH, + OHOS_ABILITY_FOCUS_ASSIST_FLASH_SUPPORTED_MODES, + OHOS_CONTROL_FOCUS_ASSIST_FLASH_SUPPORTED_MODE, + OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, + OHOS_CONTROL_LENS_FOCUS_DISTANCE, OHOS_ABILITY_DEVICE_AVAILABLE_FLASHMODES, OHOS_CONTROL_FLASHMODE, @@ -171,6 +183,10 @@ const std::vector g_metadataTags = { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, + OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED, + OHOS_CONTROL_EXPOSURE_HINT_MODE, + OHOS_STATU_ALGO_MEAN_Y, + OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 309a4a46..a8dec875 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -112,3 +112,24 @@ enum OperationMode_V1_3 { */ OPERATION_MODE_MAX, }; + +/** + * @brief Enumerates types of the extended stream information. + */ +enum ExtendedStreamInfoType { + /** + * Extended stream information of quick thumbnail. + */ + EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, + + /** + * Extended stream information of sketch. + */ + EXTENDED_STREAM_INFO_SKETCH = 1, + + /** + * Extended stream information of raw. + */ + EXTENDED_STREAM_INFO_RAW = 2, +}; + -- Gitee From 8605de406c558456074831b5e5cc65439d183d11 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 19 Mar 2024 09:51:51 +0800 Subject: [PATCH 095/210] add QuantDtypeCastV2, update desc Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 4 +- nnrt/v2_1/NodeAttrTypes.idl | 183 +++++++++++++++++++++--------------- 2 files changed, 109 insertions(+), 78 deletions(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index 1043e132..fe893d8f 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -380,7 +380,7 @@ enum NodeType : unsigned int { /** LogicalOr operator. */ NODE_TYPE_LOGICAL_OR = 83, /** LRN operator. */ - NODE_TYPE_LRN = 87, + NODE_TYPE_LRN = 85, /** LSTM operator. */ NODE_TYPE_LSTM = 87, /** L2NormalizeFusion operator. */ @@ -481,6 +481,8 @@ enum NodeType : unsigned int { NODE_TYPE_ERF = 178, /** LogSoftmax operator. */ NODE_TYPE_LOG_SOFTMAX = 189, + /** QuantDTypeCastV2 operator. */ + NODE_TYPE_QUANT_DTYPE_CAST_V2 = 500, }; /** diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 7fd22e23..bab42666 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -142,7 +142,7 @@ struct AddFusion * * Output: * - * * First K indices or values before the maximum input tensor on the axis. + * * 1-dimension or n-dimension tensor with boolean data type. * * @since 5.0 * @version 2.1 @@ -196,15 +196,16 @@ struct ArgMaxFusion * * data, the tensors to print out when condition is false. * * Output: + * * output, result value judged by condition. If the condition is not true, an Error is returned. * - * * Tensor after average pooling. + * * * * @since 5.0 * @version 2.1 */ struct Assert { - /** Print this many entries of each tensor. */ + /** The number of entries for each tensor is printed. */ long summarize; }; @@ -258,7 +259,7 @@ struct AvgPoolFusion }; /** - * @brief Divides the batch dimension of a 4D tensor into small blocks by block_shape, and interleaves these blocks\n + * @brief Divides the batch dimension of a 4D tensor into small blocks by blockShape, and interleaves these blocks\n * back into the spatial dimension. * * The {@link NodeType} of this operator is NODE_TYPE_BATCH_TO_SPACE_ND. @@ -270,9 +271,9 @@ struct AvgPoolFusion * Output: * * * Output tensor. Assume that the shape of x is (n,h,w,c) and the shape of output is (n',h',w',c'): - * \f$ n' = n / (block_shape[0] * block_shape[1])\f$
- * \f$ h' = h * block_shape[0] - crops[0][0] - crops[0][1] \f$
- * \f$ w' = w * block_shape[1] - crops[1][0] - crops[1][1] \f$
+ * \f$ n' = n / (blockShape[0] * blockShape[1])\f$
+ * \f$ h' = h * blockShape[0] - crops[0][0] - crops[0][1] \f$
+ * \f$ w' = w * blockShape[1] - crops[1][0] - crops[1][1] \f$
* \f$ c'= c \f$ * * @since 3.2 @@ -470,9 +471,9 @@ struct Conv2DFusion /** * Splits x into groups by inChannel. The group value is of the int type. * If group is 1, it is a conventional convolution. - * If group is inChannel, it is depthwiseConv2d. In this case, group==in_channel==out_channel. + * If group is inChannel, it is depthwiseConv2d. In this case, group==inChannel==outChannel. * If group is greater than 1 and less than inChannel, it is group convolution.\n - * In this case, out_channel==group. + * In this case, outChannel==group. */ long group; /** Number of input channels. */ @@ -584,7 +585,7 @@ struct Cos struct ConstantOfShape { /** The data type of output elements. */ - long data_type; + long dataType; /** The value of the output elements. Should be a one-element tensor. */ float[] value; }; @@ -637,25 +638,27 @@ struct CustomNormalize }; /** - * @brief Generate the real coordinates of the prediction box relative to the original image, - * and filter all the prediction boxes to obtain the final object detection result. - * The information of each prediction box output includes image id, lable, confidence, and four coordinate values. - * (x - mean) / sqrt(var) at runtime. + * @brief The output of the object detection model is post-processed, including decoding the bounding box, + * class probability and score of the model output, and then performing non-maximum suppression (NMS) to remove + * the overlapping bounding box, and finally outputting the detection result. * * The {@link NodeType} of this operator is NODE_TYPE_DETECTION_POST_PROCESS. * * Input: * - * * bbox, boxes to be predicted. - * * scores, socres of all boxes. - * * anchors, information of boxes, includes box, variance and coordinates. + * * bbox, bounding box for model output. + * * scores, probability of class score for model output. + * * anchors, The coordinates and size information of the candidate boxes used to generate the detection box. * * Output: * - * * image_id, the image ID of target detected bboxes. - * * label, the label of target detected bboxes. - * * confidence, the score of target detected bboxes. - * * coordinates, the coordinate of target detected bboxes. + * * bboxes, 3-dimensional tensor with an inner array representing the coordinate values of the object + * * detection box. + * * classes,2-dimensional tensor with an internal numeric value representing the classification index + * * corresponding to each detection box. + * * confidences, 2-dimensional tensor with an internal numerical value indicating the confidence level + * * of the detected object. + * * numDetections, 1-dimensional tensor, the number of test results. * * @since 5.0 * @version 2.1 @@ -665,7 +668,7 @@ struct DetectionPostProcess /** Format of input tensor, default NCHW. */ enum Format format; /** The size of the input tensor. */ - long input_size; + long inputSize; /** The scaling factor used to convert the output from the normalized form to the original image coordinates. */ float[] scale; /** The threshold of overlapping region during NMS. */ @@ -702,16 +705,16 @@ struct DetectionPostProcess * * Output: * - * * Output tensor of [N, H * blocksize, W * blocksize, C/(blocksize * blocksize)] for NHWC format\n - * or [N, C/(blocksize * blocksize), H * blocksize, W * blocksize] for NCHW format. + * * Output tensor of [N, H * blockSize, W * blockSize, C/(blockSize * blockSize)] for NHWC format\n + * or [N, C/(blockSize * blockSize), H * blockSize, W * blockSize] for NCHW format. * * @since 5.0 * @version 2.1 */ struct DepthToSpace { - /** Blocks of [blocksize, blocksize] are moved. */ - long block_size; + /** Blocks of [blockSize, blockSize] are moved. */ + long blockSize; /** Format of input tensor, default NCHW. */ enum Format format; /** DCR (default) for depth-column-row order re-arrangement. Use CRD for column-row-depth order. */ @@ -1016,7 +1019,7 @@ struct Greater }; /** - * @brief Returns the tensor resulted from performing the greater_equal logical operation elementwise\n + * @brief Returns the tensor resulted from performing the greater-equal logical operation elementwise\n * on the input tensors x1 and x2. * * The {@link NodeType} of this operator is NODE_TYPE_GREATER_EQUAL. @@ -1118,7 +1121,7 @@ struct LayerNormFusion struct LeakyRelu { /** Coefficient of leakage. */ - float negative_slope; + float negativeSlope; }; /** @@ -1187,7 +1190,7 @@ struct Log }; /** - * @brief Calculates the truth value of x1 AND x2 element-wise. + * @brief Calculates the logical value of x1 AND x2 element-wise. * * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_AND. * @@ -1208,7 +1211,7 @@ struct LogicalAnd }; /** - * @brief Calculates the truth value of NOT x element-wise. + * @brief Calculates the logical value of NOT x element-wise. * * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_NOT. * @@ -1228,7 +1231,7 @@ struct LogicalNot }; /** - * @brief Calculates the truth value of x1 OR x2 element-wise. + * @brief Calculates the logical value of x1 OR x2 element-wise. * * The {@link NodeType} of this operator is NODE_TYPE_LOGICAL_OR. * @@ -1299,7 +1302,7 @@ struct L2NormalizeFusion /** The axis on which to apply normalization, -1 means last axis, default: 0.*/ long[] axis; /** Value added for numerical stability. default: 1e-4; */ - float epslion; + float epsilon; /** Activation function type. For details, see {@link ActivationType}. */ enum ActivationType activationType; }; @@ -1311,50 +1314,50 @@ struct L2NormalizeFusion * * Input: * - * * input, input tensor, shape is [seq_len, batch_size, input_size]. - * * weight_ih, weight tensor of input-layer to hidden-layer, - * shape is [num_directions* num_layers, 4 * hidden_size, input_size]. - * * weight_hh, weight tensor of hidden-layer to hidden-layer, - * shape is [num_directions* num_layers, 4 * hidden_size, hidden_size]. + * * input, input tensor, shape is [seqLen, batchSize, inputSize]. + * * weightIh, weight tensor of input-layer to hidden-layer, + * shape is [numDirections * numLayers, 4 * hiddenSize, inputSize]. + * * weightHh, weight tensor of hidden-layer to hidden-layer, + * shape is [numDirections * numLayers, 4 * hiddenSize, hiddenSize]. * * bias, bias tensor of input-layer and hidden-layer to hidden-layer, - * shape is [num_directions* num_layers, 8 * hidden_size]. - * * hidden_state, init state of hidden-layer, shape is [num_directions * num_layers, batch_size, hidden_size]. - * * cell_state, init state of cell, shape is [num_directions * num_layers, batch_size, hidden_size]. + * shape is [numDirections * numLayers, 8 * hiddenSize]. + * * hiddenState, init state of hidden-layer, shape is [numDirections * numLayers, batchSize, hiddenSize]. + * * cellState, init state of cell, shape is [numDirections * numLayers, batchSize, hiddenSize]. * * Output: * * * output, a tensor that concats all the intermediate output tensor of the hidden, - * shape is [seq_len, batch_size, num_directions * real_hidden_size]. - * * hidden_state, the last output tensor of the hidden-layer, - * shape is [num_directions * num_layers, batch_size, real_hidden_size]. - * * cell_state, the last output tensor of the cell, - * shape is [num_directions * num_layers, batch_size, hidden_size]. + * shape is [seqLen, batchSize, numDirections * realHiddenSize]. + * * hiddenState, the last output tensor of the hidden-layer, + * shape is [numDirections * numLayers, batchSize, realHiddenSize]. + * * cellState, the last output tensor of the cell, + * shape is [numDirections * numLayers, batchSize, hiddenSize]. * * @since 5.0 * @version 2.1 */ struct LSTM { - /** Whether the LSTM operation is bidirectional. */ - boolean bidirectional; + /** Whether the LSTM operation is bi-directional. */ + boolean biDirectional; /** Whether the operation contains bias. */ - boolean has_bias; + boolean hasBias; /** Size of input tensor. */ - long input_size; + long inputSize; /** Size of hidden state tensor. */ - long hidden_size; + long hiddenSize; /** Layers of LSTM network. */ - long num_layers; + long numLayers; /** Number of directions, value is 2 if direction == bidirectional else 1. */ - long num_directions; + long numDirections; /** Dropout probalility of each layer except first-layer. */ float dropout; /** Probalility that the cell state retains the previous state. Default: 0. */ - float zoneout_cell; + float zoneoutCell; /** Probalility that the hidden state retains the previous state. Default: 0. */ - float zoneout_hidden; - /** If proj_size > 0, will use LSTM with projections of corresponding size. Default: 0. */ - long proj_size; + float zoneoutHidden; + /** If projSize > 0, will use LSTM with projections of corresponding size. Default: 0. */ + long projSize; }; /** @@ -1433,7 +1436,7 @@ struct Maximum */ struct MaxPoolFusion { - /** Size of the kernel used to take the maximum value. It is an int array [kernel_height, kernel_weight]\n + /** Size of the kernel used to take the maximum value. It is an int array [kernelHeight, kernelWeight]\n * with length of 2. */ long[] kernelSize; @@ -1533,7 +1536,7 @@ struct MulFusion }; /** - * @brief Returns a tensor with negative values of the input tensor element-wise. + * @brief Calculate the opposite value of the input tensor element-wise. * * The {@link NodeType} of this operator is NODE_TYPE_NEG. * @@ -1553,7 +1556,7 @@ struct Neg }; /** - * @brief Returns the tensor resulted from performing the not_equal logical operation elementwise\n + * @brief Returns the tensor resulted from performing the not-equal logical operation elementwise\n * on the input tensors x1 and x2. * * The {@link NodeType} of this operator is NODE_TYPE_NOT_EQUAL. @@ -1577,19 +1580,19 @@ struct NotEqual /** * @brief Generates a one-hot tensor based on the specified locations. * - * The locations specified by indices are determined by on_value, and other locations are determined\n - * by off_value. + * The locations specified by indices are determined by onValue, and other locations are determined\n + * by offValue. * * The {@link NodeType} of this operator is NODE_TYPE_ONE_HOT. * * Input: * - * * indices, an n-dimensional tensor. Each element in indices determines the location of on_value\n + * * indices, an n-dimensional tensor. Each element in indices determines the location of onValue\n * in each one-hot vector. * * depth, an integer scalar that determines the depth of the one-hot vector. The value of depth must be\n * greater than 0. - * * on_value, a scalar that specifies a valid value in the one-hot vector. - * * off_value, a scalar that specifies the values of other locations in the one-hot vector except the valid value. + * * onValue, a scalar that specifies a valid value in the one-hot vector. + * * offValue, a scalar that specifies the values of other locations in the one-hot vector except the valid value. * * Output: * @@ -1788,7 +1791,7 @@ struct Rank struct Range { /** Reserved dataType parameter. */ - long d_type; + long dataType; /** Scalar. First entry for the range of output values. */ long start; /** Scalar. Exclusive upper limit for the range of output values. */ @@ -1842,7 +1845,7 @@ struct RealDiv * @brief Reduces the dimensions of a tensor. * * The {@link NodeType} of this operator is NODE_TYPE_REDUCE_FUSION. - * If mode is REDUCE_ALL, REDUCE_PROD, or REDUCE_MEAN and reduce_to_end + * If mode is REDUCE_ALL, REDUCE_PROD, or REDUCE_MEAN and reduceToEnd * is true, the output is the reduced value multiplied by coeff. * * Input: @@ -2023,8 +2026,8 @@ struct ScaleFusion * Input: * * * indices, the index of scattering in the new tensor with int32 or int64 data type. - * The rank of indices must be at least 2 and indices_shape[-1] <= len(shape). - * * updates, the source tensor to be scattered. It has shape indices_shape[:-1] + shape[indices_shape[-1]:]. + * The rank of indices must be at least 2 and indiceShape[-1] <= len(shape). + * * updates, the source tensor to be scattered. It has shape indiceShape[:-1] + shape[indiceShape[-1]:]. * * shape, the shape of the output tensor, has the same data type as indices. * * Output: @@ -2161,10 +2164,10 @@ struct SpaceToBatchND /** * @brief Rearrange blocks of spatial data into depth. * - * The output tensor’s height dimension is height / blocksize; - * The output tensor’s weight dimension is weight / blocksize; - * The depth of output tensor is blocksize * blocksize * inputDepth; - * The input tensor’s height and width must be divisible by blocksize. + * The output tensor’s height dimension is height / blockSize; + * The output tensor’s weight dimension is weight / blockSize; + * The depth of output tensor is blockSize * blockSize * inputDepth; + * The input tensor’s height and width must be divisible by blockSize. * * The {@link NodeType} of this operator is NODE_TYPE_SPACE_TO_DEPTH. * @@ -2174,7 +2177,7 @@ struct SpaceToBatchND * * Output: * - * * Result tensor with the same data_type as the input x. + * * Result tensor with the same dataType as the input x. * * @since 5.0 * @version 2.1 @@ -2182,7 +2185,7 @@ struct SpaceToBatchND struct SpaceToDepth { /** The block size used to divide spatial data. It must be >= 2. */ - long blocksize; + long blockSize; /** Format of the tensor data. For details, see {@link Format}. */ enum Format format; }; @@ -2234,9 +2237,9 @@ struct Split long outputNum; /** * Size of each tensor to output. - * If size_splits is empty, x will be evenly split into tensors of the same size. + * If sizeSplits is empty, x will be evenly split into tensors of the same size. * In this case, x.shape[axis] must be an integer multiple of outputNum. - * If size_splits is not empty, the sum of all elements must be equal to x.shape[axis]. + * If sizeSplits is not empty, the sum of all elements must be equal to x.shape[axis]. */ long[] sizeSplits; /** Target axis on which x is split. The data type is int. */ @@ -2396,7 +2399,7 @@ struct StridedSlice */ long beginMask; /** - * Mask of end. The parameter is similar to begin_mask. + * Mask of end. The parameter is similar to beginMask. * endMask identifies different dimensions of x in binary code. For example, if bit i of endMask is * set to 1, the setting of end in the ith dimension will be invalid, which means the tensor will be * sliced till the end in that dimension. The default value is 0. @@ -2678,4 +2681,30 @@ struct LogSoftmax long axis; }; +/** + * @brief Converts the data type. + * + * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST_V2. + * + * Input: + * + * * x, an n-dimensional tensor. + * + * Output: + * + * * Tensor after the data type conversion. + * + * @since 3.2 + * @version 2.1 + */ +struct QuantDTypeCastV2 +{ + /** Data type of the input tensor. */ + long srcT; + /** Data type of the output tensor. */ + long dstT; + /** The axis to apply QuantDTypeCastV2 operation. */ + long axis; +}; + /** @} */ -- Gitee From 3fcce124a12b2510a1acf665485e5c831eec9b5d Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 19 Mar 2024 10:03:01 +0800 Subject: [PATCH 096/210] update desc Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index bab42666..4473fb2f 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -196,9 +196,8 @@ struct ArgMaxFusion * * data, the tensors to print out when condition is false. * * Output: - * * output, result value judged by condition. If the condition is not true, an Error is returned. * - * * + * * Result value judged by condition. If the condition is not true, an Error is returned. * * @since 5.0 * @version 2.1 -- Gitee From f5baf811f1887c92cfeb236fca8653368725cbd8 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Tue, 19 Mar 2024 11:21:16 +0800 Subject: [PATCH 097/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E6=A3=80=E6=B5=8Btag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 1 + camera/metadata/include/camera_metadata_item_info.h | 2 ++ camera/metadata/src/camera_metadata_info.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 340367e9..567884a8 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -279,6 +279,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, + OHOS_CONTROL_MOTION_DETECTION_CHECK_AREA, OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 6a4d5e60..f3b322bb 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -320,6 +320,8 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT [OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE - OHOS_CAMERA_EFFECT_START] = {"cameraPhysicalApertureControlValue", META_TYPE_FLOAT, 1}, [OHOS_DEVICE_EXITCAMERA_EVENT - OHOS_CAMERA_EFFECT_START] = {"exitCameraEvent", META_TYPE_BYTE, 1}, + [OHOS_CONTROL_MOTION_DETECTION_CHECK_AREA - + OHOS_CAMERA_EFFECT_START] = {"superSlowMotionCheckArea", META_TYPE_FLOAT, -1}, [OHOS_STATUS_SLOW_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"superSlowMotionStatus", META_TYPE_BYTE, 1}, [OHOS_ABILITY_MOTION_DETECTION_SUPPORT - diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index d9e00bb9..0667c59f 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -180,6 +180,7 @@ const std::vector g_metadataTags = { OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, + OHOS_CONTROL_MOTION_DETECTION_CHECK_AREA, OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, -- Gitee From b3bf7dabb14ca3d8132f4f0c2af419ce3e37f116 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 19 Mar 2024 14:42:22 +0800 Subject: [PATCH 098/210] update desc Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 4473fb2f..6bed1a04 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -1435,7 +1435,7 @@ struct Maximum */ struct MaxPoolFusion { - /** Size of the kernel used to take the maximum value. It is an int array [kernelHeight, kernelWeight]\n + /** Size of the kernel used to take the maximum value. It is an int array [kernel_height, kernel_weight]\n * with length of 2. */ long[] kernelSize; @@ -2025,8 +2025,8 @@ struct ScaleFusion * Input: * * * indices, the index of scattering in the new tensor with int32 or int64 data type. - * The rank of indices must be at least 2 and indiceShape[-1] <= len(shape). - * * updates, the source tensor to be scattered. It has shape indiceShape[:-1] + shape[indiceShape[-1]:]. + * The rank of indices must be at least 2 and indices_shape[-1] <= len(shape). + * * updates, the source tensor to be scattered. It has shape indices_shape[:-1] + shape[indices_shape[-1]:]. * * shape, the shape of the output tensor, has the same data type as indices. * * Output: -- Gitee From 50bd383396fc98215b79f02ea55b87023927da62 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 19 Mar 2024 14:45:10 +0800 Subject: [PATCH 099/210] update ops enum Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index fe893d8f..08917e42 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -482,7 +482,7 @@ enum NodeType : unsigned int { /** LogSoftmax operator. */ NODE_TYPE_LOG_SOFTMAX = 189, /** QuantDTypeCastV2 operator. */ - NODE_TYPE_QUANT_DTYPE_CAST_V2 = 500, + NODE_TYPE_QUANT_DTYPE_CAST_V2 = 999, }; /** -- Gitee From b53e145f182a5f5ceaf7e5502880c08e8acb55a2 Mon Sep 17 00:00:00 2001 From: l30053696 Date: Tue, 19 Mar 2024 14:57:31 +0800 Subject: [PATCH 100/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/bundle.json | 27 +++++++++- sensor/v2_1/BUILD.gn | 34 ++++++++++++ sensor/v2_1/ISensorInterface.idl | 77 ++++++++++++++++++++++++++ sensor/v2_1/SensorTypes.idl | 92 ++++++++++++++++++++++++++++++++ 4 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 sensor/v2_1/BUILD.gn create mode 100644 sensor/v2_1/ISensorInterface.idl create mode 100644 sensor/v2_1/SensorTypes.idl diff --git a/sensor/bundle.json b/sensor/bundle.json index 52b2ffd3..5b095808 100644 --- a/sensor/bundle.json +++ b/sensor/bundle.json @@ -27,7 +27,8 @@ }, "build": { "sub_component": [ - "//drivers/interface/sensor/v2_0:sensor_idl_target" + "//drivers/interface/sensor/v2_0:sensor_idl_target", + "//drivers/interface/sensor/v2_1:sensor_idl_target" ], "test": [ ], @@ -55,6 +56,30 @@ ], "header_base": "//drivers/interface/sensor" } + }, + { + "name": "//drivers/interface/sensor/v2_1:libsensor_proxy_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/sensor" + } + }, + { + "name": "//drivers/interface/sensor/v2_1:libsensor_stub_2.1", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/sensor" + } + }, + { + "name": "//drivers/interface/sensor/v2_1:sensor_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/sensor" + } } ] } diff --git a/sensor/v2_1/BUILD.gn b/sensor/v2_1/BUILD.gn new file mode 100644 index 00000000..50a5e533 --- /dev/null +++ b/sensor/v2_1/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2021-2023 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. + +HDF_CORE_PATH = "../../../hdf_core" +import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libsensor_proxy_2.1") { + deps = [] + public_configs = [] + } +} else { + hdi("sensor") { + module_name = "sensor_service" + + sources = [ + "ISensorInterface.idl", + "SensorTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_sensor" + } +} diff --git a/sensor/v2_1/ISensorInterface.idl b/sensor/v2_1/ISensorInterface.idl new file mode 100644 index 00000000..511f7159 --- /dev/null +++ b/sensor/v2_1/ISensorInterface.idl @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2021-2023 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 HdiSensor + * @{ + * + * @brief Provides unified APIs for sensor services to access sensor drivers. + * + * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to + * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, + * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, + * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. + * + * @since 4.1 + */ + +/** + * @file ISensorInterface.idl + * + * @brief Declares the APIs provided by the sensor module for obtaining sensor information, subscribing to or + * unsubscribing from sensor data, enabling or disabling a sensor, setting the sensor data reporting mode, + * and setting sensor options such as the accuracy and measurement range. + * + * @since 4.1 + * @version 2.0 + */ + +package ohos.hdi.sensor.v2_1; + +import ohos.hdi.sensor.v2_1.SensorTypes; +import ohos.hdi.sensor.v2_0.ISensorInterface; + +/** + * @brief Defines the functions for performing basic operations on sensors. + * + * The operations include obtaining sensor information, subscribing to or unsubscribing from sensor data, + * enabling or disabling a sensor, setting the sensor data reporting mode, and setting sensor options such as + * the accuracy and measurement range. + */ +interface ISensorInterface extends ohos.hdi.sensor.v2_0.ISensorInterface{ + + /** + * @brief Enables the sensor available in the sensor list based on the specified sensor ID. + * The subscriber can obtain the sensor data only after the sensor is enabled. + * + * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. + * @return Returns 0 if the sensor is successfully enabled; returns a negative value otherwise. + * + * @since 2.2 + * @version 1.0 + */ + Enable([in] HdfSensorTypeTag sensorId); + + /** + * @brief Disables an enabled sensor. + * + * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. + * @return Returns 0 if the sensor is successfully disabled; returns a negative value otherwise. + * + * @since 2.2 + * @version 1.0 + */ + Disable([in] HdfSensorTypeTag sensorId); +} diff --git a/sensor/v2_1/SensorTypes.idl b/sensor/v2_1/SensorTypes.idl new file mode 100644 index 00000000..46a08ee5 --- /dev/null +++ b/sensor/v2_1/SensorTypes.idl @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2021-2023 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 HdiSensor + * @{ + * + * @brief Provides unified APIs for sensor services to access sensor drivers. + * + * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to + * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, + * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, + * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. + * + * @version 2.1 + */ + +/** + * @file SensorTypes.idl + * + * @brief Defines the data used by the sensor module, including the sensor information, + * and reported sensor data. + * + * @since 5.0 + * @version 2.1 + */ + +package ohos.hdi.sensor.v2_1; + +import ohos.hdi.sensor.v2_0.SensorTypes; + +/** + * @brief Enumerates sensor types. + * + * @since 5.0 + */ +enum HdfSensorTypeTag { + HDF_SENSOR_TYPE_NONE = 0, /**< None, for testing only */ + HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< Acceleration sensor */ + HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< Gyroscope sensor */ + HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< Photoplethysmography sensor */ + HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< Electrocardiogram (ECG) sensor */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ + HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< Capacitive sensor */ + HDF_SENSOR_TYPE_BAROMETER = 8, /**< Barometric pressure sensor */ + HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< Temperature sensor */ + HDF_SENSOR_TYPE_HALL = 10, /**< Hall effect sensor */ + HDF_SENSOR_TYPE_GESTURE = 11, /**< Gesture sensor */ + HDF_SENSOR_TYPE_PROXIMITY = 12, /**< Proximity sensor */ + HDF_SENSOR_TYPE_HUMIDITY = 13, /**< Humidity sensor */ + HDF_SENSOR_TYPE_COLOR = 14, /**< Color sensor */ + HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */ + HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ + HDF_SENSOR_TYPE_HALL1 = 17, /**< Secondary hall effect sensor */ + HDF_SENSOR_TYPE_PROXIMITY1 = 18, /**< Secondary proximity sensor */ + HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */ + HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */ + HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */ + HDF_SENSOR_TYPE_ORIENTATION = 256, /**< Orientation sensor */ + HDF_SENSOR_TYPE_GRAVITY = 257, /**< Gravity sensor */ + HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ + HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ + HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ + HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ + HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */ + HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ + HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ + HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ + HDF_SENSOR_TYPE_PEDOMETER = 266, /**< Pedometer sensor */ + HDF_SENSOR_TYPE_POSTURE = 267, /**< Posture sensor */ + HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< Headposture sensor */ + HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< Drop detection sensor */ + HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */ + HDF_SENSOR_TYPE_HEART_RATE = 278, /**< Heart rate sensor */ + HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ + HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */ + HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ + HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */ +}; \ No newline at end of file -- Gitee From 74e9881582182a5a99b6596c264718e4a3d99448 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 19 Mar 2024 15:23:59 +0800 Subject: [PATCH 101/210] update nnrt desc Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 6bed1a04..82cc76f8 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -1338,7 +1338,7 @@ struct L2NormalizeFusion struct LSTM { /** Whether the LSTM operation is bi-directional. */ - boolean biDirectional; + boolean bidirectional; /** Whether the operation contains bias. */ boolean hasBias; /** Size of input tensor. */ -- Gitee From 946267c1fbbeb16ffad4755f8fde075610aec6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 19 Mar 2024 15:36:12 +0800 Subject: [PATCH 102/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/v2_1/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/sensor/v2_1/BUILD.gn b/sensor/v2_1/BUILD.gn index 50a5e533..efa237c9 100644 --- a/sensor/v2_1/BUILD.gn +++ b/sensor/v2_1/BUILD.gn @@ -21,6 +21,7 @@ if (defined(ohos_lite)) { } else { hdi("sensor") { module_name = "sensor_service" + imports = [ "ohos.hdi.sensor.v1_1:sensor" ] sources = [ "ISensorInterface.idl", -- Gitee From e4fd59a5f58da9a7b04cd472114874de90739118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 19 Mar 2024 15:42:48 +0800 Subject: [PATCH 103/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/v2_1/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensor/v2_1/BUILD.gn b/sensor/v2_1/BUILD.gn index efa237c9..00cc881c 100644 --- a/sensor/v2_1/BUILD.gn +++ b/sensor/v2_1/BUILD.gn @@ -21,7 +21,7 @@ if (defined(ohos_lite)) { } else { hdi("sensor") { module_name = "sensor_service" - imports = [ "ohos.hdi.sensor.v1_1:sensor" ] + imports = [ "ohos.hdi.sensor.v2_0:sensor" ] sources = [ "ISensorInterface.idl", -- Gitee From 4b53da008cb65256e1240643ea1b663debf6c4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 19 Mar 2024 16:11:19 +0800 Subject: [PATCH 104/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/v2_1/BUILD.gn | 2 +- sensor/v2_1/ISensorInterface.idl | 2 +- sensor/v2_1/SensorTypes.idl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sensor/v2_1/BUILD.gn b/sensor/v2_1/BUILD.gn index 00cc881c..8fe3dc4e 100644 --- a/sensor/v2_1/BUILD.gn +++ b/sensor/v2_1/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 diff --git a/sensor/v2_1/ISensorInterface.idl b/sensor/v2_1/ISensorInterface.idl index 511f7159..6344da24 100644 --- a/sensor/v2_1/ISensorInterface.idl +++ b/sensor/v2_1/ISensorInterface.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/sensor/v2_1/SensorTypes.idl b/sensor/v2_1/SensorTypes.idl index 46a08ee5..96d16369 100644 --- a/sensor/v2_1/SensorTypes.idl +++ b/sensor/v2_1/SensorTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From 40daff553b63352c4773639c322c45647a387702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Tue, 19 Mar 2024 20:48:16 +0800 Subject: [PATCH 105/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/v2_1/ISensorInterface.idl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sensor/v2_1/ISensorInterface.idl b/sensor/v2_1/ISensorInterface.idl index 6344da24..44b52395 100644 --- a/sensor/v2_1/ISensorInterface.idl +++ b/sensor/v2_1/ISensorInterface.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. * - * @since 4.1 + * @since 5.0 */ /** @@ -34,8 +34,8 @@ * unsubscribing from sensor data, enabling or disabling a sensor, setting the sensor data reporting mode, * and setting sensor options such as the accuracy and measurement range. * - * @since 4.1 - * @version 2.0 + * @since 5.0 + * @version 2.1 */ package ohos.hdi.sensor.v2_1; @@ -59,8 +59,8 @@ interface ISensorInterface extends ohos.hdi.sensor.v2_0.ISensorInterface{ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. * @return Returns 0 if the sensor is successfully enabled; returns a negative value otherwise. * - * @since 2.2 - * @version 1.0 + * @since 5.0 + * @version 2.1 */ Enable([in] HdfSensorTypeTag sensorId); @@ -70,8 +70,8 @@ interface ISensorInterface extends ohos.hdi.sensor.v2_0.ISensorInterface{ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. * @return Returns 0 if the sensor is successfully disabled; returns a negative value otherwise. * - * @since 2.2 - * @version 1.0 + * @since 5.0 + * @version 2.1 */ Disable([in] HdfSensorTypeTag sensorId); } -- Gitee From d662e62e771e5fd3623f52bfc5860734fe1c0c98 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Tue, 19 Mar 2024 11:47:58 +0800 Subject: [PATCH 106/210] =?UTF-8?q?camera=E5=91=8A=E8=AD=A6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- .../include/camera_device_ability_items.h | 9 ++--- .../include/camera_metadata_item_info.h | 9 +++-- camera/metadata/src/camera_metadata_info.cpp | 35 +++++++++++++++++-- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 340367e9..7da84c46 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -278,6 +278,7 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_CAMERA_VIRTUAL_APERTURE_VALUE, OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, + OHOS_STATUS_CAMERA_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, @@ -352,10 +353,10 @@ typedef enum camera_focus_mode_enum { // OHOS_ABILITY_FOCUS_ASSIST_FLASH_SUPPORTED_MODES enumeration values typedef enum camera_focus_assist_flash_mode_enum { - OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_DEFAULT = 0, - OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_AUTO, - OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_ON, - OHOS_CAMERA_FOCUS_ASSIT_FLASH_MODE_OFF + OHOS_CAMERA_FOCUS_ASSIST_FLASH_MODE_DEFAULT = 0, + OHOS_CAMERA_FOCUS_ASSIST_FLASH_MODE_AUTO, + OHOS_CAMERA_FOCUS_ASSIST_FLASH_MODE_ON, + OHOS_CAMERA_FOCUS_ASSIST_FLASH_MODE_OFF } camera_focus_assist_flash_mode_enum_t; // OHOS_CONTROL_FLASHMODE and OHOS_ABILITY_FLASH_MODES enumeration values diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 6a4d5e60..ad722726 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -185,7 +185,8 @@ static item_info_t g_ohosDeviceExposure[OHOS_DEVICE_EXPOSURE_END - OHOS_DEVICE_E [OHOS_ABILITY_EXPOSURE_MODES - OHOS_DEVICE_EXPOSURE_START] = {"exposureSupportiveModes", META_TYPE_BYTE, -1}, [OHOS_CONTROL_EXPOSURE_MODE - OHOS_DEVICE_EXPOSURE_START] = {"exMode", META_TYPE_BYTE, 1 }, [OHOS_ABILITY_METER_MODES - OHOS_DEVICE_EXPOSURE_START] = {"meterAvailableModes", META_TYPE_BYTE, -1}, - [OHOS_ABILITY_SCENE_EXPOSURE_MODES - OHOS_DEVICE_EXPOSURE_START] = {"sceneExposureSupportiveModes", META_TYPE_BYTE, -1}, + [OHOS_ABILITY_SCENE_EXPOSURE_MODES - + OHOS_DEVICE_EXPOSURE_START] = {"sceneExposureSupportiveModes", META_TYPE_BYTE, -1}, [OHOS_ABILITY_EXPOSURE_TIME - OHOS_DEVICE_EXPOSURE_START] = {"abilityExposureTime", META_TYPE_INT32, -1}, [OHOS_ABILITY_AE_LOCK - OHOS_DEVICE_EXPOSURE_START] = {"abilityAELock", META_TYPE_BYTE, -1}, }; @@ -319,6 +320,8 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"cameraPhysicalApertureRange", META_TYPE_FLOAT, -1}, [OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE - OHOS_CAMERA_EFFECT_START] = {"cameraPhysicalApertureControlValue", META_TYPE_FLOAT, 1}, + [OHOS_STATUS_CAMERA_APERTURE_VALUE - + OHOS_CAMERA_EFFECT_START] = {"currentCameraApertureValue", META_TYPE_FLOAT, 1}, [OHOS_DEVICE_EXITCAMERA_EVENT - OHOS_CAMERA_EFFECT_START] = {"exitCameraEvent", META_TYPE_BYTE, 1}, [OHOS_STATUS_SLOW_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"superSlowMotionStatus", META_TYPE_BYTE, 1}, @@ -349,9 +352,9 @@ static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECUR }; static item_info_t g_ohosCameraXmage[OHOS_XMAGE_COLOR_MODES_END - OHOS_XMAGE_COLOR_MODES_START] = { - [OHOS_ABILITY_SUPPORTED_COLOR_MODES - OHOS_XMAGE_COLOR_MODES_START] = + [OHOS_ABILITY_SUPPORTED_COLOR_MODES - OHOS_XMAGE_COLOR_MODES_START] = {"cameraXmageSupportMode", META_TYPE_BYTE, 1}, - [OHOS_CONTROL_SUPPORTED_COLOR_MODES - OHOS_XMAGE_COLOR_MODES_START] = + [OHOS_CONTROL_SUPPORTED_COLOR_MODES - OHOS_XMAGE_COLOR_MODES_START] = {"cameraXmageControlMode", META_TYPE_BYTE, 1}, }; diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index d9e00bb9..3b465d9d 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -179,6 +179,7 @@ const std::vector g_metadataTags = { OHOS_CONTROL_CAMERA_VIRTUAL_APERTURE_VALUE, OHOS_ABILITY_CAMERA_PHYSICAL_APERTURE_RANGE, OHOS_CONTROL_CAMERA_PHYSICAL_APERTURE_VALUE, + OHOS_STATUS_CAMERA_APERTURE_VALUE, OHOS_DEVICE_EXITCAMERA_EVENT, OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, @@ -792,10 +793,12 @@ int CameraMetadata::UpdateameraMetadataItemSize(camera_metadata_item_entry_t *it { size_t dataSize = CalculateCameraMetadataItemDataSize(item->data_type, dataCount); size_t dataPayloadSize = dataCount * OHOS_CAMERA_METADATA_TYPE_SIZE[item->data_type]; - size_t oldItemSize = CalculateCameraMetadataItemDataSize(item->data_type, item->count); - int32_t ret = CAM_META_SUCCESS; + if (item == nullptr || dst == nullptr) { + METADATA_ERR_LOG("UpdateameraMetadataItemSize item is null or dst is null"); + return CAM_META_FAILURE; + } if (dataSize != oldItemSize) { if (dst->data_capacity < (dst->data_count + dataSize - oldItemSize)) { METADATA_ERR_LOG("UpdateCameraMetadataItemByIndex data_capacity limit reached"); @@ -1030,6 +1033,10 @@ std::string U8ItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.u8 == nullptr) { + METADATA_ERR_LOG("U8ItemToString: entry.data.u8 is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.u8)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1056,6 +1063,10 @@ std::string I32ItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.i32 == nullptr) { + METADATA_ERR_LOG("I32ItemToString: entry.data.i32 is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.i32)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1082,6 +1093,10 @@ std::string U32ItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.ui32 == nullptr) { + METADATA_ERR_LOG("U32ItemToString: entry.data.ui32 is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.ui32)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1108,6 +1123,10 @@ std::string I64ItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.i64 == nullptr) { + METADATA_ERR_LOG("I64ItemToString: entry.data.i64 is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.i64)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1134,6 +1153,10 @@ std::string FloatItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.f == nullptr) { + METADATA_ERR_LOG("FloatItemToString: entry.data.f is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.f)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1160,6 +1183,10 @@ std::string DoubleItemToString(int32_t item, const camera_metadata_item_t entry) { std::string st = {}; uint32_t count = entry.count; + if (entry.data.d == nullptr) { + METADATA_ERR_LOG("DoubleItemToString: entry.data.d is null!"); + return st; + } std::string dataStr = std::to_string(*(entry.data.d)); for (uint32_t i = 1; i < count; i++) { if ((i % WRAP_LENGTH) == 0) { @@ -1186,6 +1213,10 @@ std::string RationalItemToString(int32_t item, const camera_metadata_item_t entr { std::string st = {}; uint32_t count = entry.count; + if (entry.data.r == nullptr) { + METADATA_ERR_LOG("RationalItemToString: entry.data.r is null!"); + return st; + } std::string dataStr = std::to_string((*(entry.data.r)).numerator) + "/" + std::to_string((*(entry.data.r)).denominator); for (uint32_t i = 1; i < count; i++) { -- Gitee From d42a2fe05a240b4b354a03a6c0fe7678729fe41b Mon Sep 17 00:00:00 2001 From: maoyong Date: Wed, 20 Mar 2024 10:52:09 +0800 Subject: [PATCH 107/210] detete customNormalize Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 2 -- nnrt/v2_1/NodeAttrTypes.idl | 22 ---------------------- 2 files changed, 24 deletions(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index 08917e42..d108b746 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -329,8 +329,6 @@ enum NodeType : unsigned int { NODE_TYPE_CONSTANT_OF_SHAPE = 38, /** Crop operator. */ NODE_TYPE_CROP = 39, - /** CustomNormalize operator. */ - NODE_TYPE_CUSTOM_NORMALIZE = 41, /** DepthToSpace operator. */ NODE_TYPE_DEPTH_TO_SPACE = 45, /** DetectionPostProcess operator. */ diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 82cc76f8..fdf35c2d 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -614,28 +614,6 @@ struct Crop long[] offset; }; -/** - * @brief Shift and scale inputs into a distribution centered around 0 with standard deviation 1. - * It accomplishes this by precomputing the mean and variance of the data, and calling\n - * (x - mean) / sqrt(var) at runtime. - * - * The {@link NodeType} of this operator is NODE_TYPE_CUSTOM_NORMALIZE. - * - * Input: - * - * * x, an n-dimensional tensor. - * - * Output: - * - * * Normalized output tensor. - * - * @since 5.0 - * @version 2.1 - */ -struct CustomNormalize -{ -}; - /** * @brief The output of the object detection model is post-processed, including decoding the bounding box, * class probability and score of the model output, and then performing non-maximum suppression (NMS) to remove -- Gitee From 06a86a9f2b29753a7f4905bf47da9edba8a1c84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Thu, 21 Mar 2024 09:45:26 +0800 Subject: [PATCH 108/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- sensor/bundle.json | 27 +--------- sensor/v2_0/SensorTypes.idl | 1 + sensor/v2_1/BUILD.gn | 35 ------------ sensor/v2_1/ISensorInterface.idl | 77 -------------------------- sensor/v2_1/SensorTypes.idl | 92 -------------------------------- 5 files changed, 2 insertions(+), 230 deletions(-) delete mode 100644 sensor/v2_1/BUILD.gn delete mode 100644 sensor/v2_1/ISensorInterface.idl delete mode 100644 sensor/v2_1/SensorTypes.idl diff --git a/sensor/bundle.json b/sensor/bundle.json index 5b095808..52b2ffd3 100644 --- a/sensor/bundle.json +++ b/sensor/bundle.json @@ -27,8 +27,7 @@ }, "build": { "sub_component": [ - "//drivers/interface/sensor/v2_0:sensor_idl_target", - "//drivers/interface/sensor/v2_1:sensor_idl_target" + "//drivers/interface/sensor/v2_0:sensor_idl_target" ], "test": [ ], @@ -56,30 +55,6 @@ ], "header_base": "//drivers/interface/sensor" } - }, - { - "name": "//drivers/interface/sensor/v2_1:libsensor_proxy_2.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/sensor" - } - }, - { - "name": "//drivers/interface/sensor/v2_1:libsensor_stub_2.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/sensor" - } - }, - { - "name": "//drivers/interface/sensor/v2_1:sensor_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/sensor" - } } ] } diff --git a/sensor/v2_0/SensorTypes.idl b/sensor/v2_0/SensorTypes.idl index 9c9fa62a..95f2a54a 100644 --- a/sensor/v2_0/SensorTypes.idl +++ b/sensor/v2_0/SensorTypes.idl @@ -105,6 +105,7 @@ enum HdfSensorTypeTag { HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */ HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ HDF_SENSOR_TYPE_HALL1 = 17, /**< Secondary hall effect sensor */ + HDF_SENSOR_TYPE_PROXIMITY1 = 18, /**< Secondary proximity sensor */ HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */ HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */ HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */ diff --git a/sensor/v2_1/BUILD.gn b/sensor/v2_1/BUILD.gn deleted file mode 100644 index 8fe3dc4e..00000000 --- a/sensor/v2_1/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2024 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. - -HDF_CORE_PATH = "../../../hdf_core" -import("$HDF_CORE_PATH/adapter/uhdf2/hdi.gni") -if (defined(ohos_lite)) { - group("libsensor_proxy_2.1") { - deps = [] - public_configs = [] - } -} else { - hdi("sensor") { - module_name = "sensor_service" - imports = [ "ohos.hdi.sensor.v2_0:sensor" ] - - sources = [ - "ISensorInterface.idl", - "SensorTypes.idl", - ] - - language = "cpp" - subsystem_name = "hdf" - part_name = "drivers_interface_sensor" - } -} diff --git a/sensor/v2_1/ISensorInterface.idl b/sensor/v2_1/ISensorInterface.idl deleted file mode 100644 index 44b52395..00000000 --- a/sensor/v2_1/ISensorInterface.idl +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2024 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 HdiSensor - * @{ - * - * @brief Provides unified APIs for sensor services to access sensor drivers. - * - * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to - * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, - * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, - * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. - * - * @since 5.0 - */ - -/** - * @file ISensorInterface.idl - * - * @brief Declares the APIs provided by the sensor module for obtaining sensor information, subscribing to or - * unsubscribing from sensor data, enabling or disabling a sensor, setting the sensor data reporting mode, - * and setting sensor options such as the accuracy and measurement range. - * - * @since 5.0 - * @version 2.1 - */ - -package ohos.hdi.sensor.v2_1; - -import ohos.hdi.sensor.v2_1.SensorTypes; -import ohos.hdi.sensor.v2_0.ISensorInterface; - -/** - * @brief Defines the functions for performing basic operations on sensors. - * - * The operations include obtaining sensor information, subscribing to or unsubscribing from sensor data, - * enabling or disabling a sensor, setting the sensor data reporting mode, and setting sensor options such as - * the accuracy and measurement range. - */ -interface ISensorInterface extends ohos.hdi.sensor.v2_0.ISensorInterface{ - - /** - * @brief Enables the sensor available in the sensor list based on the specified sensor ID. - * The subscriber can obtain the sensor data only after the sensor is enabled. - * - * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. - * @return Returns 0 if the sensor is successfully enabled; returns a negative value otherwise. - * - * @since 5.0 - * @version 2.1 - */ - Enable([in] HdfSensorTypeTag sensorId); - - /** - * @brief Disables an enabled sensor. - * - * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. - * @return Returns 0 if the sensor is successfully disabled; returns a negative value otherwise. - * - * @since 5.0 - * @version 2.1 - */ - Disable([in] HdfSensorTypeTag sensorId); -} diff --git a/sensor/v2_1/SensorTypes.idl b/sensor/v2_1/SensorTypes.idl deleted file mode 100644 index 96d16369..00000000 --- a/sensor/v2_1/SensorTypes.idl +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2024 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 HdiSensor - * @{ - * - * @brief Provides unified APIs for sensor services to access sensor drivers. - * - * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to - * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information, - * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor, - * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range. - * - * @version 2.1 - */ - -/** - * @file SensorTypes.idl - * - * @brief Defines the data used by the sensor module, including the sensor information, - * and reported sensor data. - * - * @since 5.0 - * @version 2.1 - */ - -package ohos.hdi.sensor.v2_1; - -import ohos.hdi.sensor.v2_0.SensorTypes; - -/** - * @brief Enumerates sensor types. - * - * @since 5.0 - */ -enum HdfSensorTypeTag { - HDF_SENSOR_TYPE_NONE = 0, /**< None, for testing only */ - HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< Acceleration sensor */ - HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< Gyroscope sensor */ - HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< Photoplethysmography sensor */ - HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< Electrocardiogram (ECG) sensor */ - HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< Ambient light sensor */ - HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */ - HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< Capacitive sensor */ - HDF_SENSOR_TYPE_BAROMETER = 8, /**< Barometric pressure sensor */ - HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< Temperature sensor */ - HDF_SENSOR_TYPE_HALL = 10, /**< Hall effect sensor */ - HDF_SENSOR_TYPE_GESTURE = 11, /**< Gesture sensor */ - HDF_SENSOR_TYPE_PROXIMITY = 12, /**< Proximity sensor */ - HDF_SENSOR_TYPE_HUMIDITY = 13, /**< Humidity sensor */ - HDF_SENSOR_TYPE_COLOR = 14, /**< Color sensor */ - HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */ - HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */ - HDF_SENSOR_TYPE_HALL1 = 17, /**< Secondary hall effect sensor */ - HDF_SENSOR_TYPE_PROXIMITY1 = 18, /**< Secondary proximity sensor */ - HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */ - HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */ - HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */ - HDF_SENSOR_TYPE_ORIENTATION = 256, /**< Orientation sensor */ - HDF_SENSOR_TYPE_GRAVITY = 257, /**< Gravity sensor */ - HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */ - HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< Rotation vector sensor */ - HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */ - HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */ - HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */ - HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */ - HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */ - HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */ - HDF_SENSOR_TYPE_PEDOMETER = 266, /**< Pedometer sensor */ - HDF_SENSOR_TYPE_POSTURE = 267, /**< Posture sensor */ - HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< Headposture sensor */ - HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< Drop detection sensor */ - HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */ - HDF_SENSOR_TYPE_HEART_RATE = 278, /**< Heart rate sensor */ - HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */ - HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */ - HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */ - HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */ -}; \ No newline at end of file -- Gitee From a21782bd592770340dfd419c12899670e919ce3b Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 21 Mar 2024 11:27:11 +0800 Subject: [PATCH 109/210] update ops desc Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index d108b746..5019b247 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -475,7 +475,7 @@ enum NodeType : unsigned int { NODE_TYPE_WHERE = 168, /** Select operator. */ NODE_TYPE_SELECT = 170, - /** Ref operator. */ + /** Erf operator. */ NODE_TYPE_ERF = 178, /** LogSoftmax operator. */ NODE_TYPE_LOG_SOFTMAX = 189, -- Gitee From 0c9baa7b15b4723aab1750e0878aee5c8aa1b415 Mon Sep 17 00:00:00 2001 From: Bobie Date: Thu, 21 Mar 2024 09:36:42 +0800 Subject: [PATCH 110/210] update interface Signed-off-by: Bobie --- distributed_audio/audioext/v2_0/BUILD.gn | 26 +++++++++++ .../audioext/v2_0/IDAudioCallback.idl | 29 +++++++++++++ .../audioext/v2_0/IDAudioManager.idl | 25 +++++++++++ distributed_audio/audioext/v2_0/Types.idl | 43 +++++++++++++++++++ distributed_audio/bundle.json | 17 +++++++- 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 distributed_audio/audioext/v2_0/BUILD.gn create mode 100644 distributed_audio/audioext/v2_0/IDAudioCallback.idl create mode 100644 distributed_audio/audioext/v2_0/IDAudioManager.idl create mode 100644 distributed_audio/audioext/v2_0/Types.idl diff --git a/distributed_audio/audioext/v2_0/BUILD.gn b/distributed_audio/audioext/v2_0/BUILD.gn new file mode 100644 index 00000000..a3287a3b --- /dev/null +++ b/distributed_audio/audioext/v2_0/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2024 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("../../../../hdf_core/adapter/uhdf2/hdi.gni") +hdi("daudioext") { + module_name = "daudioext" + sources = [ + "IDAudioCallback.idl", + "IDAudioManager.idl", + "Types.idl", + ] + language = "cpp" + root = "ohos.hdi://drivers/interface/" + subsystem_name = "hdf" + part_name = "drivers_interface_distributed_audio" +} diff --git a/distributed_audio/audioext/v2_0/IDAudioCallback.idl b/distributed_audio/audioext/v2_0/IDAudioCallback.idl new file mode 100644 index 00000000..f8004a46 --- /dev/null +++ b/distributed_audio/audioext/v2_0/IDAudioCallback.idl @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 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.distributed_audio.audioext.v2_0; + +import ohos.hdi.distributed_audio.audioext.v2_0.Types; + +[callback] interface IDAudioCallback { + CreateStream([in] int streamId); + DestroyStream([in] int streamId); + SetParameters([in] int streamId, [in] struct AudioParameter param); + NotifyEvent([in] int streamId, [in] struct DAudioEvent event); + WriteStreamData([in] int streamId, [in] struct AudioData data); + ReadStreamData([in] int streamId, [out] struct AudioData data); + ReadMmapPosition([in] int streamId, [out] unsigned long frames, [out] struct CurrentTime time); + RefreshAshmemInfo([in] int streamId, [in] FileDescriptor fd, [in] int ashmemLength, [in] int lengthPerTrans); +} \ No newline at end of file diff --git a/distributed_audio/audioext/v2_0/IDAudioManager.idl b/distributed_audio/audioext/v2_0/IDAudioManager.idl new file mode 100644 index 00000000..68b05f43 --- /dev/null +++ b/distributed_audio/audioext/v2_0/IDAudioManager.idl @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024 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.distributed_audio.audioext.v2_0; + +import ohos.hdi.distributed_audio.audioext.v2_0.IDAudioCallback; +import ohos.hdi.distributed_audio.audioext.v2_0.Types; + +interface IDAudioManager { + RegisterAudioDevice([in] String adpName, [in] int devId, [in] String capability, [in] IDAudioCallback callbackObj); + UnRegisterAudioDevice([in] String adpName, [in] int devId); + NotifyEvent([in] String adpName, [in] int devId, [in] int streamId, [in] struct DAudioEvent event); +} \ No newline at end of file diff --git a/distributed_audio/audioext/v2_0/Types.idl b/distributed_audio/audioext/v2_0/Types.idl new file mode 100644 index 00000000..bd15987b --- /dev/null +++ b/distributed_audio/audioext/v2_0/Types.idl @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 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.distributed_audio.audioext.v2_0; +enum PortOperationMode { + NORMAL_MODE = 0, + MMAP_MODE = 1, +}; +struct AudioParameter { + unsigned int format; + unsigned int channelCount; + unsigned int sampleRate; + unsigned int period; + unsigned int frameSize; + unsigned int streamUsage; + enum PortOperationMode renderFlags; + enum PortOperationMode capturerFlags; + String ext; +}; +struct AudioData { + struct AudioParameter param; + byte[] data; +}; +struct DAudioEvent { + int type; + String content; +}; +struct CurrentTime { + long tvSec; + long tvNSec; +}; \ No newline at end of file diff --git a/distributed_audio/bundle.json b/distributed_audio/bundle.json index 4920a2ae..0851bc36 100644 --- a/distributed_audio/bundle.json +++ b/distributed_audio/bundle.json @@ -26,7 +26,8 @@ "build": { "sub_component": [ "//drivers/interface/distributed_audio/audio/v1_0:daudio_idl_target", - "//drivers/interface/distributed_audio/audioext/v1_0:daudioext_idl_target" + "//drivers/interface/distributed_audio/audioext/v1_0:daudioext_idl_target", + "//drivers/interface/distributed_audio/audioext/v2_0:daudioext_idl_target" ], "test": [ @@ -58,6 +59,20 @@ "header_files": [], "header_base": "//drivers/interface/distributed_audio/audioext" } + }, + { + "name": "//drivers/interface/distributed_audio/audioext/v2_0:libdaudioext_proxy_2.0", + "header": { + "header_files": [], + "header_base": "//drivers/interface/distributed_audio/audioext" + } + }, + { + "name": "//drivers/interface/distributed_audio/audioext/v2_0:libdaudioext_stub_2.0", + "header": { + "header_files": [], + "header_base": "//drivers/interface/distributed_audio/audioext" + } } ] } -- Gitee From a1118c253ec7a0a9b76531cab6e0e2cbfa15308c Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 21 Mar 2024 15:32:46 +0800 Subject: [PATCH 111/210] update ops desc Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index fdf35c2d..c887d3de 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -2671,7 +2671,7 @@ struct LogSoftmax * * * Tensor after the data type conversion. * - * @since 3.2 + * @since 5.0 * @version 2.1 */ struct QuantDTypeCastV2 -- Gitee From 8ceee517b4281097c8a8fb769cc43a4aa2ba99f1 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Thu, 21 Mar 2024 15:47:15 +0800 Subject: [PATCH 112/210] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=93=E4=B8=9A?= =?UTF-8?q?=E6=A8=A1=E5=BC=8Ftag=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- camera/metadata/include/camera_device_ability_items.h | 6 +++--- camera/metadata/include/camera_metadata_item_info.h | 6 +++--- camera/metadata/src/camera_metadata_info.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 47fc04d6..b814c6b7 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -176,7 +176,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_ISO_VALUES, OHOS_CONTROL_ISO_VALUE, OHOS_STATUS_ISO_VALUE, - OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, + OHOS_ABILITY_SENSOR_EXPOSURE_TIME_RANGE, OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, OHOS_DEVICE_CONTROL_END, @@ -284,9 +284,9 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, - OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED, + OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, - OHOS_STATU_ALGO_MEAN_Y, + OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_CAMERA_EFFECT_END, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index a8f2a2e0..39b97c28 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -171,7 +171,7 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON [OHOS_ABILITY_ISO_VALUES - OHOS_DEVICE_CONTROL_START] = {"supportedIsoValues", META_TYPE_INT32, -1}, [OHOS_CONTROL_ISO_VALUE - OHOS_DEVICE_CONTROL_START] = {"isoValues", META_TYPE_INT32, 1}, [OHOS_STATUS_ISO_VALUE - OHOS_DEVICE_CONTROL_START] = {"currentIsoValues", META_TYPE_INT32, 1}, - [OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE - + [OHOS_ABILITY_SENSOR_EXPOSURE_TIME_RANGE - OHOS_DEVICE_CONTROL_START] = {"sensorExposureTimeRange", META_TYPE_RATIONAL, -1}, [OHOS_CONTROL_SENSOR_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"sensorExposureTime", META_TYPE_RATIONAL, 1}, [OHOS_STATUS_SENSOR_EXPOSURE_TIME - @@ -331,9 +331,9 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"motionDetectionSupportValue", META_TYPE_BYTE, 1}, [OHOS_CONTROL_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"motionDetectionControlValue", META_TYPE_BYTE, 1}, - [OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED - OHOS_CAMERA_EFFECT_START] = {"exposureHintSupported", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED - OHOS_CAMERA_EFFECT_START] = {"exposureHintSupported", META_TYPE_BYTE, 1}, [OHOS_CONTROL_EXPOSURE_HINT_MODE - OHOS_CAMERA_EFFECT_START] = {"exposureHintMode", META_TYPE_BYTE, 1}, - [OHOS_STATU_ALGO_MEAN_Y - OHOS_CAMERA_EFFECT_START] = {"algoMeanY", META_TYPE_UINT32, 1}, + [OHOS_STATUS_ALGO_MEAN_Y - OHOS_CAMERA_EFFECT_START] = {"algoMeanY", META_TYPE_UINT32, 1}, [OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID - OHOS_CAMERA_EFFECT_START] = {"previewPhysicalCameraId", META_TYPE_BYTE, 1}, }; diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index dda0d707..d0a00572 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -100,7 +100,7 @@ const std::vector g_metadataTags = { OHOS_ABILITY_ISO_VALUES, OHOS_CONTROL_ISO_VALUE, OHOS_STATUS_ISO_VALUE, - OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, + OHOS_ABILITY_SENSOR_EXPOSURE_TIME_RANGE, OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, @@ -185,9 +185,9 @@ const std::vector g_metadataTags = { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, - OHOS_ABILIY_EXPOSURE_HINT_SUPPORTED, + OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, - OHOS_STATU_ALGO_MEAN_Y, + OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, // camera secure related -- Gitee From 5f971bf863ba9e9652e13f66bc902be514f4ba46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 22 Mar 2024 09:43:26 +0800 Subject: [PATCH 113/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/IVibratorInterface.idl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl index f3b42f5e..64e9c0aa 100644 --- a/vibrator/v1_3/IVibratorInterface.idl +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -49,10 +49,11 @@ interface IVibratorInterface extends ohos.hdi.vibrator.v1_2.IVibratorInterface{ * * @param effectType Indicates the pointer to the preset effect type. It is recommended that the * maximum length be 64 bytes. - * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * @param intensity Indicates amplitude intensity, ranging from 1 to 100. + * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 2.2 - * @version 1.0 + * @since 5.0 + * @version 1.3 */ StartByIntensity([in] String effectType, [in] unsigned short intensity); } \ No newline at end of file -- Gitee From e8562f7b191d9dd7b5f33662068d8e734b2e9638 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Thu, 21 Mar 2024 08:09:57 +0000 Subject: [PATCH 114/210] Added maintenance logs Signed-off-by: fan-jingle --- display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h | 4 ++-- display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 8ac590e3..35e66561 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -53,12 +53,12 @@ public: { sptr hdi; std::shared_ptr req = nullptr; - + HDF_LOGI("%{public}s: hdi V1_0 start", __func__); while ((hdi = CompHdi::Get()) == nullptr) { // Waiting for display composer service ready usleep(WAIT_TIME_INTERVAL); } - + HDF_LOGI("%{public}s: hdi V1_0 end", __func__); if (needSMQ) { req = CmdReq::Create(hdi); if (req == nullptr) { diff --git a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h index 21cfd725..9fcc6977 100644 --- a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h @@ -42,12 +42,12 @@ public: { sptr hdi; std::shared_ptr req = nullptr; - + HDF_LOGI("%{public}s: hdi v1_1 start", __func__); while ((hdi = CompHdi::Get()) == nullptr) { // Waiting for display composer service ready usleep(WAIT_TIME_INTERVAL); } - + HDF_LOGI("%{public}s: hdi v1_1 end", __func__); if (needSMQ) { req = CmdReq::Create(hdi); if (req == nullptr) { -- Gitee From 2fd7d56705d4fcd45c06cdc1d4dfa03121f2cda8 Mon Sep 17 00:00:00 2001 From: maoyong Date: Fri, 22 Mar 2024 15:14:42 +0800 Subject: [PATCH 115/210] update ops desc Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index c887d3de..06dd8e25 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -2662,6 +2662,8 @@ struct LogSoftmax * @brief Converts the data type. * * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST_V2. + * The v1 version {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST, + * and the corresponding NodeAttrType is {@link QuantDTypeCast}. * * Input: * -- Gitee From 963fb23e2f5a3995b07016ec6dd0b9d4dbd4f7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 22 Mar 2024 15:25:23 +0800 Subject: [PATCH 116/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/BUILD.gn | 2 +- vibrator/v1_3/IVibratorInterface.idl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vibrator/v1_3/BUILD.gn b/vibrator/v1_3/BUILD.gn index f246aa71..1a2d06c8 100644 --- a/vibrator/v1_3/BUILD.gn +++ b/vibrator/v1_3/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 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 diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl index 64e9c0aa..1b990678 100644 --- a/vibrator/v1_3/IVibratorInterface.idl +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From 596616ab6df4e427b20e43752dd5731609d0a9fb Mon Sep 17 00:00:00 2001 From: qiu-qiu-wang Date: Fri, 22 Mar 2024 15:25:53 +0800 Subject: [PATCH 117/210] add getting DRM name and uuid function Signed-off-by: qiu-qiu-wang --- drm/v1_0/IMediaKeySystemFactory.idl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drm/v1_0/IMediaKeySystemFactory.idl b/drm/v1_0/IMediaKeySystemFactory.idl index 6e7fd474..20cbe3d9 100644 --- a/drm/v1_0/IMediaKeySystemFactory.idl +++ b/drm/v1_0/IMediaKeySystemFactory.idl @@ -38,4 +38,13 @@ import ohos.hdi.drm.v1_0.IMediaKeySystem; interface IMediaKeySystemFactory { IsMediaKeySystemSupported([in] String name, [in] String mimeType, [in] enum ContentProtectionLevel level, [out] boolean isSupported); CreateMediaKeySystem([out] IMediaKeySystem mediaKeySystem); + /** + * @brief Get DRM name and uuid supported by DRM plugin. + * @param name DRM name. + * @param uuid DRM uuid. + * + * @since 5.0 + * @version 1.0 + */ + GetMediaKeySystemName([out] String name, [out] String uuid); }; -- Gitee From e26da6385791ac268632cabc2e417608e5c59b9b Mon Sep 17 00:00:00 2001 From: "zhuyan (F)" Date: Fri, 22 Mar 2024 15:13:06 +0800 Subject: [PATCH 118/210] feat:add safe location hdi file Signed-off-by: zhuyan (F) --- location/lpfence/bundle.json | 27 ++++- location/lpfence/safe_location/v1_0/BUILD.gn | 28 +++++ .../v1_0/ISafeLocationCallback.idl | 72 ++++++++++++ .../v1_0/ISafeLocationInterface.idl | 104 ++++++++++++++++++ .../safe_location/v1_0/SafeLocationTypes.idl | 51 +++++++++ 5 files changed, 281 insertions(+), 1 deletion(-) create mode 100644 location/lpfence/safe_location/v1_0/BUILD.gn create mode 100644 location/lpfence/safe_location/v1_0/ISafeLocationCallback.idl create mode 100644 location/lpfence/safe_location/v1_0/ISafeLocationInterface.idl create mode 100644 location/lpfence/safe_location/v1_0/SafeLocationTypes.idl diff --git a/location/lpfence/bundle.json b/location/lpfence/bundle.json index 4b823656..14e52709 100644 --- a/location/lpfence/bundle.json +++ b/location/lpfence/bundle.json @@ -30,7 +30,8 @@ "//drivers/interface/location/lpfence/cellbatching/v1_0:lpfence_cellbatching_idl_target", "//drivers/interface/location/lpfence/cellfence/v1_0:lpfence_cellfence_idl_target", "//drivers/interface/location/lpfence/geofence/v1_0:lpfence_geofence_idl_target", - "//drivers/interface/location/lpfence/wififence/v1_0:lpfence_wififence_idl_target" + "//drivers/interface/location/lpfence/wififence/v1_0:lpfence_wififence_idl_target", + "//drivers/interface/location/lpfence/safe_location/v1_0:lpfence_safe_location_idl_target" ], "test": [ ], @@ -130,6 +131,30 @@ ], "header_base": "//drivers/interface/location/lpfence/wififence" } + }, + { + "name": "//drivers/interface/location/lpfence/safe_location/v1_0:liblpfence_safe_location_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/lpfence/safe_location" + } + }, + { + "name": "//drivers/interface/location/lpfence/safe_location/v1_0:liblpfence_safe_location_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/lpfence/safe_location" + } + }, + { + "name": "//drivers/interface/location/lpfence/safe_location/v1_0:lpfence_safe_location_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/lpfence/safe_location" + } } ] } diff --git a/location/lpfence/safe_location/v1_0/BUILD.gn b/location/lpfence/safe_location/v1_0/BUILD.gn new file mode 100644 index 00000000..e38dbe2d --- /dev/null +++ b/location/lpfence/safe_location/v1_0/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("lpfence_safe_location") { + module_name = "lpfence_safe_location" + + sources = [ + "ISafeLocationCallback.idl", + "ISafeLocationInterface.idl", + "SafeLocationTypes.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_lpfence" +} diff --git a/location/lpfence/safe_location/v1_0/ISafeLocationCallback.idl b/location/lpfence/safe_location/v1_0/ISafeLocationCallback.idl new file mode 100644 index 00000000..2ab43e46 --- /dev/null +++ b/location/lpfence/safe_location/v1_0/ISafeLocationCallback.idl @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 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 HdiLpfenceSafeLocation + * @{ + * + * @brief Provides safe location APIs for the safe location service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file ISafeLocationCallback.idl + * + * @brief Declares the callbacks for the safe location module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the safe location module interface package. + * + * @since 5.0 + */ +package ohos.hdi.location.lpfence.safe_location.v1_0; + +/** + * @brief Imports data types of the safe location module. + * + * @since 5.0 + */ +import ohos.hdi.location.lpfence.safe_location.v1_0.SafeLocationTypes; + +/** + * @brief Defines the callback for the safe location module. + * + * Before enabling the safe location feature, you need to register this callback to report the device has obtained the safe location information. + * For details, see {@link ISafeLocationInterface}. + * + * @since 5.0 + */ +[callback] interface ISafeLocationCallback { + /** + * @brief Called to report the safe location request result. + * + * + * + * @param ret Indicates the result of getting safe location. + * + * @return Returns 0 if the callback is invoked successfully. + * @return Returns a negative value if the callback fails to be invoked. + * + @since 5.0 + */ + OnGetSafeLocationCb([in] int res); +} +/** @} */ diff --git a/location/lpfence/safe_location/v1_0/ISafeLocationInterface.idl b/location/lpfence/safe_location/v1_0/ISafeLocationInterface.idl new file mode 100644 index 00000000..33b73f4e --- /dev/null +++ b/location/lpfence/safe_location/v1_0/ISafeLocationInterface.idl @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 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 HdiLpfenceSafeLocation + * @{ + * + * @brief Provides safe location APIs for the safe location service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file ISafeLocationInterface.idl + * + * @brief Declares the callbacks for the safe location module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the safe location module interface package. + * + * @since 5.0 + */ +package ohos.hdi.location.lpfence.safe_location.v1_0; + +/** + * @brief Imports data types of the safe location module. + * + * @since 5.0 + */ +import ohos.hdi.location.lpfence.safe_location.v1_0.SafeLocationTypes; + +/** + * @brief Imports callbacks of the safe location module. + * + * @since 5.0 + */ +import ohos.hdi.location.lpfence.safe_location.v1_0.ISafeLocationCallback; + +/** + * @brief Provides APIs for basic safe location operations. + * + * You can use the APIs to register or unregister a callback + */ +interface ISafeLocationInterface { + /** + * @brief Registers a callback. + * + * Before enabling the safe location feature, you need to register a callback to report the device has obtained the safe location information. + * + * @param callbackObj Indicates the callback to register, which needs to be registered only once. For details, see {@link ISafeLocCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RegisterSafeLocationCallback([in] ISafeLocationCallback callbackObj); + + /** + * @brief Unregisters a callback. + * + * When the safe location feature is no longer required or the registered callback needs to be changed, you need to unregister the callback. + * + * @param callbackObj Indicates the callback to unregister, which needs to be unregistered only once. For details, see {@link ISafeLocationCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + UnregisterSafeLocationCallback([in] ISafeLocationCallback callbackObj); + + /** + * @brief Obtains the latest safe location information. + * + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetSafeLocationSwitch([in] int mode); +} +/** @} */ diff --git a/location/lpfence/safe_location/v1_0/SafeLocationTypes.idl b/location/lpfence/safe_location/v1_0/SafeLocationTypes.idl new file mode 100644 index 00000000..f6787701 --- /dev/null +++ b/location/lpfence/safe_location/v1_0/SafeLocationTypes.idl @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 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 HdiLpfenceSafeLocation + * @{ + * + * @brief Provides safe location APIs for the safe location service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file SafeLocationTypes.idl + * + * @brief Defines the data types used by the safe location feature. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the safe location module interface package. + * + * @since 5.0 + */ +package ohos.hdi.location.lpfence.safe_location.v1_0; + +/** + * @brief Enumerates the safe location mode. + * + * @since 5.0 + */ +enum SafeLocationMode { + CLOSE_SAFE_LOCATION = 0, + OPEN_SAFE_LOCATION = 1, +}; +/** @} */ -- Gitee From 6d5a5d8d050067a8753b6b03c4f210757ff6b779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Fri, 22 Mar 2024 17:32:53 +0800 Subject: [PATCH 119/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vibrator/v1_3/BUILD.gn b/vibrator/v1_3/BUILD.gn index 1a2d06c8..34027d56 100644 --- a/vibrator/v1_3/BUILD.gn +++ b/vibrator/v1_3/BUILD.gn @@ -23,9 +23,7 @@ if (defined(ohos_lite)) { module_name = "vibrator_service" imports = [ "ohos.hdi.vibrator.v1_2:vibrator" ] - sources = [ - "IVibratorInterface.idl", - ] + sources = [ "IVibratorInterface.idl" ] language = "cpp" subsystem_name = "hdf" -- Gitee From fb3fd58519d5f357f794a85f3e1a3473ccd84d8e Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Sat, 23 Mar 2024 11:43:28 +0800 Subject: [PATCH 120/210] commit msg Signed-off-by: xuxuehai --- audio/v3_0/AudioTypes.idl | 111 +++++++++++++++++++++++++++++++ audio/v3_0/IAudioAdapter.idl | 51 +++++++++++++++ audio/v3_0/IAudioCallback.idl | 9 +++ audio/v3_0/IAudioCapture.idl | 93 ++++++++++++++++++++++++++ audio/v3_0/IAudioManager.idl | 12 ++++ audio/v3_0/IAudioRender.idl | 120 ++++++++++++++++++++++++++++++++++ 6 files changed, 396 insertions(+) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index b1566661..0c00a8c9 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -32,6 +32,9 @@ package ohos.hdi.audio.v3_0; /** * @brief Enumerates the audio port type. + * + * @since 5.0 + * @version 3.0 */ enum AudioPortDirection { PORT_OUT = 1, /**< Output port */ @@ -41,6 +44,9 @@ enum AudioPortDirection { /** * @brief Enumerates the pin of an audio adapter. + * + * @since 5.0 + * @version 3.0 */ enum AudioPortPin { PIN_NONE = 0, /**< Invalid pin */ @@ -68,6 +74,9 @@ enum AudioPortPin { /** * @brief Enumerates the audio category. + * + * @since 5.0 + * @version 3.0 */ enum AudioCategory { AUDIO_IN_MEDIA = 0, /**< Media */ @@ -82,6 +91,9 @@ enum AudioCategory { /** * @brief Enumerates the audio format. + * + * @since 5.0 + * @version 3.0 */ enum AudioFormat { AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8-bit PCM */ @@ -105,6 +117,9 @@ enum AudioFormat { * @brief Enumerates the audio channel mask. * * A mask describes an audio channel position. + * + * @since 5.0 + * @version 3.0 */ enum AudioChannelMask { AUDIO_CHANNEL_FRONT_LEFT = 1, /**< Front left channel */ @@ -115,6 +130,9 @@ enum AudioChannelMask { /** * @brief Enumerates masks of audio sampling rates. + * + * @since 5.0 + * @version 3.0 */ enum AudioSampleRatesMask { AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8 kHz */ @@ -133,6 +151,9 @@ enum AudioSampleRatesMask { /** * @brief Enumerates the passthrough data transmission mode of an audio port. + * + * @since 5.0 + * @version 3.0 */ enum AudioPortPassthroughMode { PORT_PASSTHROUGH_LPCM = 1 << 0, /**< Stereo PCM */ @@ -143,6 +164,9 @@ enum AudioPortPassthroughMode { /** * @brief Defines formats of raw audio samples. + * + * @since 5.0 + * @version 3.0 */ enum AudioSampleFormat { /* 8 bits */ @@ -181,6 +205,9 @@ enum AudioSampleFormat { * @brief Enumerates channel modes for audio rendering. * * @attention The following modes are set for rendering dual-channel audios. Others are not supported. + * + * @since 5.0 + * @version 3.0 */ enum AudioChannelMode { AUDIO_CHANNEL_NORMAL = 0, /**< Normal mode. No processing is required. */ @@ -197,6 +224,9 @@ enum AudioChannelMode { /** * @brief Enumerates the execution types of the DrainBuffer function. + * + * @since 5.0 + * @version 3.0 */ enum AudioDrainNotifyType { AUDIO_DRAIN_NORMAL_MODE = 0, /**< The DrainBuffer function returns after all data finishes playback. */ @@ -208,6 +238,9 @@ enum AudioDrainNotifyType { /** * @brief Enumerates callback notification events. + * + * @since 5.0 + * @version 3.0 */ enum AudioCallbackType { AUDIO_NONBLOCK_WRITE_COMPLETED = 0, /**< The non-block write is complete. */ @@ -219,6 +252,9 @@ enum AudioCallbackType { /** * @brief Describes AudioPortRole. + * + * @since 5.0 + * @version 3.0 */ enum AudioPortRole { AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< Unassigned port role */ @@ -228,6 +264,9 @@ enum AudioPortRole { /** * @brief Describes AudioPortType. + * + * @since 5.0 + * @version 3.0 */ enum AudioPortType { AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< Unassigned port type */ @@ -238,6 +277,9 @@ enum AudioPortType { /** * @brief Describes AudioSessionType. + * + * @since 5.0 + * @version 3.0 */ enum AudioSessionType { AUDIO_OUTPUT_STAGE_SESSION = 0, /**< Assigned output stage session */ @@ -248,6 +290,9 @@ enum AudioSessionType { /** * @brief Describes AudioDeviceType. + * + * @since 5.0 + * @version 3.0 */ enum AudioDeviceType { AUDIO_LINEOUT = 1 << 0, /**< Assigned lineout device type */ @@ -268,6 +313,9 @@ enum AudioDeviceType { /** * @brief Describes AudioEventType. + * + * @since 5.0 + * @version 3.0 */ enum AudioEventType { AUDIO_DEVICE_ADD = 1, /**< Assigned add device event type */ @@ -283,6 +331,9 @@ enum AudioEventType { /** * @brief Enumerates the restricted key type of the parameters + * + * @since 5.0 + * @version 3.0 */ enum AudioExtParamKey { AUDIO_EXT_PARAM_KEY_NONE = 0, /**< Distributed audio extra param key none */ @@ -299,6 +350,9 @@ enum AudioExtParamKey { /** * @brief Describes status of audio deivce.@link enum AudioDeviceType + * + * @since 5.0 + * @version 3.0 */ struct AudioDeviceStatus { unsigned int pnpStatus; /**< Audio pnp status */ @@ -306,6 +360,9 @@ struct AudioDeviceStatus { /** * @brief Describes the audio scene. + * + * @since 5.0 + * @version 3.0 */ union SceneDesc { unsigned int id; /**< Audio scene ID */ @@ -313,6 +370,9 @@ union SceneDesc { /** * @brief Defines the audio port. + * + * @since 5.0 + * @version 3.0 */ struct AudioPort { enum AudioPortDirection dir; /**< Audio port type. For details, see {@link AudioPortDirection} */ @@ -326,6 +386,9 @@ struct AudioPort { * An audio adapter is a set of port drivers for a sound card, including the output and input ports. * One port corresponds to multiple pins, and each pin belongs to a physical component (such as a * speaker or a wired headset). + * + * @since 5.0 + * @version 3.0 */ struct AudioAdapterDescriptor { String adapterName; /**< Name of the audio adapter */ @@ -334,6 +397,9 @@ struct AudioAdapterDescriptor { /** * @brief Defines the audio device descriptor. + * + * @since 5.0 + * @version 3.0 */ struct AudioDeviceDescriptor { unsigned int portId; /**< Audio port ID */ @@ -343,6 +409,9 @@ struct AudioDeviceDescriptor { /** * @brief Defines the audio scene descriptor. + * + * @since 5.0 + * @version 3.0 */ struct AudioSceneDescriptor { union SceneDesc scene; /**< Describes the audio scene */ @@ -351,6 +420,9 @@ struct AudioSceneDescriptor { /** * @brief Defines audio input type. + * + * @since 5.0 + * @version 3.0 */ enum AudioInputType { AUDIO_INPUT_DEFAULT_TYPE = 0, /**< Assigned default input type */ @@ -366,6 +438,9 @@ enum AudioInputType { /** * @brief Defines audio offload attributes. + * + * @since 5.0 + * @version 3.0 */ struct AudioOffloadInfo { @@ -381,6 +456,9 @@ struct AudioOffloadInfo /** * @brief Defines audio sampling attributes. + * + * @since 5.0 + * @version 3.0 */ struct AudioSampleAttributes { enum AudioCategory type; /**< Audio type. For details, see {@link AudioCategory} */ @@ -405,6 +483,9 @@ struct AudioSampleAttributes { /** * @brief Defines the audio timestamp, which is a substitute for POSIX timespec. + * + * @since 5.0 + * @version 3.0 */ struct AudioTimeStamp { long tvSec; /**< Seconds */ @@ -413,6 +494,9 @@ struct AudioTimeStamp { /** * @brief Defines the sub-port capability. + * + * @since 5.0 + * @version 3.0 */ struct AudioSubPortCapability { unsigned int portId; /**< Sub-port ID */ @@ -424,6 +508,9 @@ struct AudioSubPortCapability { /** * @brief Defines the audio port capability. + * + * @since 5.0 + * @version 3.0 */ struct AudioPortCapability { unsigned int deviceType; /**< Device type (output or input) */ @@ -444,6 +531,9 @@ struct AudioPortCapability { /** * @brief Describes a mmap buffer. + * + * @since 5.0 + * @version 3.0 */ struct AudioMmapBufferDescriptor { byte[] memoryAddress; /**< Pointer to the mmap buffer */ @@ -457,6 +547,9 @@ struct AudioMmapBufferDescriptor { /** * @brief Describes AudioDevExtInfo. + * + * @since 5.0 + * @version 3.0 */ struct AudioDevExtInfo { int moduleId; /**< Identifier of the module stream is attached to */ @@ -466,6 +559,9 @@ struct AudioDevExtInfo { /** * @brief Describes AudioMixInfo. + * + * @since 5.0 + * @version 3.0 */ struct AudioMixExtInfo { int moduleId; /**< Identifier of the module stream is attached to */ @@ -474,6 +570,9 @@ struct AudioMixExtInfo { /** * @brief Describes AudioSessionExtInfo. + * + * @since 5.0 + * @version 3.0 */ struct AudioSessionExtInfo { enum AudioSessionType sessionType; /**< Audio session type */ @@ -481,6 +580,9 @@ struct AudioSessionExtInfo { /** * @brief Describes AudioInfo. + * + * @since 5.0 + * @version 3.0 */ struct AudioInfo { struct AudioDevExtInfo device; /* Specific Device Ext info */ @@ -490,6 +592,9 @@ struct AudioInfo { /** * @brief Describes AudioRouteNode. + * + * @since 5.0 + * @version 3.0 */ struct AudioRouteNode { int portId; /**< Audio port ID */ @@ -500,6 +605,9 @@ struct AudioRouteNode { /** * @brief Describes AudioRoute. + * + * @since 5.0 + * @version 3.0 */ struct AudioRoute { struct AudioRouteNode[] sources; /**< List of sources */ @@ -508,6 +616,9 @@ struct AudioRoute { /** * @brief Describes AudioEvent. + * + * @since 5.0 + * @version 3.0 */ struct AudioEvent { unsigned int eventType; /**< @link enum AudioEventType */ diff --git a/audio/v3_0/IAudioAdapter.idl b/audio/v3_0/IAudioAdapter.idl index e53a82da..7f1a47f0 100644 --- a/audio/v3_0/IAudioAdapter.idl +++ b/audio/v3_0/IAudioAdapter.idl @@ -54,6 +54,9 @@ interface IAudioAdapter { * * @param adapter Indicates the pointer to the audio adapter to operate. * @return Returns 0 if the initialization is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ InitAllPorts(); @@ -68,6 +71,9 @@ interface IAudioAdapter { * returns a negative value otherwise. * @see GetPortCapability * @see DestroyRender + * + * @since 5.0 + * @version 3.0 */ CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioRender render, [out] unsigned int renderId); @@ -81,6 +87,9 @@ interface IAudioAdapter { * @param render Indicates the pointer to the IAudioRender object to operate. * @return Returns 0 if the IAudioRender object is destroyed; returns a negative value otherwise. * @see CreateRender + * + * @since 5.0 + * @version 3.0 */ DestroyRender([in] unsigned int renderId); @@ -95,6 +104,9 @@ interface IAudioAdapter { * returns a negative value otherwise. * @see GetPortCapability * @see DestroyCapture + * + * @since 5.0 + * @version 3.0 */ CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioCapture capture, [out] unsigned int captureId); @@ -108,6 +120,9 @@ interface IAudioAdapter { * @param capture Indicates the pointer to the IAudioCapture object to operate. * @return Returns 0 if the IAudioCapture object is destroyed; returns a negative value otherwise. * @see CreateCapture + * + * @since 5.0 + * @version 3.0 */ DestroyCapture([in] unsigned int captureId); @@ -118,6 +133,9 @@ interface IAudioAdapter { * @param port Indicates the pointer to the port. * @param capability Indicates the pointer to the capability set to obtain. * @return Returns 0 if the capability set is successfully obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); @@ -129,6 +147,9 @@ interface IAudioAdapter { * @param mode Indicates the passthrough transmission mode to set. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetPassthroughMode + * + * @since 5.0 + * @version 3.0 */ SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); @@ -140,6 +161,9 @@ interface IAudioAdapter { * @param mode Indicates the pointer to the passthrough transmission mode to obtain. * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode + * + * @since 5.0 + * @version 3.0 */ GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); @@ -149,6 +173,9 @@ interface IAudioAdapter { * @param adapter Indicates the audio adapter. * @param status Indicates the status of device . * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetDeviceStatus([out] struct AudioDeviceStatus status); @@ -160,6 +187,9 @@ interface IAudioAdapter { * @param routeHandle Indicates route handle. * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode + * + * @since 5.0 + * @version 3.0 */ UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); @@ -170,6 +200,9 @@ interface IAudioAdapter { * @param routeHandle Indicates route handle. * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode + * + * @since 5.0 + * @version 3.0 */ ReleaseAudioRoute([in] int routeHandle); @@ -181,6 +214,9 @@ interface IAudioAdapter { * and false means the opposite. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute + * + * @since 5.0 + * @version 3.0 */ SetMicMute([in] boolean mute); @@ -192,6 +228,9 @@ interface IAudioAdapter { * the audio is muted, and false means the opposite. * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute + * + * @since 5.0 + * @version 3.0 */ GetMicMute([out] boolean mute); @@ -205,6 +244,9 @@ interface IAudioAdapter { * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume + * + * @since 5.0 + * @version 3.0 */ SetVoiceVolume([in] float volume); @@ -224,6 +266,9 @@ interface IAudioAdapter { * AUDIO_VOLUME_TYPE indicates which volume type will be set; * * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); @@ -244,6 +289,9 @@ interface IAudioAdapter { * AUDIO_VOLUME_TYPE indicates which volume type want get; * * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); @@ -254,6 +302,9 @@ interface IAudioAdapter { * @param callback Indicates param observer. * @param cookie Indicates the pointer to the callback parameters; * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); } diff --git a/audio/v3_0/IAudioCallback.idl b/audio/v3_0/IAudioCallback.idl index 207685da..1d655073 100644 --- a/audio/v3_0/IAudioCallback.idl +++ b/audio/v3_0/IAudioCallback.idl @@ -40,6 +40,9 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @param cookie Indicates the pointer to the cookie for data transmission. * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. * @see RegCallback + * + * @since 5.0 + * @version 3.0 */ [callback] interface IAudioCallback { /** @@ -50,6 +53,9 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @param cookie Indicates the pointer to the cookie for data transmission. * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. * @see RegCallback + * + * @since 5.0 + * @version 3.0 */ RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); @@ -62,6 +68,9 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @param reserved Indicates reserved param. * @param cookie Indicates the pointer to the callback parameters; * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); } diff --git a/audio/v3_0/IAudioCapture.idl b/audio/v3_0/IAudioCapture.idl index 392108ff..d9589c3f 100644 --- a/audio/v3_0/IAudioCapture.idl +++ b/audio/v3_0/IAudioCapture.idl @@ -48,6 +48,9 @@ interface IAudioCapture { * @param requestBytes Indicates the size of the input data, in bytes. * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to read. * @return Returns 0 if the input data is read successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); @@ -59,6 +62,9 @@ interface IAudioCapture { * @param time Indicates the pointer to the timestamp associated with the frame. * @return Returns 0 if the last number is obtained; returns a negative value otherwise. * @see CaptureFrame + * + * @since 5.0 + * @version 3.0 */ GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -71,6 +77,9 @@ interface IAudioCapture { * Value true means that the configuration is supported, and false means the opposite. * @return Returns 0 if the result is obtained; returns a negative value otherwise. * @see SelectScene + * + * @since 5.0 + * @version 3.0 */ CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); @@ -94,6 +103,9 @@ interface IAudioCapture { * @param scene Indicates the pointer to the descriptor of the audio scene to select. * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. * @see CheckSceneCapability + * + * @since 5.0 + * @version 3.0 */ SelectScene([in] struct AudioSceneDescriptor scene); @@ -105,6 +117,9 @@ interface IAudioCapture { * and false means the opposite. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute + * + * @since 5.0 + * @version 3.0 */ SetMute([in] boolean mute); @@ -116,6 +131,9 @@ interface IAudioCapture { * the audio is muted, and false means the opposite. * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute + * + * @since 5.0 + * @version 3.0 */ GetMute([out] boolean mute); @@ -129,6 +147,9 @@ interface IAudioCapture { * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume + * + * @since 5.0 + * @version 3.0 */ SetVolume([in] float volume); @@ -139,6 +160,9 @@ interface IAudioCapture { * @param volume Indicates the pointer to the volume to obtain. The value ranges from 0.0 to 1.0. * @return Returns 0 if the volume is obtained; returns a negative value otherwise. * @see SetVolume + * + * @since 5.0 + * @version 3.0 */ GetVolume([out] float volume); @@ -158,6 +182,9 @@ interface IAudioCapture { * @return Returns 0 if the range is obtained; returns a negative value otherwise. * @see GetGain * @see SetGain + * + * @since 5.0 + * @version 3.0 */ GetGainThreshold([out] float min, [out] float max); @@ -169,6 +196,9 @@ interface IAudioCapture { * @return Returns 0 if the audio gain is obtained; returns a negative value otherwise. * @see GetGainThreshold * @see SetGain + * + * @since 5.0 + * @version 3.0 */ GetGain([out] float gain); @@ -180,6 +210,9 @@ interface IAudioCapture { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetGainThreshold * @see GetGain + * + * @since 5.0 + * @version 3.0 */ SetGain([in] float gain); @@ -189,6 +222,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param size Indicates the pointer to the audio frame size (in bytes). * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameSize([out] unsigned long size); @@ -198,6 +234,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param count Indicates the pointer to the number of audio frames in the audio buffer. * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameCount([out] unsigned long count); @@ -209,6 +248,9 @@ interface IAudioCapture { * sampling precision, and channel. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetSampleAttributes + * + * @since 5.0 + * @version 3.0 */ SetSampleAttributes([in] struct AudioSampleAttributes attrs); @@ -220,6 +262,9 @@ interface IAudioCapture { * sampling precision, and channel. * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. * @see SetSampleAttributes + * + * @since 5.0 + * @version 3.0 */ GetSampleAttributes([out] struct AudioSampleAttributes attrs); @@ -229,6 +274,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param channelId Indicates the pointer to the data channel ID. * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetCurrentChannelId([out] unsigned int channelId); @@ -239,6 +287,9 @@ interface IAudioCapture { * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ SetExtraParams([in] String keyValueList); @@ -249,6 +300,9 @@ interface IAudioCapture { * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetExtraParams([out] String keyValueList); @@ -259,6 +313,9 @@ interface IAudioCapture { * @param reqSize Indicates the size of the request mmap buffer. * @param desc Indicates the pointer to the mmap buffer descriptor. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); @@ -269,6 +326,9 @@ interface IAudioCapture { * @param frames Indicates the pointer to the frame where the read/write starts. * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -278,6 +338,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param effectid Indicates the audio effect instance identifier which is going to be added. * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ AddAudioEffect([in] unsigned long effectid); @@ -287,6 +350,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param effectid Indicates the audio effect which is going to be removed. * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ RemoveAudioEffect([in] unsigned long effectid); @@ -296,6 +362,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameBufferSize([out] unsigned long bufferSize); @@ -306,6 +375,9 @@ interface IAudioCapture { * @return Returns 0 if the rendering or capturing is successfully started; * returns a negative value otherwise. * @see Stop + * + * @since 5.0 + * @version 3.0 */ Start(); @@ -316,6 +388,9 @@ interface IAudioCapture { * @return Returns 0 if the rendering or capturing is successfully stopped; * returns a negative value otherwise. * @see Start + * + * @since 5.0 + * @version 3.0 */ Stop(); @@ -326,6 +401,9 @@ interface IAudioCapture { * @return Returns 0 if the rendering or capturing is successfully paused; * returns a negative value otherwise. * @see Resume + * + * @since 5.0 + * @version 3.0 */ Pause(); @@ -336,6 +414,9 @@ interface IAudioCapture { * @return Returns 0 if the rendering or capturing is successfully resumed; * returns a negative value otherwise. * @see Pause + * + * @since 5.0 + * @version 3.0 */ Resume(); @@ -344,6 +425,9 @@ interface IAudioCapture { * * @param handle Indicates the audio handle. * @return Returns 0 if the flush is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ Flush(); @@ -353,6 +437,9 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is * canceled; returns a negative value if the setting fails. + * + * @since 5.0 + * @version 3.0 */ TurnStandbyMode(); @@ -363,6 +450,9 @@ interface IAudioCapture { * @param range Indicates the range of the device information to dump, which can be brief or full information. * @param fd Indicates the file to which the device information will be dumped. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ AudioDevDump([in] int range, [in] int fd); @@ -376,6 +466,9 @@ interface IAudioCapture { * the vendor supports, and false means the opposite. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsPauseAndResume + * + * @since 5.0 + * @version 3.0 */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); } diff --git a/audio/v3_0/IAudioManager.idl b/audio/v3_0/IAudioManager.idl index 4bb8648c..348fe84f 100644 --- a/audio/v3_0/IAudioManager.idl +++ b/audio/v3_0/IAudioManager.idl @@ -50,6 +50,9 @@ interface IAudioManager { * @param size Indicates the pointer to the length of the list. * @return Returns 0 if the list is obtained successfully; returns a negative value otherwise. * @see LoadAdapter + * + * @since 5.0 + * @version 3.0 */ GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); @@ -64,6 +67,9 @@ interface IAudioManager { * @return Returns 0 if the driver is loaded successfully; returns a negative value otherwise. * @see GetAllAdapters * @see UnloadAdapter + * + * @since 5.0 + * @version 3.0 */ LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); @@ -73,6 +79,9 @@ interface IAudioManager { * @param manager Indicates the pointer to the audio adapter manager to operate. * @param adapter Indicates the pointer to the audio adapter whose driver will be unloaded. * @see LoadAdapter + * + * @since 5.0 + * @version 3.0 */ UnloadAdapter([in] String adapterName); @@ -81,6 +90,9 @@ interface IAudioManager { * * @param object Indicates the pointer to the audio adapter manager to operate. * @return Returns true if the Object is released; returns false otherwise. + * + * @since 5.0 + * @version 3.0 */ ReleaseAudioManagerObject(); } diff --git a/audio/v3_0/IAudioRender.idl b/audio/v3_0/IAudioRender.idl index 767f8764..fb977a19 100644 --- a/audio/v3_0/IAudioRender.idl +++ b/audio/v3_0/IAudioRender.idl @@ -47,6 +47,9 @@ interface IAudioRender { * @param render Indicates the pointer to the IAudioRender object to operate. * @param ms Indicates the pointer to the latency (in milliseconds) to be obtained. * @return Returns 0 if the latency is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetLatency([out] unsigned int ms); @@ -58,6 +61,9 @@ interface IAudioRender { * @param requestBytes Indicates the size of the frame, in bytes. * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to write. * @return Returns 0 if the data is written successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); @@ -69,6 +75,9 @@ interface IAudioRender { * @param time Indicates the pointer to the timestamp associated with the frame. * @return Returns 0 if the last number is obtained; returns a negative value otherwise. * @see RenderFrame + * + * @since 5.0 + * @version 3.0 */ GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -79,6 +88,9 @@ interface IAudioRender { * @param speed Indicates the rendering speed to set. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetRenderSpeed + * + * @since 5.0 + * @version 3.0 */ SetRenderSpeed([in] float speed); @@ -89,6 +101,9 @@ interface IAudioRender { * @param speed Indicates the pointer to the current rendering speed to obtain. * @return Returns 0 if the speed is successfully obtained; returns a negative value otherwise. * @see SetRenderSpeed + * + * @since 5.0 + * @version 3.0 */ GetRenderSpeed([out] float speed); @@ -99,6 +114,9 @@ interface IAudioRender { * @param mode Indicates the channel mode to set. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetChannelMode + * + * @since 5.0 + * @version 3.0 */ SetChannelMode([in] enum AudioChannelMode mode); @@ -109,6 +127,9 @@ interface IAudioRender { * @param mode Indicates the pointer to the channel mode to obtain. * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetChannelMode + * + * @since 5.0 + * @version 3.0 */ GetChannelMode([out] enum AudioChannelMode mode); @@ -121,6 +142,9 @@ interface IAudioRender { * @param cookie Indicates the pointer to the callback parameters. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see RegCallback + * + * @since 5.0 + * @version 3.0 */ RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); @@ -132,6 +156,9 @@ interface IAudioRender { * see {@link AudioDrainNotifyType}. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see RegCallback + * + * @since 5.0 + * @version 3.0 */ DrainBuffer([out] enum AudioDrainNotifyType type); @@ -143,6 +170,9 @@ interface IAudioRender { * the vendor supports, and false means the opposite. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsDrain + * + * @since 5.0 + * @version 3.0 */ IsSupportsDrain([out] boolean support); @@ -155,6 +185,9 @@ interface IAudioRender { * Value true means that the configuration is supported, and false means the opposite. * @return Returns 0 if the result is obtained; returns a negative value otherwise. * @see SelectScene + * + * @since 5.0 + * @version 3.0 */ CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); @@ -178,6 +211,9 @@ interface IAudioRender { * @param scene Indicates the pointer to the descriptor of the audio scene to select. * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. * @see CheckSceneCapability + * + * @since 5.0 + * @version 3.0 */ SelectScene([in] struct AudioSceneDescriptor scene); @@ -189,6 +225,9 @@ interface IAudioRender { * and false means the opposite. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute + * + * @since 5.0 + * @version 3.0 */ SetMute([in] boolean mute); @@ -200,6 +239,9 @@ interface IAudioRender { * the audio is muted, and false means the opposite. * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute + * + * @since 5.0 + * @version 3.0 */ GetMute([out] boolean mute); @@ -213,6 +255,9 @@ interface IAudioRender { * @param volume Indicates the volume to set. The value ranges from 0.0 to 1.0. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume + * + * @since 5.0 + * @version 3.0 */ SetVolume([in] float volume); @@ -223,6 +268,9 @@ interface IAudioRender { * @param volume Indicates the pointer to the volume to obtain. The value ranges from 0.0 to 1.0. * @return Returns 0 if the volume is obtained; returns a negative value otherwise. * @see SetVolume + * + * @since 5.0 + * @version 3.0 */ GetVolume([out] float volume); @@ -242,6 +290,9 @@ interface IAudioRender { * @return Returns 0 if the range is obtained; returns a negative value otherwise. * @see GetGain * @see SetGain + * + * @since 5.0 + * @version 3.0 */ GetGainThreshold([out] float min, [out] float max); @@ -253,6 +304,9 @@ interface IAudioRender { * @return Returns 0 if the audio gain is obtained; returns a negative value otherwise. * @see GetGainThreshold * @see SetGain + * + * @since 5.0 + * @version 3.0 */ GetGain([out] float gain); @@ -264,6 +318,9 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetGainThreshold * @see GetGain + * + * @since 5.0 + * @version 3.0 */ SetGain([in] float gain); @@ -273,6 +330,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param size Indicates the pointer to the audio frame size (in bytes). * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameSize([out] unsigned long size); @@ -282,6 +342,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param count Indicates the pointer to the number of audio frames in the audio buffer. * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameCount([out] unsigned long count); @@ -293,6 +356,9 @@ interface IAudioRender { * sampling precision, and channel. * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetSampleAttributes + * + * @since 5.0 + * @version 3.0 */ SetSampleAttributes([in] struct AudioSampleAttributes attrs); @@ -304,6 +370,9 @@ interface IAudioRender { * sampling precision, and channel. * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. * @see SetSampleAttributes + * + * @since 5.0 + * @version 3.0 */ GetSampleAttributes([out] struct AudioSampleAttributes attrs); @@ -313,6 +382,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param channelId Indicates the pointer to the data channel ID. * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetCurrentChannelId([out] unsigned int channelId); @@ -323,6 +395,9 @@ interface IAudioRender { * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ SetExtraParams([in] String keyValueList); @@ -333,6 +408,9 @@ interface IAudioRender { * @param keyValueList Indicates the pointer to the key-value list of the extra audio parameters. * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetExtraParams([out] String keyValueList); @@ -343,6 +421,9 @@ interface IAudioRender { * @param reqSize Indicates the size of the request mmap buffer. * @param desc Indicates the pointer to the mmap buffer descriptor. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); @@ -353,6 +434,9 @@ interface IAudioRender { * @param frames Indicates the pointer to the frame where the read/write starts. * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -362,6 +446,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param effectid Indicates the audio effect instance identifier which is going to be added. * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ AddAudioEffect([in] unsigned long effectid); @@ -371,6 +458,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param effectid Indicates the audio effect which is going to be removed. * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ RemoveAudioEffect([in] unsigned long effectid); @@ -380,6 +470,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ GetFrameBufferSize([out] unsigned long bufferSize); @@ -390,6 +483,9 @@ interface IAudioRender { * @return Returns 0 if the rendering or capturing is successfully started; * returns a negative value otherwise. * @see Stop + * + * @since 5.0 + * @version 3.0 */ Start(); @@ -400,6 +496,9 @@ interface IAudioRender { * @return Returns 0 if the rendering or capturing is successfully stopped; * returns a negative value otherwise. * @see Start + * + * @since 5.0 + * @version 3.0 */ Stop(); @@ -410,6 +509,9 @@ interface IAudioRender { * @return Returns 0 if the rendering or capturing is successfully paused; * returns a negative value otherwise. * @see Resume + * + * @since 5.0 + * @version 3.0 */ Pause(); @@ -420,6 +522,9 @@ interface IAudioRender { * @return Returns 0 if the rendering or capturing is successfully resumed; * returns a negative value otherwise. * @see Pause + * + * @since 5.0 + * @version 3.0 */ Resume(); @@ -428,6 +533,9 @@ interface IAudioRender { * * @param handle Indicates the audio handle. * @return Returns 0 if the flush is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ Flush(); @@ -437,6 +545,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is * canceled; returns a negative value if the setting fails. + * + * @since 5.0 + * @version 3.0 */ TurnStandbyMode(); @@ -447,6 +558,9 @@ interface IAudioRender { * @param range Indicates the range of the device information to dump, which can be brief or full information. * @param fd Indicates the file to which the device information will be dumped. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ AudioDevDump([in] int range, [in] int fd); @@ -460,6 +574,9 @@ interface IAudioRender { * the vendor supports, and false means the opposite. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsPauseAndResume + * + * @since 5.0 + * @version 3.0 */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); @@ -469,6 +586,9 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @param size Indicates the buffer size which contains the audio data. * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 3.0 */ SetBufferSize([in] unsigned int size); } -- Gitee From c1f9b3dc26351b5cfeb6f6f2ba45178e1c502966 Mon Sep 17 00:00:00 2001 From: yangkan Date: Fri, 22 Mar 2024 20:15:40 +0800 Subject: [PATCH 121/210] composer_v1_2 Signed-off-by: yangkan --- display/bundle.json | 25 ++++++ .../v1_1/hdi_impl/display_composer_hdi_impl.h | 3 +- display/composer/v1_2/BUILD.gn | 39 ++++++++- display/composer/v1_2/DisplayComposerType.idl | 7 ++ display/composer/v1_2/IDisplayComposer.idl | 33 ++++++++ .../display_command/display_cmd_requester.h | 61 ++++++++++++++ .../display_command/display_cmd_responser.h | 56 +++++++++++++ .../v1_2/display_command/display_cmd_utils.h | 76 ++++++++++++++++++ .../v1_2/hdi_impl/display_composer_hdi_impl.h | 80 +++++++++++++++++++ .../hdi_impl/display_composer_interface.cpp | 32 ++++++++ .../include/idisplay_composer_interface.h | 45 +++++++++++ 11 files changed, 455 insertions(+), 2 deletions(-) create mode 100644 display/composer/v1_2/IDisplayComposer.idl create mode 100644 display/composer/v1_2/display_command/display_cmd_requester.h create mode 100644 display/composer/v1_2/display_command/display_cmd_responser.h create mode 100644 display/composer/v1_2/display_command/display_cmd_utils.h create mode 100644 display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h create mode 100644 display/composer/v1_2/hdi_impl/display_composer_interface.cpp create mode 100644 display/composer/v1_2/include/idisplay_composer_interface.h diff --git a/display/bundle.json b/display/bundle.json index 0ad448b5..a6914773 100644 --- a/display/bundle.json +++ b/display/bundle.json @@ -51,6 +51,7 @@ "//drivers/interface/display/composer/v1_1:display_composer_idl_target", "//drivers/interface/display/composer/v1_1:libdisplay_composer_hdi_impl_1.1", "//drivers/interface/display/composer/v1_2:display_composer_idl_target", + "//drivers/interface/display/composer/v1_2:libdisplay_composer_hdi_impl_1.2", "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_target", "//drivers/interface/display/graphic/common/v1_1:display_commontype_idl_target", "//drivers/interface/display/graphic/common/v2_0:display_commontype_idl_target" @@ -250,6 +251,22 @@ "header_base": "//drivers/interface/display/composer" } }, + { + "name": "//drivers/interface/display/composer/v1_2:libdisplay_composer_proxy_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, + { + "name": "//drivers/interface/display/composer/v1_2:libdisplay_composer_stub_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, { "name": "//drivers/interface/display/composer/v1_2:display_composer_idl_headers_1.2", "header": { @@ -258,6 +275,14 @@ "header_base": "//drivers/interface/display/composer" } }, + { + "name": "//drivers/interface/display/composer/v1_2:libdisplay_composer_hdi_impl_1.2", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/display/composer" + } + }, { "name": "//drivers/interface/display/graphic/common/v1_0:display_commontype_idl_headers", "header": { diff --git a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h index 9fcc6977..d51115f4 100644 --- a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h @@ -171,11 +171,12 @@ public: return ToDispErrCode(hdi_v1_1_->GetHDRCapabilityInfos(devId, info)); } - private: + protected: using BaseType1_0 = V1_0::DisplayComposerHdiImpl; using BaseType1_0::WAIT_TIME_INTERVAL; using BaseType1_0::ToDispErrCode; sptr hdi_v1_1_; + private: SeamlessChangeCallback seamlessChangeCb_; RefreshCallback refreshCb_; void *seamlessChangeCbData_; diff --git a/display/composer/v1_2/BUILD.gn b/display/composer/v1_2/BUILD.gn index 86f4ce29..a16db5e2 100644 --- a/display/composer/v1_2/BUILD.gn +++ b/display/composer/v1_2/BUILD.gn @@ -20,7 +20,10 @@ hdi("display_composer") { "ohos.hdi.display.composer.v1_1:display_composer", ] - sources = [ "DisplayComposerType.idl" ] + sources = [ + "DisplayComposerType.idl", + "IDisplayComposer.idl", + ] sequenceable_pub_deps = [ "../hdifd_parcelable:libhdifd_parcelable" ] @@ -28,3 +31,37 @@ hdi("display_composer") { subsystem_name = "hdf" part_name = "drivers_interface_display" } + +config("libdisplay_composer_hdi_impl_config") { + include_dirs = [ + "../", + "../hdifd_parcelable", + ] +} + +ohos_shared_library("libdisplay_composer_hdi_impl_1.2") { + sources = [ "./hdi_impl/display_composer_interface.cpp" ] + + public_configs = [ ":libdisplay_composer_hdi_impl_config" ] + + deps = [ + ":libdisplay_composer_proxy_1.2", + "../hdifd_parcelable:libhdifd_parcelable", + "../v1_1:libdisplay_composer_proxy_1.1", + ] + + external_deps = [ + "c_utils:utils", + "graphic_surface:buffer_handle", + "hdf_core:libhdi", + "hdf_core:libpub_utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "init:libbegetutil", + "ipc:ipc_single", + ] + + install_images = [ "system" ] + subsystem_name = "hdf" + part_name = "drivers_interface_display" +} diff --git a/display/composer/v1_2/DisplayComposerType.idl b/display/composer/v1_2/DisplayComposerType.idl index ffc75428..b874aaa1 100644 --- a/display/composer/v1_2/DisplayComposerType.idl +++ b/display/composer/v1_2/DisplayComposerType.idl @@ -59,4 +59,11 @@ enum DispPowerStatus : ohos.hdi.display.composer.v1_1.DispPowerStatus { */ enum BufferUsage : ohos.hdi.display.composer.v1_0.BufferUsage { HBM_USE_CPU_HW_BOTH = (1ULL << 17), /**< For support cpu and hardware */ +}; + +enum DispCmd : ohos.hdi.display.composer.v1_0.DispCmd { + REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE = 82, /**< Request cmd */ + REQUEST_CMD_BUTT_V1_2, + REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE = 515, /**< Reply cmd */ + REPLY_CMD_BUTT_V1_2, }; \ No newline at end of file diff --git a/display/composer/v1_2/IDisplayComposer.idl b/display/composer/v1_2/IDisplayComposer.idl new file mode 100644 index 00000000..23086b06 --- /dev/null +++ b/display/composer/v1_2/IDisplayComposer.idl @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 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.display.composer.v1_2; + +import ohos.hdi.display.composer.v1_1.IDisplayComposer; +import ohos.hdi.display.composer.v1_2.DisplayComposerType; + +sequenceable OHOS.HDI.Display.HdifdParcelable; + +interface IDisplayComposer extends ohos.hdi.display.composer.v1_1.IDisplayComposer { + /** + * @deprecated. + * + * @The framework of version 1.2 is temporarily supported, Deleted after external interfaces are added. + * + * @since 5.0 + * @version 1.2 + */ + CommitAndGetReleaseFence(); +} diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h new file mode 100644 index 00000000..2bf77970 --- /dev/null +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H +#define OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H + +#include "v1_1/display_command/display_cmd_requester.h" +#include "v1_2/display_command/display_cmd_utils.h" +#include "v1_2/display_composer_type.h" +#include "v1_2/idisplay_composer.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { +using namespace OHOS::HDI::Base; + +template +class DisplayCmdRequester : public V1_1::DisplayCmdRequester { +public: + DisplayCmdRequester(sptr hdi) : BaseType1_1(hdi), hdi_1_2_(hdi) {} + + static std::unique_ptr Create(sptr hdi) + { + DISPLAY_CHK_RETURN(hdi == nullptr, nullptr, HDF_LOGE("%{public}s: hdi is nullptr", __func__)); + auto requester = std::make_unique(hdi); + DISPLAY_CHK_RETURN(requester == nullptr, nullptr, + HDF_LOGE("%{public}s: CmdRequester is nullptr", __func__)); + auto ret = requester->Init(V1_0::DisplayCmdUtils::INIT_ELEMENT_COUNT); + if (ret != HDF_SUCCESS) { + HDF_LOGE("DisplayCmdRequester init failed"); + return nullptr; + } + return requester; + } + +protected: + sptr hdi_1_2_; +private: + using BaseType1_1 = V1_1::DisplayCmdRequester; +}; +using HdiDisplayCmdRequester = V1_2::DisplayCmdRequester, V1_2::IDisplayComposer>; +} // namespace V1_2 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h new file mode 100644 index 00000000..0037f674 --- /dev/null +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H +#define OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H + +#include "v1_1/display_command/display_cmd_responser.h" +#include "v1_2/display_composer_type.h" + +#define DISPLAY_TRACE HdfTrace trace(__func__, "HDI:DISP:") + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { +using namespace OHOS::HDI::Base; + +template +class DisplayCmdResponser : public V1_1::DisplayCmdResponser { +public: + static std::unique_ptr Create(VdiImpl* impl, std::shared_ptr cacheMgr) + { + DISPLAY_CHK_RETURN(impl == nullptr, nullptr, + HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); + DISPLAY_CHK_RETURN(cacheMgr == nullptr, nullptr, + HDF_LOGE("%{public}s: error, VdiImpl is nullptr", __func__)); + return std::make_unique(impl, cacheMgr); + } + + DisplayCmdResponser(VdiImpl* impl, std::shared_ptr cacheMgr) : BaseType1_1(impl, cacheMgr) {} + + virtual ~DisplayCmdResponser() {} + +private: + using BaseType1_1 = V1_1::DisplayCmdResponser; +}; +using HdiDisplayCmdResponser = DisplayCmdResponser, IDisplayComposerVdi>; +} // namespace V1_2 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_REQUESTER_H \ No newline at end of file diff --git a/display/composer/v1_2/display_command/display_cmd_utils.h b/display/composer/v1_2/display_command/display_cmd_utils.h new file mode 100644 index 00000000..cd28d018 --- /dev/null +++ b/display/composer/v1_2/display_command/display_cmd_utils.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_UTILS_H +#define OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_UTILS_H + +#include "v1_1/display_command/display_cmd_utils.h" +#include "v1_2/display_composer_type.h" + +#undef LOG_TAG +#define LOG_TAG "DISP_CMD" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { + +class DisplayCmdUtils : public V1_1::DisplayCmdUtils { + static const char *CommandToString(int32_t cmdId) + { + switch (cmdId) { + /* request cmd */ + SWITCHCASE(REQUEST_CMD_PREPARE_DISPLAY_LAYERS); + SWITCHCASE(REQUEST_CMD_SET_DISPLAY_CLIENT_BUFFER); + SWITCHCASE(REQUEST_CMD_SET_DISPLAY_CLIENT_DAMAGE); + SWITCHCASE(REQUEST_CMD_COMMIT); + SWITCHCASE(REQUEST_CMD_SET_LAYER_ALPHA); + SWITCHCASE(REQUEST_CMD_SET_LAYER_REGION); + SWITCHCASE(REQUEST_CMD_SET_LAYER_CROP); + SWITCHCASE(REQUEST_CMD_SET_LAYER_ZORDER); + SWITCHCASE(REQUEST_CMD_SET_LAYER_PREMULTI); + SWITCHCASE(REQUEST_CMD_SET_LAYER_TRANSFORM_MODE); + SWITCHCASE(REQUEST_CMD_SET_LAYER_DIRTY_REGION); + SWITCHCASE(REQUEST_CMD_SET_LAYER_VISIBLE_REGION); + SWITCHCASE(REQUEST_CMD_SET_LAYER_BUFFER); + SWITCHCASE(REQUEST_CMD_SET_LAYER_COMPOSITION_TYPE); + SWITCHCASE(REQUEST_CMD_SET_LAYER_BLEND_TYPE); + SWITCHCASE(REQUEST_CMD_SET_LAYER_COLOR); + SWITCHCASE(REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE); + /* reply cmd */ + SWITCHCASE(REPLY_CMD_SET_ERROR); + SWITCHCASE(REPLY_CMD_PREPARE_DISPLAY_LAYERS); + SWITCHCASE(REPLY_CMD_COMMIT); + SWITCHCASE(REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE); + /* pack control cmd */ + SWITCHCASE(CONTROL_CMD_REQUEST_BEGIN); + SWITCHCASE(CONTROL_CMD_REPLY_BEGIN); + SWITCHCASE(CONTROL_CMD_REQUEST_END); + SWITCHCASE(CONTROL_CMD_REPLY_END); + default: + return "unknow command id."; + } + } +}; +using CmdUtils = DisplayCmdUtils; +} // namespace V1_2 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_UTILS_H \ No newline at end of file diff --git a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h new file mode 100644 index 00000000..65562ff6 --- /dev/null +++ b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_DISPLAY_COMPOSER_HDI_IMPL_H +#define OHOS_HDI_DISPLAY_V1_2_DISPLAY_COMPOSER_HDI_IMPL_H + +#include "v1_1/hdi_impl/display_composer_hdi_impl.h" +#include "v1_2/display_command/display_cmd_requester.h" +#include "v1_2/display_composer_type.h" +#include "v1_2/idisplay_composer.h" +#include "v1_2/include/idisplay_composer_interface.h" +#include + +#undef LOG_TAG +#define LOG_TAG "DISP_HDI_COMP" +#undef LOG_DOMAIN +#define LOG_DOMAIN 0xD002515 + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { + +template +class DisplayComposerHdiImpl : public V1_1::DisplayComposerHdiImpl { +public: + static IDisplayComposerInterface* Create(bool needSMQ) + { + sptr hdi; + std::shared_ptr req = nullptr; + HDF_LOGI("%{public}s: hdi v1_2 start", __func__); + while ((hdi = CompHdi::Get()) == nullptr) { + // Waiting for display composer service ready + usleep(WAIT_TIME_INTERVAL); + } + HDF_LOGI("%{public}s: hdi v1_2 end", __func__); + if (needSMQ) { + req = CmdReq::Create(hdi); + if (req == nullptr) { + HDF_LOGE("%{public}s: Create DisplayCmdRequester failed %{public}d", __func__, __LINE__); + return nullptr; + } + } + return new DisplayComposerHdiImpl(hdi, req); + } + + DisplayComposerHdiImpl(sptr hdi, std::shared_ptr req) + : BaseType1_1(hdi, req), + req_v1_2_(req), + hdi_v1_2_(hdi) {} + + virtual ~DisplayComposerHdiImpl() {} + + protected: + using BaseType1_1 = V1_1::DisplayComposerHdiImpl; + using BaseType1_1::WAIT_TIME_INTERVAL; + using BaseType1_1::ToDispErrCode; + std::shared_ptr req_v1_2_; + sptr hdi_v1_2_; +}; +using HdiDisplayComposer = DisplayComposerHdiImpl; +} // namespace V1_2 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS +#endif // OHOS_HDI_DISPLAY_V1_2_DISPLAY_COMPOSER_HDI_IMPL_H diff --git a/display/composer/v1_2/hdi_impl/display_composer_interface.cpp b/display/composer/v1_2/hdi_impl/display_composer_interface.cpp new file mode 100644 index 00000000..4208cace --- /dev/null +++ b/display/composer/v1_2/hdi_impl/display_composer_interface.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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. + */ + +#include "v1_2/hdi_impl/display_composer_hdi_impl.h" +#include "hilog/log.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { +IDisplayComposerInterface* IDisplayComposerInterface::Get(bool needSMQ) +{ + return HdiDisplayComposer::Create(needSMQ); +} +} // namespace V1_2 +} // namespace Composer +} // namespace Display +} // namespace HDI +} // namespace OHOS diff --git a/display/composer/v1_2/include/idisplay_composer_interface.h b/display/composer/v1_2/include/idisplay_composer_interface.h new file mode 100644 index 00000000..6203a9a1 --- /dev/null +++ b/display/composer/v1_2/include/idisplay_composer_interface.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef OHOS_HDI_DISPLAY_V1_2_IDISPLAY_COMPOSER_INTERFACE_H +#define OHOS_HDI_DISPLAY_V1_2_IDISPLAY_COMPOSER_INTERFACE_H + +#include "v1_1/include/idisplay_composer_interface.h" +#include "v1_2/display_composer_type.h" + +namespace OHOS { +namespace HDI { +namespace Display { +namespace Composer { +namespace V1_2 { + +class IDisplayComposerInterface : public V1_1::IDisplayComposerInterface { +public: + /** + * @brief Obtains all interfaces of IDisplayComposerInterface. + * + * @return Returns IDisplayComposerInterface* if the operation is successful; + * returns an null point otherwise. + * @since 5.0 + * @version 1.2 + */ + static IDisplayComposerInterface* Get(bool needSMQ = true); +}; +} // V1_2 +} // Composer +} // Display +} // HDI +} // OHOS +#endif // OHOS_HDI_DISPLAY_V1_2_IDISPLAY_COMPOSER_INTERFACE_H -- Gitee From c0c5b8cce0ffc5af0b98d3f1c7d4d10eaf084786 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Sat, 23 Mar 2024 14:26:21 +0800 Subject: [PATCH 122/210] commit msg Signed-off-by: xuxuehai --- audio/v3_0/AudioTypes.idl | 144 ++++++++++++++--------------- audio/v3_0/IAudioAdapter.idl | 74 +++++++-------- audio/v3_0/IAudioCallback.idl | 14 +-- audio/v3_0/IAudioCapture.idl | 130 +++++++++++++------------- audio/v3_0/IAudioManager.idl | 22 ++--- audio/v3_0/IAudioRender.idl | 166 +++++++++++++++++----------------- 6 files changed, 275 insertions(+), 275 deletions(-) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index 0c00a8c9..8b0edef1 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -33,8 +33,8 @@ package ohos.hdi.audio.v3_0; /** * @brief Enumerates the audio port type. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioPortDirection { PORT_OUT = 1, /**< Output port */ @@ -45,7 +45,7 @@ enum AudioPortDirection { /** * @brief Enumerates the pin of an audio adapter. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ enum AudioPortPin { @@ -75,7 +75,7 @@ enum AudioPortPin { /** * @brief Enumerates the audio category. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ enum AudioCategory { @@ -92,8 +92,8 @@ enum AudioCategory { /** * @brief Enumerates the audio format. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioFormat { AUDIO_FORMAT_TYPE_PCM_8_BIT = 1 << 0, /**< 8-bit PCM */ @@ -118,8 +118,8 @@ enum AudioFormat { * * A mask describes an audio channel position. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioChannelMask { AUDIO_CHANNEL_FRONT_LEFT = 1, /**< Front left channel */ @@ -131,8 +131,8 @@ enum AudioChannelMask { /** * @brief Enumerates masks of audio sampling rates. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioSampleRatesMask { AUDIO_SAMPLE_RATE_MASK_8000 = 1 << 0, /**< 8 kHz */ @@ -152,8 +152,8 @@ enum AudioSampleRatesMask { /** * @brief Enumerates the passthrough data transmission mode of an audio port. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioPortPassthroughMode { PORT_PASSTHROUGH_LPCM = 1 << 0, /**< Stereo PCM */ @@ -165,8 +165,8 @@ enum AudioPortPassthroughMode { /** * @brief Defines formats of raw audio samples. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioSampleFormat { /* 8 bits */ @@ -206,8 +206,8 @@ enum AudioSampleFormat { * * @attention The following modes are set for rendering dual-channel audios. Others are not supported. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioChannelMode { AUDIO_CHANNEL_NORMAL = 0, /**< Normal mode. No processing is required. */ @@ -225,8 +225,8 @@ enum AudioChannelMode { /** * @brief Enumerates the execution types of the DrainBuffer function. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioDrainNotifyType { AUDIO_DRAIN_NORMAL_MODE = 0, /**< The DrainBuffer function returns after all data finishes playback. */ @@ -239,8 +239,8 @@ enum AudioDrainNotifyType { /** * @brief Enumerates callback notification events. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioCallbackType { AUDIO_NONBLOCK_WRITE_COMPLETED = 0, /**< The non-block write is complete. */ @@ -253,8 +253,8 @@ enum AudioCallbackType { /** * @brief Describes AudioPortRole. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioPortRole { AUDIO_PORT_UNASSIGNED_ROLE = 0, /**< Unassigned port role */ @@ -265,8 +265,8 @@ enum AudioPortRole { /** * @brief Describes AudioPortType. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioPortType { AUDIO_PORT_UNASSIGNED_TYPE = 0, /**< Unassigned port type */ @@ -278,8 +278,8 @@ enum AudioPortType { /** * @brief Describes AudioSessionType. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioSessionType { AUDIO_OUTPUT_STAGE_SESSION = 0, /**< Assigned output stage session */ @@ -291,7 +291,7 @@ enum AudioSessionType { /** * @brief Describes AudioDeviceType. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ enum AudioDeviceType { @@ -314,8 +314,8 @@ enum AudioDeviceType { /** * @brief Describes AudioEventType. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioEventType { AUDIO_DEVICE_ADD = 1, /**< Assigned add device event type */ @@ -332,8 +332,8 @@ enum AudioEventType { /** * @brief Enumerates the restricted key type of the parameters * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioExtParamKey { AUDIO_EXT_PARAM_KEY_NONE = 0, /**< Distributed audio extra param key none */ @@ -351,8 +351,8 @@ enum AudioExtParamKey { /** * @brief Describes status of audio deivce.@link enum AudioDeviceType * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioDeviceStatus { unsigned int pnpStatus; /**< Audio pnp status */ @@ -361,8 +361,8 @@ struct AudioDeviceStatus { /** * @brief Describes the audio scene. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ union SceneDesc { unsigned int id; /**< Audio scene ID */ @@ -371,8 +371,8 @@ union SceneDesc { /** * @brief Defines the audio port. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioPort { enum AudioPortDirection dir; /**< Audio port type. For details, see {@link AudioPortDirection} */ @@ -387,8 +387,8 @@ struct AudioPort { * One port corresponds to multiple pins, and each pin belongs to a physical component (such as a * speaker or a wired headset). * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioAdapterDescriptor { String adapterName; /**< Name of the audio adapter */ @@ -398,8 +398,8 @@ struct AudioAdapterDescriptor { /** * @brief Defines the audio device descriptor. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioDeviceDescriptor { unsigned int portId; /**< Audio port ID */ @@ -410,8 +410,8 @@ struct AudioDeviceDescriptor { /** * @brief Defines the audio scene descriptor. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioSceneDescriptor { union SceneDesc scene; /**< Describes the audio scene */ @@ -421,8 +421,8 @@ struct AudioSceneDescriptor { /** * @brief Defines audio input type. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ enum AudioInputType { AUDIO_INPUT_DEFAULT_TYPE = 0, /**< Assigned default input type */ @@ -439,8 +439,8 @@ enum AudioInputType { /** * @brief Defines audio offload attributes. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioOffloadInfo { @@ -457,8 +457,8 @@ struct AudioOffloadInfo /** * @brief Defines audio sampling attributes. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioSampleAttributes { enum AudioCategory type; /**< Audio type. For details, see {@link AudioCategory} */ @@ -484,8 +484,8 @@ struct AudioSampleAttributes { /** * @brief Defines the audio timestamp, which is a substitute for POSIX timespec. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioTimeStamp { long tvSec; /**< Seconds */ @@ -495,8 +495,8 @@ struct AudioTimeStamp { /** * @brief Defines the sub-port capability. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioSubPortCapability { unsigned int portId; /**< Sub-port ID */ @@ -509,8 +509,8 @@ struct AudioSubPortCapability { /** * @brief Defines the audio port capability. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioPortCapability { unsigned int deviceType; /**< Device type (output or input) */ @@ -532,8 +532,8 @@ struct AudioPortCapability { /** * @brief Describes a mmap buffer. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioMmapBufferDescriptor { byte[] memoryAddress; /**< Pointer to the mmap buffer */ @@ -548,8 +548,8 @@ struct AudioMmapBufferDescriptor { /** * @brief Describes AudioDevExtInfo. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioDevExtInfo { int moduleId; /**< Identifier of the module stream is attached to */ @@ -560,8 +560,8 @@ struct AudioDevExtInfo { /** * @brief Describes AudioMixInfo. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioMixExtInfo { int moduleId; /**< Identifier of the module stream is attached to */ @@ -571,8 +571,8 @@ struct AudioMixExtInfo { /** * @brief Describes AudioSessionExtInfo. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioSessionExtInfo { enum AudioSessionType sessionType; /**< Audio session type */ @@ -581,8 +581,8 @@ struct AudioSessionExtInfo { /** * @brief Describes AudioInfo. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioInfo { struct AudioDevExtInfo device; /* Specific Device Ext info */ @@ -593,8 +593,8 @@ struct AudioInfo { /** * @brief Describes AudioRouteNode. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioRouteNode { int portId; /**< Audio port ID */ @@ -606,8 +606,8 @@ struct AudioRouteNode { /** * @brief Describes AudioRoute. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioRoute { struct AudioRouteNode[] sources; /**< List of sources */ @@ -617,8 +617,8 @@ struct AudioRoute { /** * @brief Describes AudioEvent. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ struct AudioEvent { unsigned int eventType; /**< @link enum AudioEventType */ diff --git a/audio/v3_0/IAudioAdapter.idl b/audio/v3_0/IAudioAdapter.idl index 7f1a47f0..c37a455b 100644 --- a/audio/v3_0/IAudioAdapter.idl +++ b/audio/v3_0/IAudioAdapter.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -41,8 +41,8 @@ import ohos.hdi.audio.v3_0.IAudioCallback; * * @see IAudioRender * @see IAudioCapture - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ interface IAudioAdapter { /** @@ -55,8 +55,8 @@ interface IAudioAdapter { * @param adapter Indicates the pointer to the audio adapter to operate. * @return Returns 0 if the initialization is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ InitAllPorts(); @@ -72,8 +72,8 @@ interface IAudioAdapter { * @see GetPortCapability * @see DestroyRender * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ CreateRender([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioRender render, [out] unsigned int renderId); @@ -88,8 +88,8 @@ interface IAudioAdapter { * @return Returns 0 if the IAudioRender object is destroyed; returns a negative value otherwise. * @see CreateRender * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ DestroyRender([in] unsigned int renderId); @@ -105,8 +105,8 @@ interface IAudioAdapter { * @see GetPortCapability * @see DestroyCapture * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ CreateCapture([in] struct AudioDeviceDescriptor desc, [in] struct AudioSampleAttributes attrs, [out] IAudioCapture capture, [out] unsigned int captureId); @@ -121,8 +121,8 @@ interface IAudioAdapter { * @return Returns 0 if the IAudioCapture object is destroyed; returns a negative value otherwise. * @see CreateCapture * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ DestroyCapture([in] unsigned int captureId); @@ -134,8 +134,8 @@ interface IAudioAdapter { * @param capability Indicates the pointer to the capability set to obtain. * @return Returns 0 if the capability set is successfully obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetPortCapability([in] struct AudioPort port, [out] struct AudioPortCapability capability); @@ -148,8 +148,8 @@ interface IAudioAdapter { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetPassthroughMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetPassthroughMode([in] struct AudioPort port, [in] enum AudioPortPassthroughMode mode); @@ -162,8 +162,8 @@ interface IAudioAdapter { * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetPassthroughMode([in] struct AudioPort port, [out] enum AudioPortPassthroughMode mode); @@ -174,8 +174,8 @@ interface IAudioAdapter { * @param status Indicates the status of device . * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetDeviceStatus([out] struct AudioDeviceStatus status); @@ -188,8 +188,8 @@ interface IAudioAdapter { * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ UpdateAudioRoute([in] struct AudioRoute route, [out] int routeHandle); @@ -201,8 +201,8 @@ interface IAudioAdapter { * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetPassthroughMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ ReleaseAudioRoute([in] int routeHandle); @@ -215,8 +215,8 @@ interface IAudioAdapter { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetMicMute([in] boolean mute); @@ -229,8 +229,8 @@ interface IAudioAdapter { * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetMicMute([out] boolean mute); @@ -245,8 +245,8 @@ interface IAudioAdapter { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetVoiceVolume([in] float volume); @@ -267,8 +267,8 @@ interface IAudioAdapter { * * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [in] String value); @@ -290,8 +290,8 @@ interface IAudioAdapter { * * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetExtraParams([in] enum AudioExtParamKey key, [in] String condition, [out] String value); @@ -303,8 +303,8 @@ interface IAudioAdapter { * @param cookie Indicates the pointer to the callback parameters; * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RegExtraParamObserver([in] IAudioCallback audioCallback, [in] byte cookie); } diff --git a/audio/v3_0/IAudioCallback.idl b/audio/v3_0/IAudioCallback.idl index 1d655073..7d8135c7 100644 --- a/audio/v3_0/IAudioCallback.idl +++ b/audio/v3_0/IAudioCallback.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -41,8 +41,8 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. * @see RegCallback * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ [callback] interface IAudioCallback { /** @@ -54,8 +54,8 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @return Returns 0 if the callback is successfully executed; returns a negative value otherwise. * @see RegCallback * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); @@ -69,8 +69,8 @@ import ohos.hdi.audio.v3_0.AudioTypes; * @param cookie Indicates the pointer to the callback parameters; * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); } diff --git a/audio/v3_0/IAudioCapture.idl b/audio/v3_0/IAudioCapture.idl index d9589c3f..0f6ec51d 100644 --- a/audio/v3_0/IAudioCapture.idl +++ b/audio/v3_0/IAudioCapture.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -36,8 +36,8 @@ import ohos.hdi.audio.v3_0.AudioTypes; /** * @brief Provides capabilities for audio capturing, including controlling the capturing, setting audio attributes, * scenes, and volume, and capturing audio frames. - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ interface IAudioCapture { /** @@ -49,8 +49,8 @@ interface IAudioCapture { * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to read. * @return Returns 0 if the input data is read successfully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ CaptureFrame([out] byte[] frame, [out] unsigned long replyBytes); @@ -63,8 +63,8 @@ interface IAudioCapture { * @return Returns 0 if the last number is obtained; returns a negative value otherwise. * @see CaptureFrame * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetCapturePosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -78,8 +78,8 @@ interface IAudioCapture { * @return Returns 0 if the result is obtained; returns a negative value otherwise. * @see SelectScene * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); @@ -104,8 +104,8 @@ interface IAudioCapture { * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. * @see CheckSceneCapability * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SelectScene([in] struct AudioSceneDescriptor scene); @@ -118,8 +118,8 @@ interface IAudioCapture { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetMute([in] boolean mute); @@ -132,8 +132,8 @@ interface IAudioCapture { * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetMute([out] boolean mute); @@ -148,8 +148,8 @@ interface IAudioCapture { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetVolume([in] float volume); @@ -161,8 +161,8 @@ interface IAudioCapture { * @return Returns 0 if the volume is obtained; returns a negative value otherwise. * @see SetVolume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetVolume([out] float volume); @@ -183,8 +183,8 @@ interface IAudioCapture { * @see GetGain * @see SetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetGainThreshold([out] float min, [out] float max); @@ -197,8 +197,8 @@ interface IAudioCapture { * @see GetGainThreshold * @see SetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetGain([out] float gain); @@ -211,8 +211,8 @@ interface IAudioCapture { * @see GetGainThreshold * @see GetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetGain([in] float gain); @@ -223,8 +223,8 @@ interface IAudioCapture { * @param size Indicates the pointer to the audio frame size (in bytes). * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameSize([out] unsigned long size); @@ -235,8 +235,8 @@ interface IAudioCapture { * @param count Indicates the pointer to the number of audio frames in the audio buffer. * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameCount([out] unsigned long count); @@ -249,8 +249,8 @@ interface IAudioCapture { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetSampleAttributes * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetSampleAttributes([in] struct AudioSampleAttributes attrs); @@ -263,8 +263,8 @@ interface IAudioCapture { * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. * @see SetSampleAttributes * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetSampleAttributes([out] struct AudioSampleAttributes attrs); @@ -275,8 +275,8 @@ interface IAudioCapture { * @param channelId Indicates the pointer to the data channel ID. * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetCurrentChannelId([out] unsigned int channelId); @@ -288,8 +288,8 @@ interface IAudioCapture { * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetExtraParams([in] String keyValueList); @@ -301,8 +301,8 @@ interface IAudioCapture { * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetExtraParams([out] String keyValueList); @@ -314,8 +314,8 @@ interface IAudioCapture { * @param desc Indicates the pointer to the mmap buffer descriptor. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); @@ -327,8 +327,8 @@ interface IAudioCapture { * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -339,8 +339,8 @@ interface IAudioCapture { * @param effectid Indicates the audio effect instance identifier which is going to be added. * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ AddAudioEffect([in] unsigned long effectid); @@ -351,8 +351,8 @@ interface IAudioCapture { * @param effectid Indicates the audio effect which is going to be removed. * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RemoveAudioEffect([in] unsigned long effectid); @@ -363,8 +363,8 @@ interface IAudioCapture { * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameBufferSize([out] unsigned long bufferSize); @@ -376,8 +376,8 @@ interface IAudioCapture { * returns a negative value otherwise. * @see Stop * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Start(); @@ -389,8 +389,8 @@ interface IAudioCapture { * returns a negative value otherwise. * @see Start * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Stop(); @@ -402,8 +402,8 @@ interface IAudioCapture { * returns a negative value otherwise. * @see Resume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Pause(); @@ -415,8 +415,8 @@ interface IAudioCapture { * returns a negative value otherwise. * @see Pause * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Resume(); @@ -426,8 +426,8 @@ interface IAudioCapture { * @param handle Indicates the audio handle. * @return Returns 0 if the flush is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Flush(); @@ -438,8 +438,8 @@ interface IAudioCapture { * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is * canceled; returns a negative value if the setting fails. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ TurnStandbyMode(); @@ -451,8 +451,8 @@ interface IAudioCapture { * @param fd Indicates the file to which the device information will be dumped. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ AudioDevDump([in] int range, [in] int fd); @@ -467,8 +467,8 @@ interface IAudioCapture { * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsPauseAndResume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); } diff --git a/audio/v3_0/IAudioManager.idl b/audio/v3_0/IAudioManager.idl index 348fe84f..462a7b65 100644 --- a/audio/v3_0/IAudioManager.idl +++ b/audio/v3_0/IAudioManager.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -38,8 +38,8 @@ import ohos.hdi.audio.v3_0.IAudioAdapter; * adapter descriptor. * * @see IAudioAdapter - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ interface IAudioManager { /** @@ -51,8 +51,8 @@ interface IAudioManager { * @return Returns 0 if the list is obtained successfully; returns a negative value otherwise. * @see LoadAdapter * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); @@ -68,8 +68,8 @@ interface IAudioManager { * @see GetAllAdapters * @see UnloadAdapter * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); @@ -80,8 +80,8 @@ interface IAudioManager { * @param adapter Indicates the pointer to the audio adapter whose driver will be unloaded. * @see LoadAdapter * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ UnloadAdapter([in] String adapterName); @@ -91,8 +91,8 @@ interface IAudioManager { * @param object Indicates the pointer to the audio adapter manager to operate. * @return Returns true if the Object is released; returns false otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ ReleaseAudioManagerObject(); } diff --git a/audio/v3_0/IAudioRender.idl b/audio/v3_0/IAudioRender.idl index fb977a19..89723db1 100644 --- a/audio/v3_0/IAudioRender.idl +++ b/audio/v3_0/IAudioRender.idl @@ -24,7 +24,7 @@ * subscribing to or unsubscribing from audio data, enabling or disabling an audio, * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. * - * @since 5.0 + * @since 4.1 * @version 3.0 */ @@ -37,8 +37,8 @@ import ohos.hdi.audio.v3_0.IAudioCallback; * @brief Provides capabilities for audio rendering, including controlling the rendering, setting audio attributes, * scenes, and volume, obtaining hardware latency, and rendering audio frames. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ interface IAudioRender { /** @@ -48,8 +48,8 @@ interface IAudioRender { * @param ms Indicates the pointer to the latency (in milliseconds) to be obtained. * @return Returns 0 if the latency is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetLatency([out] unsigned int ms); @@ -62,8 +62,8 @@ interface IAudioRender { * @param replyBytes Indicates the pointer to the actual length (in bytes) of the audio data to write. * @return Returns 0 if the data is written successfully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RenderFrame([in] byte[] frame, [out] unsigned long replyBytes); @@ -76,8 +76,8 @@ interface IAudioRender { * @return Returns 0 if the last number is obtained; returns a negative value otherwise. * @see RenderFrame * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetRenderPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -89,8 +89,8 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetRenderSpeed * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetRenderSpeed([in] float speed); @@ -102,8 +102,8 @@ interface IAudioRender { * @return Returns 0 if the speed is successfully obtained; returns a negative value otherwise. * @see SetRenderSpeed * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetRenderSpeed([out] float speed); @@ -115,8 +115,8 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetChannelMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetChannelMode([in] enum AudioChannelMode mode); @@ -128,8 +128,8 @@ interface IAudioRender { * @return Returns 0 if the mode is successfully obtained; returns a negative value otherwise. * @see SetChannelMode * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetChannelMode([out] enum AudioChannelMode mode); @@ -143,8 +143,8 @@ interface IAudioRender { * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see RegCallback * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RegCallback([in] IAudioCallback audioCallback, [in] byte cookie); @@ -157,8 +157,8 @@ interface IAudioRender { * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see RegCallback * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ DrainBuffer([out] enum AudioDrainNotifyType type); @@ -171,8 +171,8 @@ interface IAudioRender { * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsDrain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ IsSupportsDrain([out] boolean support); @@ -186,8 +186,8 @@ interface IAudioRender { * @return Returns 0 if the result is obtained; returns a negative value otherwise. * @see SelectScene * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ CheckSceneCapability([in] struct AudioSceneDescriptor scene, [out] boolean supported); @@ -212,8 +212,8 @@ interface IAudioRender { * @return Returns 0 if the scene is selected successfully; returns a negative value otherwise. * @see CheckSceneCapability * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SelectScene([in] struct AudioSceneDescriptor scene); @@ -226,8 +226,8 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetMute([in] boolean mute); @@ -240,8 +240,8 @@ interface IAudioRender { * @return Returns 0 if the mute operation is obtained; returns a negative value otherwise. * @see SetMute * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetMute([out] boolean mute); @@ -256,8 +256,8 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetVolume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetVolume([in] float volume); @@ -269,8 +269,8 @@ interface IAudioRender { * @return Returns 0 if the volume is obtained; returns a negative value otherwise. * @see SetVolume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetVolume([out] float volume); @@ -291,8 +291,8 @@ interface IAudioRender { * @see GetGain * @see SetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetGainThreshold([out] float min, [out] float max); @@ -305,8 +305,8 @@ interface IAudioRender { * @see GetGainThreshold * @see SetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetGain([out] float gain); @@ -319,8 +319,8 @@ interface IAudioRender { * @see GetGainThreshold * @see GetGain * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetGain([in] float gain); @@ -331,8 +331,8 @@ interface IAudioRender { * @param size Indicates the pointer to the audio frame size (in bytes). * @return Returns 0 if the audio frame size is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameSize([out] unsigned long size); @@ -343,8 +343,8 @@ interface IAudioRender { * @param count Indicates the pointer to the number of audio frames in the audio buffer. * @return Returns 0 if the number of audio frames is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameCount([out] unsigned long count); @@ -357,8 +357,8 @@ interface IAudioRender { * @return Returns 0 if the setting is successful; returns a negative value otherwise. * @see GetSampleAttributes * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetSampleAttributes([in] struct AudioSampleAttributes attrs); @@ -371,8 +371,8 @@ interface IAudioRender { * @return Returns 0 if audio sampling attributes are obtained; returns a negative value otherwise. * @see SetSampleAttributes * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetSampleAttributes([out] struct AudioSampleAttributes attrs); @@ -383,8 +383,8 @@ interface IAudioRender { * @param channelId Indicates the pointer to the data channel ID. * @return Returns 0 if the data channel ID is obtained; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetCurrentChannelId([out] unsigned int channelId); @@ -396,8 +396,8 @@ interface IAudioRender { * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetExtraParams([in] String keyValueList); @@ -409,8 +409,8 @@ interface IAudioRender { * The format is key=value. Separate multiple key-value pairs by semicolons (;). * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetExtraParams([out] String keyValueList); @@ -422,8 +422,8 @@ interface IAudioRender { * @param desc Indicates the pointer to the mmap buffer descriptor. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ ReqMmapBuffer([in] int reqSize, [out] struct AudioMmapBufferDescriptor desc); @@ -435,8 +435,8 @@ interface IAudioRender { * @param time Indicates the pointer to the timestamp associated with the frame where the read/write starts. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetMmapPosition([out] unsigned long frames, [out] struct AudioTimeStamp time); @@ -447,8 +447,8 @@ interface IAudioRender { * @param effectid Indicates the audio effect instance identifier which is going to be added. * @return Returns 0 if the audio effect were added succesffully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ AddAudioEffect([in] unsigned long effectid); @@ -459,8 +459,8 @@ interface IAudioRender { * @param effectid Indicates the audio effect which is going to be removed. * @return Returns 0 if the audio effect were removed succesffully; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ RemoveAudioEffect([in] unsigned long effectid); @@ -471,8 +471,8 @@ interface IAudioRender { * @param bufferSize Indicates the buffer size (in bytes) queried from the vendor * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ GetFrameBufferSize([out] unsigned long bufferSize); @@ -484,8 +484,8 @@ interface IAudioRender { * returns a negative value otherwise. * @see Stop * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Start(); @@ -497,8 +497,8 @@ interface IAudioRender { * returns a negative value otherwise. * @see Start * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Stop(); @@ -510,8 +510,8 @@ interface IAudioRender { * returns a negative value otherwise. * @see Resume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Pause(); @@ -523,8 +523,8 @@ interface IAudioRender { * returns a negative value otherwise. * @see Pause * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Resume(); @@ -534,8 +534,8 @@ interface IAudioRender { * @param handle Indicates the audio handle. * @return Returns 0 if the flush is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ Flush(); @@ -546,8 +546,8 @@ interface IAudioRender { * @return Returns 0 if the device is set to standby mode; returns a positive value if the standby mode is * canceled; returns a negative value if the setting fails. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ TurnStandbyMode(); @@ -559,8 +559,8 @@ interface IAudioRender { * @param fd Indicates the file to which the device information will be dumped. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ AudioDevDump([in] int range, [in] int fd); @@ -575,8 +575,8 @@ interface IAudioRender { * @return Returns 0 if the operation is successful; returns a negative value otherwise. * @see IsSupportsPauseAndResume * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ IsSupportsPauseAndResume([out] boolean supportPause, [out] boolean supportResume); @@ -587,8 +587,8 @@ interface IAudioRender { * @param size Indicates the buffer size which contains the audio data. * @return Returns 0 if the operation is successful; returns a negative value otherwise. * - * @since 5.0 - * @version 3.0 + * @since 4.1 + * @version 2.0 */ SetBufferSize([in] unsigned int size); } -- Gitee From a50322cfa7cba144f75cd29b2f249513c926644f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Sat, 23 Mar 2024 15:30:56 +0800 Subject: [PATCH 123/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index fe60cbd8..e2cd9f44 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -13,7 +13,7 @@ "name": "drivers_interface_vibrator", "subsystem": "hdf", "syscap": [], - "adapted_system_type": ["standard"], + "adapted_system_type": ["small,standard"], "rom": "675KB", "ram": "1024KB", "deps": { -- Gitee From 534af50cadf0e0b2d29440141044222de2b1feb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Sat, 23 Mar 2024 18:27:12 +0800 Subject: [PATCH 124/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index e2cd9f44..f050936f 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -13,7 +13,7 @@ "name": "drivers_interface_vibrator", "subsystem": "hdf", "syscap": [], - "adapted_system_type": ["small,standard"], + "adapted_system_type": ["small","standard"], "rom": "675KB", "ram": "1024KB", "deps": { -- Gitee From 81075cdfce7d5f8e1b886aafb1b18426640f1c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Sat, 23 Mar 2024 18:35:15 +0800 Subject: [PATCH 125/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index f050936f..394a9201 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -13,7 +13,10 @@ "name": "drivers_interface_vibrator", "subsystem": "hdf", "syscap": [], - "adapted_system_type": ["small","standard"], + "adapted_system_type": [ + "standard", + "small" + ], "rom": "675KB", "ram": "1024KB", "deps": { -- Gitee From c9862a496defeb161993fb9b2564241eed2f6127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Mon, 25 Mar 2024 11:11:27 +0800 Subject: [PATCH 126/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/v1_3/IVibratorInterface.idl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vibrator/v1_3/IVibratorInterface.idl b/vibrator/v1_3/IVibratorInterface.idl index 1b990678..f373f201 100644 --- a/vibrator/v1_3/IVibratorInterface.idl +++ b/vibrator/v1_3/IVibratorInterface.idl @@ -23,10 +23,11 @@ * set the vibrator effect using the functions provided by the driver object or agent. * * @since 5.0 + * @version 1.3 */ /** - * @file VibratorTypes.idl + * @file IVibratorInterface.idl * * @brief Declares common APIs in the vibrator module. The APIs canObtains information about all the vibrator * that support setting intensity and Start the vibrator according to the incoming vibration effect. -- Gitee From 92e0be7c504397c845a5361e2bf149ce52882c7c Mon Sep 17 00:00:00 2001 From: "jiaoliang (C)" Date: Mon, 25 Mar 2024 15:39:48 +0800 Subject: [PATCH 127/210] feat:add low power ble hdi files Signed-off-by: jiaoliang (C) --- bluetooth/bundle.json | 27 ++++- bluetooth/lp_ble/v1_0/BUILD.gn | 29 +++++ bluetooth/lp_ble/v1_0/IBleCallback.idl | 80 +++++++++++++ bluetooth/lp_ble/v1_0/IBleInterface.idl | 140 ++++++++++++++++++++++ bluetooth/lp_ble/v1_0/IDeviceCallback.idl | 65 ++++++++++ bluetooth/lp_ble/v1_0/IWakeupCallback.idl | 63 ++++++++++ 6 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 bluetooth/lp_ble/v1_0/BUILD.gn create mode 100644 bluetooth/lp_ble/v1_0/IBleCallback.idl create mode 100644 bluetooth/lp_ble/v1_0/IBleInterface.idl create mode 100644 bluetooth/lp_ble/v1_0/IDeviceCallback.idl create mode 100644 bluetooth/lp_ble/v1_0/IWakeupCallback.idl diff --git a/bluetooth/bundle.json b/bluetooth/bundle.json index cdbbf6b2..8aa12a5e 100644 --- a/bluetooth/bundle.json +++ b/bluetooth/bundle.json @@ -28,7 +28,8 @@ "sub_component": [ "//drivers/interface/bluetooth/hci/v1_0:bluetooth_hci_idl_target", "//drivers/interface/bluetooth/a2dp/v1_0:bluetooth_a2dp_idl_target", - "//drivers/interface/bluetooth/a2dp/v1_1:bluetooth_a2dp_idl_target" + "//drivers/interface/bluetooth/a2dp/v1_1:bluetooth_a2dp_idl_target", + "//drivers/interface/bluetooth/lp_ble/v1_0:bluetooth_lp_ble_idl_target" ], "test": [ ], @@ -104,6 +105,30 @@ ], "header_base": "//drivers/interface/bluetooth/a2dp" } + }, + { + "name": "//drivers/interface/bluetooth/lp_ble/v1_0:libbluetooth_lp_ble_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/lp_ble" + } + }, + { + "name": "//drivers/interface/bluetooth/lp_ble/v1_0:libbluetooth_lp_ble_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/lp_ble" + } + }, + { + "name": "//drivers/interface/bluetooth/lp_ble/v1_0:bluetooth_lp_ble_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/bluetooth/lp_ble" + } } ] } diff --git a/bluetooth/lp_ble/v1_0/BUILD.gn b/bluetooth/lp_ble/v1_0/BUILD.gn new file mode 100644 index 00000000..e8b0e787 --- /dev/null +++ b/bluetooth/lp_ble/v1_0/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2021 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/hdf_core/adapter/uhdf2/hdi.gni") + +hdi("bluetooth_lp_ble") { + module_name = "bluetooth_lp_ble" + + sources = [ + "IBleCallback.idl", + "IBleInterface.idl", + "IDeviceCallback.idl", + "IWakeupCallback.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_bluetooth" +} diff --git a/bluetooth/lp_ble/v1_0/IBleCallback.idl b/bluetooth/lp_ble/v1_0/IBleCallback.idl new file mode 100644 index 00000000..eee7fd22 --- /dev/null +++ b/bluetooth/lp_ble/v1_0/IBleCallback.idl @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 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 HdiBluetoothLpBle + * @{ + * + * @brief Provides APIs for the low power BLE service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IBleCallback.idl + * + * @brief Declares the callbacks for the low power BLE module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the low power BLE module interface package. + * + * @since 5.0 + */ +package ohos.hdi.bluetooth.lp_ble.v1_0; + +/** + * @brief Defines the message callback for the low power BLE module. + * + * Before enabling the low power BLE feature, you need to register this callback to report the information. + * For details, see {@link IBleInterface}. + * + * @since 5.0 + */ +[callback] interface IBleCallback { + /** + * @brief Called to report the message data sent by the controller. + * + * + * + * @param message Indicates the data report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] OnMessageCallback([in] unsigned char[] message); + + /** + * @brief Called to report the device list sent by the controller. + * + * + * + * @param deviceList Indicates the device list report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] OnDeviceListCallback([in] unsigned char[] deviceList); +} diff --git a/bluetooth/lp_ble/v1_0/IBleInterface.idl b/bluetooth/lp_ble/v1_0/IBleInterface.idl new file mode 100644 index 00000000..25be80bb --- /dev/null +++ b/bluetooth/lp_ble/v1_0/IBleInterface.idl @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 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 HdiBluetoothLpBle + * @{ + * + * @brief Provides APIs for the low power BLE service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IBleCallback.idl + * + * @brief Declares the callbacks for the low power BLE module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the low power BLE module interface package. + * + * @since 5.0 + */ +package ohos.hdi.bluetooth.lp_ble.v1_0; + +/** + * @brief Defines the message callback for the low power BLE module. + * + * @since 5.0 + */ +import ohos.hdi.bluetooth.lp_ble.v1_0.IBleCallback; + +/** + * @brief Defines the device callback for the low power BLE module. + * + * @since 5.0 + */ +import ohos.hdi.bluetooth.lp_ble.v1_0.IDeviceCallback; + +/** + * @brief Defines the wakeup message callback for the low power BLE module. + * + * @since 5.0 + */ +import ohos.hdi.bluetooth.lp_ble.v1_0.IWakeupCallback; + +interface IBleInterface { + /** + * @brief Send Ble parameters to controller. + * + * @param buff Indicates data send to controller. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SetBleParameters([in] unsigned char[] buff); + + /** + * @brief Registers Ble data report callback. + * Provide the callback routines to the hal. + * The cmd is used to determine whether to obtain messages or the device list. + * + * @param callbackObj Indicates the callback to register, which needs to be registered only once. + * @param cmd Indicates message or device list. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetBleBroadCastMessage([in] IBleCallback callbackObj, [in] int cmd); + + /** + * @brief Obtains Ble capability from controller. + * + * @return Returns ability. + * + * @since 5.0 + * @version 1.0 + */ + GetBleCapability(); + + /** + * @brief Registers callback to notify hal controller has reset. + * + * @param callbackObj Indicates handle to the IDeviceCallback. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RegisterDeviceResetCallback([in] IDeviceCallback callbackObj); + + /** + * @brief Registers callback to wakeup framework and send Message. + * + * @param callbackObj Indicates handle to the IWakeupCallback. + * @param cmd Indicates event. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RegisterWakeupCallback([in] IWakeupCallback callbackObj, [in] int cmd); + + /* + * @brief Registers callback to report error code. + * + * @param callbackObj handle to the IBleCallback + * @return ret 0 on success, others on failure + * + * @since 5.0 + * @version 1.0 + */ + RegisterErrorCodeCallback([in] IBleCallback callbackObj); +} diff --git a/bluetooth/lp_ble/v1_0/IDeviceCallback.idl b/bluetooth/lp_ble/v1_0/IDeviceCallback.idl new file mode 100644 index 00000000..2eedac72 --- /dev/null +++ b/bluetooth/lp_ble/v1_0/IDeviceCallback.idl @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 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 HdiBluetoothLpBle + * @{ + * + * @brief Provides APIs for the low power BLE service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IDeviceCallback.idl + * + * @brief Declares the callbacks for the low power BLE module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the low power BLE module interface package. + * + * @since 5.0 + */ +package ohos.hdi.bluetooth.lp_ble.v1_0; + +/** + * @brief Defines the device callback for the low power BLE module. + * + * Before enabling the low power BLE feature, you need to register this callback to report the information. + * For details, see {@link IBleInterface}. + * + * @since 5.0 + */ +[callback] interface IDeviceCallback { + /** + * @brief Called to report the device reset message sent by the controller. + * + * + * + * @param resetTag Indicates reset tag. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] OnDeviceResetCallback([in] unsigned int resetTag); +} diff --git a/bluetooth/lp_ble/v1_0/IWakeupCallback.idl b/bluetooth/lp_ble/v1_0/IWakeupCallback.idl new file mode 100644 index 00000000..ec3f4d35 --- /dev/null +++ b/bluetooth/lp_ble/v1_0/IWakeupCallback.idl @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 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 HdiBluetoothLpBle + * @{ + * + * @brief Provides APIs for the low power BLE service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IBleCallback.idl + * + * @brief Declares the callbacks for the low power BLE module. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Declares the path of the low power BLE module interface package. + * + * @since 5.0 + */ +package ohos.hdi.bluetooth.lp_ble.v1_0; + +/** + * @brief Defines the wakeup message callback for the low power BLE module. + * + * Before enabling the low power BLE feature, you need to register this callback to report the information. + * For details, see {@link IBleInterface}. + * + * @since 5.0 + */ +[callback] interface IWakeupCallback { + /** + * @brief Called to report the wakeup message sent by the controller. + * + * + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] OnWakeupCallback(); +} -- Gitee From 3d169142abb8735a393fb574406e4c623d58551a Mon Sep 17 00:00:00 2001 From: liufeng Date: Mon, 25 Mar 2024 17:28:49 +0800 Subject: [PATCH 128/210] =?UTF-8?q?=E4=B8=8B=E5=8F=91TAG=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/include/camera_metadata_item_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 39b97c28..6e217a3e 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -77,7 +77,7 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME [OHOS_ABILITY_MOON_CAPTURE_BOOST - OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMoonCaptureBoost", META_TYPE_UINT32, -1}, [OHOS_CONTROL_MOON_CAPTURE_BOOST - - OHOS_CAMERA_PROPERTIES_START] = {"cameraControlMoonCaptureBoost", META_TYPE_UINT32, 1}, + OHOS_CAMERA_PROPERTIES_START] = {"cameraControlMoonCaptureBoost", META_TYPE_BYTE, 1}, [OHOS_STATUS_MOON_CAPTURE_DETECTION - OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusMoonCaptureDetection", META_TYPE_UINT32, 1}, [OHOS_CAMERA_USER_ID - -- Gitee From 7a27cbefe54a3a8ac06031f9ecd0b47407817d31 Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 26 Mar 2024 10:52:18 +0800 Subject: [PATCH 129/210] update ops docs Signed-off-by: maoyong --- nnrt/v2_1/NnrtTypes.idl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nnrt/v2_1/NnrtTypes.idl b/nnrt/v2_1/NnrtTypes.idl index 5019b247..d0356ad6 100644 --- a/nnrt/v2_1/NnrtTypes.idl +++ b/nnrt/v2_1/NnrtTypes.idl @@ -355,6 +355,8 @@ enum NodeType : unsigned int { NODE_TYPE_FUSED_BATCH_NORM = 68, /** Gather operator. */ NODE_TYPE_GATHER = 69, + /** GatherNd operator. */ + NODE_TYPE_GATHER_ND = 70, /** Greater operator. */ NODE_TYPE_GREATER = 71, /** GreaterEqual operator. */ @@ -826,7 +828,9 @@ enum ReduceMode : byte { /** Use the sum of absolute values of all elements of a dimension to replace other elements of the dimension. */ REDUCE_MODE_ASUM = 6, /** Use the logical AND of all elements of a dimension to replace other elements of the dimension. */ - REDUCE_MODE_ALL = 7 + REDUCE_MODE_ALL = 7, + /** Use the L2-Normalization of all elements of a dimension to replace other elements of the dimension. */ + REDUCE_MODE_L2 = 8 }; /** -- Gitee From a07614eebc4e8a8bcd0edf6f07d43028c44e1609 Mon Sep 17 00:00:00 2001 From: zhanghang133 Date: Thu, 21 Mar 2024 22:08:02 +0800 Subject: [PATCH 130/210] =?UTF-8?q?=E7=9B=B8=E6=9C=BAHDI=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9F=AD=E8=A7=86=E9=A2=91=E6=B5=81=E5=92=8C=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=8B=8D=E7=85=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghang133 --- .../include/camera_device_ability_items.h | 14 +++ .../include/camera_metadata_item_info.h | 3 + camera/metadata/src/camera_metadata_info.cpp | 2 + camera/v1_3/Types.idl | 104 +++++++++--------- 4 files changed, 69 insertions(+), 54 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 47fc04d6..3cb40852 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -112,6 +112,7 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_MOON_CAPTURE_DETECTION, OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, + OHOS_ABILITY_MOVING_PHOTO, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, @@ -179,6 +180,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, + OHOS_CONTROL_MOVING_PHOTO, OHOS_DEVICE_CONTROL_END, // Camera device image acquisition related @@ -649,4 +651,16 @@ typedef enum camera_motion_detection_control_type { OHOS_CAMERA_MOTION_DETECTION_ENABLE, } camera_motion_detection_control_type_t; +// OHOS_ABILITY_MOVING_PHOTO +typedef enum moving_photo_enum { + OHOS_CAMERA_MOVING_PHOTO_UNSUPPORT = 0, + OHOS_CAMERA_MOVING_PHOTO_SUPPORT, +} moving_photo_enum_t; + +// OHOS_CONTROL_MOVING_PHOTO +typedef enum control_moving_photo_enum { + OHOS_CAMERA_MOVING_PHOTO_OFF = 0, + OHOS_CAMERA_MOVING_PHOTO_ON, +} control_moving_photo_enum_t; + #endif diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index a8f2a2e0..fc04f524 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -86,6 +86,8 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"captureDurationSupported", META_TYPE_BYTE, 1}, [OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION - OHOS_CAMERA_PROPERTIES_START] = {"customSnapshotDuration", META_TYPE_UINT32, 1}, + [OHOS_ABILITY_MOVING_PHOTO - + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMovingPhoto", META_TYPE_INT32, -1}, }; static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { @@ -176,6 +178,7 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON [OHOS_CONTROL_SENSOR_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"sensorExposureTime", META_TYPE_RATIONAL, 1}, [OHOS_STATUS_SENSOR_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"currentSensorExposureTime", META_TYPE_RATIONAL, 1}, + [OHOS_CONTROL_MOVING_PHOTO - OHOS_DEVICE_CONTROL_START] = {"movingPhoto", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosDeviceExposure[OHOS_DEVICE_EXPOSURE_END - OHOS_DEVICE_EXPOSURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index dda0d707..18b59f2c 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -44,6 +44,7 @@ const std::vector g_metadataTags = { OHOS_STATUS_MOON_CAPTURE_DETECTION, OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, + OHOS_ABILITY_MOVING_PHOTO, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, @@ -103,6 +104,7 @@ const std::vector g_metadataTags = { OHOS_ABILTY_SENSOR_EXPOSURE_TIME_RANGE, OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, + OHOS_CONTROL_MOVING_PHOTO, // Camera device image acquisition related OHOS_ABILITY_DEVICE_AVAILABLE_EXPOSUREMODES, diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index a8dec875..925e29e6 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -19,7 +19,7 @@ * @brief Declares data types * used by the Hardware Driver Interfaces (HDIs) of this module. * - * @since 5.0 + * @since 3.2 * @version 1.3 */ @@ -32,104 +32,100 @@ sequenceable ohos.hdi.camera.v1_0.MapDataSequenceable; /** * @brief Enumerates stream operation modes. + * @since 3.2 + * @version 1.3 */ -enum OperationMode_V1_3 { - /** - * Normal mode, which supports both photo and video scenes - */ - NORMAL = 0, +enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { /** - * Capture mode, which dedicated to photo scene - * IF this mode is implemented, then the NORMAL mode should no longer be implemented + * Professional mode, which dedicated to professional photo scene + * Abandoned, use the new operationMode below */ - CAPTURE = 1, + PROFESSIONAL_V1_3 = PROFESSIONAL, /** - * Video mode, which dedicated to video secne - * IF this mode is implemented, then the NORMAL mode should no longer be implemented + * Professional mode, which dedicated to capture code */ - VIDEO = 2, + PROFESSIONAL_PHOTO = 11, /** - * Portrait mode, which dedicated to portrait photo secne + * Professional mode, which dedicated to video code */ - PORTRAIT = 3, + PROFESSIONAL_VIDEO = 12, /** - * Night mode, which dedicated to night shooting scene + * Slow motion mode, which dedicated to video recording slow motion */ - NIGHT = 4, + HIGH_FRAME_RATE = 13, +}; - /** - * Professional mode, which dedicated to professional photo scene - * Abandoned, use the new operationMode below - */ - PROFESSIONAL = 5, +/** + * @brief Enumerates types of the extended stream information. + * @since 4.0 + * @version 1.2 + */ +enum ExtendedStreamInfoType : ohos.hdi.camera.v1_2.ExtendedStreamInfoType_V1_2 { /** - * Slow motion mode, which dedicated to capturing slow motion + * Slow motion mode, which dedicated to video recording slow motion */ - SLOW_MOTION = 6, + EXTENDED_STREAM_INFO_RAW = 2, /** - * Scan mode, which dedicated to scan code + * Extended stream information of depth. */ - SCAN_CODE = 7, + EXTENDED_STREAM_INFO_DEPTH = 3, /** - * Macro mode, which dedicated to capture code + * Extended stream information of meta. */ - CAPTURE_MACRO = 8, - + EXTENDED_STREAM_INFO_META = 4, + /** - * Macro mode, which dedicated to video code + * Extended stream information of secure. */ - VIDEO_MACRO = 9, + EXTENDED_STREAM_INFO_SECURE = 5, +}; - /** - * Super stabilization mode, which dedicated to use Suprt stabilization mode - */ - SUPER_STAB = 10, +/** + * @brief Enumerates stream types. + * @since 5.0 + * @version 1.0 + */ +enum StreamType { /** - * Professional mode, which dedicated to capture code + * Preview streams, indicating that stream data is used for preview */ - PROFESSIONAL_PHOTO = 11, + STREAM_TYPE_PREVIEW = 0, /** - * Professional mode, which dedicated to video code + * Video streams, indicating that stream data is used to encode and generate videos */ - PROFESSIONAL_VIDEO = 12, + STREAM_TYPE_VIDEO = 1, /** - * Slow motion mode, which dedicated to video recording slow motion + * Photographing streams, indicating that stream data is used to encode and generate images */ - HIGH_FRAME_RATE = 13, + STREAM_TYPE_STILL_CAPTURE = 2, /** - * Operation mode max + * Stream data that is used to store thumbnails */ - OPERATION_MODE_MAX, -}; + STREAM_TYPE_POST_VIEW = 3, -/** - * @brief Enumerates types of the extended stream information. - */ -enum ExtendedStreamInfoType { /** - * Extended stream information of quick thumbnail. + * Stream data that is used for image analysis */ - EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, + STREAM_TYPE_ANALYZE = 4, /** - * Extended stream information of sketch. + * Custom type */ - EXTENDED_STREAM_INFO_SKETCH = 1, + STREAM_TYPE_CUSTOM = 5, /** - * Extended stream information of raw. + * Depth type */ - EXTENDED_STREAM_INFO_RAW = 2, + STREAM_TYPE_DEPTH = 6, }; - -- Gitee From c15ada0da0087a31c910fd348ebfec1be1d7c7f7 Mon Sep 17 00:00:00 2001 From: yiyajun Date: Tue, 26 Mar 2024 09:33:44 +0800 Subject: [PATCH 131/210] add wifi hal interface Signed-off-by: yiyajun --- wlan/bundle.json | 25 ++++++ wlan/chip/v1_0/BUILD.gn | 39 +++++++++ wlan/chip/v1_0/IWifi.idl | 34 ++++++++ wlan/chip/v1_0/IWifiChip.idl | 58 +++++++++++++ wlan/chip/v1_0/IWifiChipEventCallback.idl | 20 +++++ wlan/chip/v1_0/IWifiEventCallback.idl | 22 +++++ wlan/chip/v1_0/IWifiIface.idl | 28 ++++++ wlan/chip/v1_0/WlanTypesCommon.idl | 101 ++++++++++++++++++++++ 8 files changed, 327 insertions(+) create mode 100644 wlan/chip/v1_0/BUILD.gn create mode 100644 wlan/chip/v1_0/IWifi.idl create mode 100644 wlan/chip/v1_0/IWifiChip.idl create mode 100644 wlan/chip/v1_0/IWifiChipEventCallback.idl create mode 100644 wlan/chip/v1_0/IWifiEventCallback.idl create mode 100644 wlan/chip/v1_0/IWifiIface.idl create mode 100644 wlan/chip/v1_0/WlanTypesCommon.idl diff --git a/wlan/bundle.json b/wlan/bundle.json index 4ea55b17..fc2b1060 100644 --- a/wlan/bundle.json +++ b/wlan/bundle.json @@ -26,6 +26,7 @@ }, "build": { "sub_component": [ + "//drivers/interface/wlan/chip/v1_0:chip", "//drivers/interface/wlan/v1_1:wlan_idl_target", "//drivers/interface/wlan/v1_2:wlan_idl_target", "//drivers/interface/wlan/v1_3:wlan_idl_target", @@ -154,6 +155,30 @@ ], "header_base": "//drivers/interface/wlan/hostapd" } + }, + { + "name": "//drivers/interface/wlan/chip/v1_0:libchip_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/chip" + } + }, + { + "name": "//drivers/interface/wlan/chip/v1_0:chip_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/chip" + } + }, + { + "name": "//drivers/interface/wlan/chip/v1_0:libchip_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/wlan/chip" + } } ] } diff --git a/wlan/chip/v1_0/BUILD.gn b/wlan/chip/v1_0/BUILD.gn new file mode 100644 index 00000000..2b61f26d --- /dev/null +++ b/wlan/chip/v1_0/BUILD.gn @@ -0,0 +1,39 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libchip_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("chip") { + module_name = "chip" + + sources = [ + "IWifi.idl", + "WlanTypesCommon.idl", + "IWifiEventCallback.idl", + "IWifiChip.idl", + "IWifiChipEventCallback.idl", + "IWifiIface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_wlan" + } +} \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifi.idl b/wlan/chip/v1_0/IWifi.idl new file mode 100644 index 00000000..9882e2f3 --- /dev/null +++ b/wlan/chip/v1_0/IWifi.idl @@ -0,0 +1,34 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; +import ohos.hdi.wlan.chip.v1_0.IWifiEventCallback; +import ohos.hdi.wlan.chip.v1_0.IWifiChip; + +interface IWifi { + RegisterWifiEventCallback([in] IWifiEventCallback eventCallback); + + IsInit([out] boolean started); + + Init(); + + Release(); + + GetAvailableChips([out] unsigned int[] chipIds); + + GetChipService([in] unsigned int chipId, [out] IWifiChip chip); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiChip.idl b/wlan/chip/v1_0/IWifiChip.idl new file mode 100644 index 00000000..fa0b27fb --- /dev/null +++ b/wlan/chip/v1_0/IWifiChip.idl @@ -0,0 +1,58 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; +import ohos.hdi.wlan.chip.v1_0.IWifiIface; +import ohos.hdi.wlan.chip.v1_0.IWifiChipEventCallback; + +interface IWifiChip { + GetChipId([out] int id); + + RegisterWifiEventCallback([in] IWifiChipEventCallback chipEventcallback); + + GetIfaceCap([out] unsigned int capabilities); + + GetAvailableModes([out] struct ChipMode[] modes); + + GetCurrentMode([out] unsigned int modeId); + + CreateApIface([out] IWifiIface iface); + + GetApIfaceNames([out] String[] ifnames); + + GetApIface([in] String ifname, [out] IWifiIface iface); + + RemoveApIface([in] String ifname); + + CreateP2pIface([out] IWifiIface iface); + + GetP2pIfaceNames([out] String[] ifnames); + + GetP2pIface([in] String ifname, [out] IWifiIface iface); + + RemoveP2pIface([in] String ifname); + + CreateStaIface([out] IWifiIface iface); + + GetStaIfaceNames([out] String[] ifnames); + + GetStaIface([in] String ifname, [out] IWifiIface iface); + + RemoveStaIface([in] String ifname); + + SetChipMode([in] unsigned int modeId); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiChipEventCallback.idl b/wlan/chip/v1_0/IWifiChipEventCallback.idl new file mode 100644 index 00000000..669d89f2 --- /dev/null +++ b/wlan/chip/v1_0/IWifiChipEventCallback.idl @@ -0,0 +1,20 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; + +[callback] interface IWifiChipEventCallback {}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiEventCallback.idl b/wlan/chip/v1_0/IWifiEventCallback.idl new file mode 100644 index 00000000..cd9b4868 --- /dev/null +++ b/wlan/chip/v1_0/IWifiEventCallback.idl @@ -0,0 +1,22 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; + +[callback] interface IWifiEventCallback { + [oneway] OnSubsystemRestart([in] WifiStatus status); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiIface.idl b/wlan/chip/v1_0/IWifiIface.idl new file mode 100644 index 00000000..acf0a87b --- /dev/null +++ b/wlan/chip/v1_0/IWifiIface.idl @@ -0,0 +1,28 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; + +interface IWifiIface { + GetIfaceType([out] enum IfaceType type); + + GetIfaceName([out] String name); + + GetIfaceCap([out] unsigned int capabilities); + + GetSupportFreqs([in] enum WifiBand band, [out] unsigned int[] frequencies); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/WlanTypesCommon.idl b/wlan/chip/v1_0/WlanTypesCommon.idl new file mode 100644 index 00000000..8d42d15e --- /dev/null +++ b/wlan/chip/v1_0/WlanTypesCommon.idl @@ -0,0 +1,101 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +enum WifiStatusCode : int{ + SUCCESS, + ERROR_WIFI_CHIP_INVALID, + ERROR_WIFI_IFACE_INVALID, + ERROR_WIFI_RTT_CONTROLLER_INVALID, + ERROR_NOT_SUPPORTED, + ERROR_NOT_AVAILABLE, + ERROR_NOT_STARTED, + ERROR_INVALID_ARGS, + ERROR_BUSY, + ERROR_UNKNOWN +}; + +struct WifiStatus { + WifiStatusCode code; + String description; +}; + +enum IfaceType : unsigned int { + STA, + AP, + P2P, + NANIFACE, +}; + +struct ChipIfaceCombinationLimit { + enum IfaceType[] types; //Each IfaceType must occur at most once. + unsigned int maxIfaces; +}; + +struct ChipIfaceCombination { + struct ChipIfaceCombinationLimit[] limits; +}; + +struct ChipMode { + unsigned int id; + struct ChipIfaceCombination[] availableCombinations; +}; + +enum WifiBand : unsigned int { + BAND_UNSPECIFIED = 0, + BAND_24GHZ = 1, + BAND_5GHZ = 2, + BAND_5GHZ_DFS = 4, + BAND_5GHZ_WITH_DFS = 6, + BAND_24GHZ_5GHZ = 3,/ + BAND_24GHZ_5GHZ_WITH_DFS = 7 +}; + +enum ChipCapabilityMask : unsigned int { + DEBUG_MEMORY_FIRMWARE_DUMP = 1 << 0, + DEBUG_MEMORY_DRIVER_DUMP = 1 << 1, + DEBUG_RING_BUFFER_CONNECT_EVENT = 1 << 2, + DEBUG_RING_BUFFER_POWER_EVENT = 1 << 3, + DEBUG_RING_BUFFER_WAKELOCK_EVENT = 1 << 4, + DEBUG_RING_BUFFER_VENDOR_DATA = 1 << 5, + DEBUG_HOST_WAKE_REASON_STATS = 1 << 6, + DEBUG_ERROR_ALERTS = 1 << 7, + SET_TX_POWER_LIMIT = 1 << 8, + D2D_RTT = 1 << 9, + D2AP_RTT = 1 << 10, + USE_BODY_HEAD_SAR = 1 << 11, + SET_LATENCY_MODE = 1 << 12, + P2P_RAND_MAC = 1 << 13, + WIGIG = 1 << 14 +}; + +enum StaIfaceCapabilityMask : unsigned int { + APF = 1 << 0, + BACKGROUND_SCAN = 1 << 1, + LINK_LAYER_STATS = 1 << 2, + RSSI_MONITOR = 1 << 3, + CONTROL_ROAMING = 1 << 4, + PROBE_IE_WHITELIST = 1 << 5, + SCAN_RAND = 1 << 6, + STA_5G = 1 << 7, + HOTSPOT = 1 << 8, + PNO = 1 << 9, + TDLS = 1 << 10, + TDLS_OFFCHANNEL= 1 << 11, + ND_OFFLOAD = 1 << 12, + KEEP_ALIVE = 1 << 13, + DEBUG_PACKET_FATE = 1 << 14 +}; \ No newline at end of file -- Gitee From 309d239a73bb685e10417aeafccd266407f655a2 Mon Sep 17 00:00:00 2001 From: yiyajun Date: Tue, 26 Mar 2024 21:02:12 +0800 Subject: [PATCH 132/210] hal Signed-off-by: yiyajun --- wlan/chip/v1_0/BUILD.gn | 38 ++++---- wlan/chip/v1_0/ChipTypes.idl | 101 +++++++++++++++++++++ wlan/chip/v1_0/IChipController.idl | 34 +++++++ wlan/chip/v1_0/IChipControllerCallback.idl | 22 +++++ wlan/chip/v1_0/IChipIface.idl | 28 ++++++ wlan/chip/v1_0/IConcreteChip.idl | 58 ++++++++++++ wlan/chip/v1_0/IConcreteChipCallback.idl | 20 ++++ 7 files changed, 281 insertions(+), 20 deletions(-) create mode 100644 wlan/chip/v1_0/ChipTypes.idl create mode 100644 wlan/chip/v1_0/IChipController.idl create mode 100644 wlan/chip/v1_0/IChipControllerCallback.idl create mode 100644 wlan/chip/v1_0/IChipIface.idl create mode 100644 wlan/chip/v1_0/IConcreteChip.idl create mode 100644 wlan/chip/v1_0/IConcreteChipCallback.idl diff --git a/wlan/chip/v1_0/BUILD.gn b/wlan/chip/v1_0/BUILD.gn index 2b61f26d..4b59453e 100644 --- a/wlan/chip/v1_0/BUILD.gn +++ b/wlan/chip/v1_0/BUILD.gn @@ -1,17 +1,15 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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. - */ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") if (defined(ohos_lite)) { @@ -24,12 +22,12 @@ if (defined(ohos_lite)) { module_name = "chip" sources = [ - "IWifi.idl", - "WlanTypesCommon.idl", - "IWifiEventCallback.idl", - "IWifiChip.idl", - "IWifiChipEventCallback.idl", - "IWifiIface.idl", + "IChipController.idl", + "ChipTypes.idl", + "IConcreteChipCallback.idl", + "IConcreteChip.idl", + "IChipControllerCallback.idl", + "IChipIface.idl", ] language = "cpp" diff --git a/wlan/chip/v1_0/ChipTypes.idl b/wlan/chip/v1_0/ChipTypes.idl new file mode 100644 index 00000000..8d42d15e --- /dev/null +++ b/wlan/chip/v1_0/ChipTypes.idl @@ -0,0 +1,101 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +enum WifiStatusCode : int{ + SUCCESS, + ERROR_WIFI_CHIP_INVALID, + ERROR_WIFI_IFACE_INVALID, + ERROR_WIFI_RTT_CONTROLLER_INVALID, + ERROR_NOT_SUPPORTED, + ERROR_NOT_AVAILABLE, + ERROR_NOT_STARTED, + ERROR_INVALID_ARGS, + ERROR_BUSY, + ERROR_UNKNOWN +}; + +struct WifiStatus { + WifiStatusCode code; + String description; +}; + +enum IfaceType : unsigned int { + STA, + AP, + P2P, + NANIFACE, +}; + +struct ChipIfaceCombinationLimit { + enum IfaceType[] types; //Each IfaceType must occur at most once. + unsigned int maxIfaces; +}; + +struct ChipIfaceCombination { + struct ChipIfaceCombinationLimit[] limits; +}; + +struct ChipMode { + unsigned int id; + struct ChipIfaceCombination[] availableCombinations; +}; + +enum WifiBand : unsigned int { + BAND_UNSPECIFIED = 0, + BAND_24GHZ = 1, + BAND_5GHZ = 2, + BAND_5GHZ_DFS = 4, + BAND_5GHZ_WITH_DFS = 6, + BAND_24GHZ_5GHZ = 3,/ + BAND_24GHZ_5GHZ_WITH_DFS = 7 +}; + +enum ChipCapabilityMask : unsigned int { + DEBUG_MEMORY_FIRMWARE_DUMP = 1 << 0, + DEBUG_MEMORY_DRIVER_DUMP = 1 << 1, + DEBUG_RING_BUFFER_CONNECT_EVENT = 1 << 2, + DEBUG_RING_BUFFER_POWER_EVENT = 1 << 3, + DEBUG_RING_BUFFER_WAKELOCK_EVENT = 1 << 4, + DEBUG_RING_BUFFER_VENDOR_DATA = 1 << 5, + DEBUG_HOST_WAKE_REASON_STATS = 1 << 6, + DEBUG_ERROR_ALERTS = 1 << 7, + SET_TX_POWER_LIMIT = 1 << 8, + D2D_RTT = 1 << 9, + D2AP_RTT = 1 << 10, + USE_BODY_HEAD_SAR = 1 << 11, + SET_LATENCY_MODE = 1 << 12, + P2P_RAND_MAC = 1 << 13, + WIGIG = 1 << 14 +}; + +enum StaIfaceCapabilityMask : unsigned int { + APF = 1 << 0, + BACKGROUND_SCAN = 1 << 1, + LINK_LAYER_STATS = 1 << 2, + RSSI_MONITOR = 1 << 3, + CONTROL_ROAMING = 1 << 4, + PROBE_IE_WHITELIST = 1 << 5, + SCAN_RAND = 1 << 6, + STA_5G = 1 << 7, + HOTSPOT = 1 << 8, + PNO = 1 << 9, + TDLS = 1 << 10, + TDLS_OFFCHANNEL= 1 << 11, + ND_OFFLOAD = 1 << 12, + KEEP_ALIVE = 1 << 13, + DEBUG_PACKET_FATE = 1 << 14 +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipController.idl b/wlan/chip/v1_0/IChipController.idl new file mode 100644 index 00000000..1a40fb63 --- /dev/null +++ b/wlan/chip/v1_0/IChipController.idl @@ -0,0 +1,34 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.ChipTypes; +import ohos.hdi.wlan.chip.v1_0.IChipControllerCallback; +import ohos.hdi.wlan.chip.v1_0.IConcreteChip; + +interface IChipController { + RegisterWifiEventCallback([in] IChipControllerCallback eventCallback); + + IsInit([out] boolean started); + + Init(); + + Release(); + + GetAvailableChips([out] unsigned int[] chipIds); + + GetChipService([in] unsigned int chipId, [out] IConcreteChip chip); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipControllerCallback.idl b/wlan/chip/v1_0/IChipControllerCallback.idl new file mode 100644 index 00000000..a12b342c --- /dev/null +++ b/wlan/chip/v1_0/IChipControllerCallback.idl @@ -0,0 +1,22 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.ChipTypes; + +[callback] interface IChipControllerCallback { + [oneway] OnSubsystemRestart([in] WifiStatus status); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipIface.idl b/wlan/chip/v1_0/IChipIface.idl new file mode 100644 index 00000000..a37caa32 --- /dev/null +++ b/wlan/chip/v1_0/IChipIface.idl @@ -0,0 +1,28 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.ChipTypes; + +interface IChipIface { + GetIfaceType([out] enum IfaceType type); + + GetIfaceName([out] String name); + + GetIfaceCap([out] unsigned int capabilities); + + GetSupportFreqs([in] enum WifiBand band, [out] unsigned int[] frequencies); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IConcreteChip.idl b/wlan/chip/v1_0/IConcreteChip.idl new file mode 100644 index 00000000..c0e35974 --- /dev/null +++ b/wlan/chip/v1_0/IConcreteChip.idl @@ -0,0 +1,58 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.ChipTypes; +import ohos.hdi.wlan.chip.v1_0.IChipIface; +import ohos.hdi.wlan.chip.v1_0.IConcreteChipCallback; + +interface IConcreteChip { + GetChipId([out] int id); + + RegisterWifiEventCallback([in] IConcreteChipCallback chipEventcallback); + + GetIfaceCap([out] unsigned int capabilities); + + GetAvailableModes([out] struct ChipMode[] modes); + + GetCurrentMode([out] unsigned int modeId); + + CreateApIface([out] IChipIface iface); + + GetApIfaceNames([out] String[] ifnames); + + GetApIface([in] String ifname, [out] IChipIface iface); + + RemoveApIface([in] String ifname); + + CreateP2pIface([out] IChipIface iface); + + GetP2pIfaceNames([out] String[] ifnames); + + GetP2pIface([in] String ifname, [out] IChipIface iface); + + RemoveP2pIface([in] String ifname); + + CreateStaIface([out] IChipIface iface); + + GetStaIfaceNames([out] String[] ifnames); + + GetStaIface([in] String ifname, [out] IChipIface iface); + + RemoveStaIface([in] String ifname); + + SetChipMode([in] unsigned int modeId); +}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IConcreteChipCallback.idl b/wlan/chip/v1_0/IConcreteChipCallback.idl new file mode 100644 index 00000000..7842900c --- /dev/null +++ b/wlan/chip/v1_0/IConcreteChipCallback.idl @@ -0,0 +1,20 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * 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.wlan.chip.v1_0; + +import ohos.hdi.wlan.chip.v1_0.ChipTypes; + +[callback] interface IConcreteChipCallback {}; \ No newline at end of file -- Gitee From d9df632c091b54fe4137f9cf83b8b28b927064db Mon Sep 17 00:00:00 2001 From: yiyajun Date: Tue, 26 Mar 2024 21:07:16 +0800 Subject: [PATCH 133/210] hal Signed-off-by: yiyajun --- wlan/chip/v1_0/ChipTypes.idl | 2 +- wlan/chip/v1_0/IChipController.idl | 2 +- wlan/chip/v1_0/IChipControllerCallback.idl | 2 +- wlan/chip/v1_0/IChipIface.idl | 2 +- wlan/chip/v1_0/IConcreteChip.idl | 2 +- wlan/chip/v1_0/IConcreteChipCallback.idl | 2 +- wlan/chip/v1_0/IWifi.idl | 34 ------- wlan/chip/v1_0/IWifiChip.idl | 58 ------------ wlan/chip/v1_0/IWifiChipEventCallback.idl | 20 ---- wlan/chip/v1_0/IWifiEventCallback.idl | 22 ----- wlan/chip/v1_0/IWifiIface.idl | 28 ------ wlan/chip/v1_0/WlanTypesCommon.idl | 101 --------------------- 12 files changed, 6 insertions(+), 269 deletions(-) delete mode 100644 wlan/chip/v1_0/IWifi.idl delete mode 100644 wlan/chip/v1_0/IWifiChip.idl delete mode 100644 wlan/chip/v1_0/IWifiChipEventCallback.idl delete mode 100644 wlan/chip/v1_0/IWifiEventCallback.idl delete mode 100644 wlan/chip/v1_0/IWifiIface.idl delete mode 100644 wlan/chip/v1_0/WlanTypesCommon.idl diff --git a/wlan/chip/v1_0/ChipTypes.idl b/wlan/chip/v1_0/ChipTypes.idl index 8d42d15e..08c3ce7a 100644 --- a/wlan/chip/v1_0/ChipTypes.idl +++ b/wlan/chip/v1_0/ChipTypes.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2024 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 diff --git a/wlan/chip/v1_0/IChipController.idl b/wlan/chip/v1_0/IChipController.idl index 1a40fb63..c2dbf56b 100644 --- a/wlan/chip/v1_0/IChipController.idl +++ b/wlan/chip/v1_0/IChipController.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2023 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 diff --git a/wlan/chip/v1_0/IChipControllerCallback.idl b/wlan/chip/v1_0/IChipControllerCallback.idl index a12b342c..f09b001e 100644 --- a/wlan/chip/v1_0/IChipControllerCallback.idl +++ b/wlan/chip/v1_0/IChipControllerCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2023 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 diff --git a/wlan/chip/v1_0/IChipIface.idl b/wlan/chip/v1_0/IChipIface.idl index a37caa32..0137f289 100644 --- a/wlan/chip/v1_0/IChipIface.idl +++ b/wlan/chip/v1_0/IChipIface.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2023 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 diff --git a/wlan/chip/v1_0/IConcreteChip.idl b/wlan/chip/v1_0/IConcreteChip.idl index c0e35974..aad33245 100644 --- a/wlan/chip/v1_0/IConcreteChip.idl +++ b/wlan/chip/v1_0/IConcreteChip.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2023 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 diff --git a/wlan/chip/v1_0/IConcreteChipCallback.idl b/wlan/chip/v1_0/IConcreteChipCallback.idl index 7842900c..82162f07 100644 --- a/wlan/chip/v1_0/IConcreteChipCallback.idl +++ b/wlan/chip/v1_0/IConcreteChipCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved + * Copyright (c) 2023 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 diff --git a/wlan/chip/v1_0/IWifi.idl b/wlan/chip/v1_0/IWifi.idl deleted file mode 100644 index 9882e2f3..00000000 --- a/wlan/chip/v1_0/IWifi.idl +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; -import ohos.hdi.wlan.chip.v1_0.IWifiEventCallback; -import ohos.hdi.wlan.chip.v1_0.IWifiChip; - -interface IWifi { - RegisterWifiEventCallback([in] IWifiEventCallback eventCallback); - - IsInit([out] boolean started); - - Init(); - - Release(); - - GetAvailableChips([out] unsigned int[] chipIds); - - GetChipService([in] unsigned int chipId, [out] IWifiChip chip); -}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiChip.idl b/wlan/chip/v1_0/IWifiChip.idl deleted file mode 100644 index fa0b27fb..00000000 --- a/wlan/chip/v1_0/IWifiChip.idl +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; -import ohos.hdi.wlan.chip.v1_0.IWifiIface; -import ohos.hdi.wlan.chip.v1_0.IWifiChipEventCallback; - -interface IWifiChip { - GetChipId([out] int id); - - RegisterWifiEventCallback([in] IWifiChipEventCallback chipEventcallback); - - GetIfaceCap([out] unsigned int capabilities); - - GetAvailableModes([out] struct ChipMode[] modes); - - GetCurrentMode([out] unsigned int modeId); - - CreateApIface([out] IWifiIface iface); - - GetApIfaceNames([out] String[] ifnames); - - GetApIface([in] String ifname, [out] IWifiIface iface); - - RemoveApIface([in] String ifname); - - CreateP2pIface([out] IWifiIface iface); - - GetP2pIfaceNames([out] String[] ifnames); - - GetP2pIface([in] String ifname, [out] IWifiIface iface); - - RemoveP2pIface([in] String ifname); - - CreateStaIface([out] IWifiIface iface); - - GetStaIfaceNames([out] String[] ifnames); - - GetStaIface([in] String ifname, [out] IWifiIface iface); - - RemoveStaIface([in] String ifname); - - SetChipMode([in] unsigned int modeId); -}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiChipEventCallback.idl b/wlan/chip/v1_0/IWifiChipEventCallback.idl deleted file mode 100644 index 669d89f2..00000000 --- a/wlan/chip/v1_0/IWifiChipEventCallback.idl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; - -[callback] interface IWifiChipEventCallback {}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiEventCallback.idl b/wlan/chip/v1_0/IWifiEventCallback.idl deleted file mode 100644 index cd9b4868..00000000 --- a/wlan/chip/v1_0/IWifiEventCallback.idl +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; - -[callback] interface IWifiEventCallback { - [oneway] OnSubsystemRestart([in] WifiStatus status); -}; \ No newline at end of file diff --git a/wlan/chip/v1_0/IWifiIface.idl b/wlan/chip/v1_0/IWifiIface.idl deleted file mode 100644 index acf0a87b..00000000 --- a/wlan/chip/v1_0/IWifiIface.idl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -import ohos.hdi.wlan.chip.v1_0.WlanTypesCommon; - -interface IWifiIface { - GetIfaceType([out] enum IfaceType type); - - GetIfaceName([out] String name); - - GetIfaceCap([out] unsigned int capabilities); - - GetSupportFreqs([in] enum WifiBand band, [out] unsigned int[] frequencies); -}; \ No newline at end of file diff --git a/wlan/chip/v1_0/WlanTypesCommon.idl b/wlan/chip/v1_0/WlanTypesCommon.idl deleted file mode 100644 index 8d42d15e..00000000 --- a/wlan/chip/v1_0/WlanTypesCommon.idl +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved - * 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.wlan.chip.v1_0; - -enum WifiStatusCode : int{ - SUCCESS, - ERROR_WIFI_CHIP_INVALID, - ERROR_WIFI_IFACE_INVALID, - ERROR_WIFI_RTT_CONTROLLER_INVALID, - ERROR_NOT_SUPPORTED, - ERROR_NOT_AVAILABLE, - ERROR_NOT_STARTED, - ERROR_INVALID_ARGS, - ERROR_BUSY, - ERROR_UNKNOWN -}; - -struct WifiStatus { - WifiStatusCode code; - String description; -}; - -enum IfaceType : unsigned int { - STA, - AP, - P2P, - NANIFACE, -}; - -struct ChipIfaceCombinationLimit { - enum IfaceType[] types; //Each IfaceType must occur at most once. - unsigned int maxIfaces; -}; - -struct ChipIfaceCombination { - struct ChipIfaceCombinationLimit[] limits; -}; - -struct ChipMode { - unsigned int id; - struct ChipIfaceCombination[] availableCombinations; -}; - -enum WifiBand : unsigned int { - BAND_UNSPECIFIED = 0, - BAND_24GHZ = 1, - BAND_5GHZ = 2, - BAND_5GHZ_DFS = 4, - BAND_5GHZ_WITH_DFS = 6, - BAND_24GHZ_5GHZ = 3,/ - BAND_24GHZ_5GHZ_WITH_DFS = 7 -}; - -enum ChipCapabilityMask : unsigned int { - DEBUG_MEMORY_FIRMWARE_DUMP = 1 << 0, - DEBUG_MEMORY_DRIVER_DUMP = 1 << 1, - DEBUG_RING_BUFFER_CONNECT_EVENT = 1 << 2, - DEBUG_RING_BUFFER_POWER_EVENT = 1 << 3, - DEBUG_RING_BUFFER_WAKELOCK_EVENT = 1 << 4, - DEBUG_RING_BUFFER_VENDOR_DATA = 1 << 5, - DEBUG_HOST_WAKE_REASON_STATS = 1 << 6, - DEBUG_ERROR_ALERTS = 1 << 7, - SET_TX_POWER_LIMIT = 1 << 8, - D2D_RTT = 1 << 9, - D2AP_RTT = 1 << 10, - USE_BODY_HEAD_SAR = 1 << 11, - SET_LATENCY_MODE = 1 << 12, - P2P_RAND_MAC = 1 << 13, - WIGIG = 1 << 14 -}; - -enum StaIfaceCapabilityMask : unsigned int { - APF = 1 << 0, - BACKGROUND_SCAN = 1 << 1, - LINK_LAYER_STATS = 1 << 2, - RSSI_MONITOR = 1 << 3, - CONTROL_ROAMING = 1 << 4, - PROBE_IE_WHITELIST = 1 << 5, - SCAN_RAND = 1 << 6, - STA_5G = 1 << 7, - HOTSPOT = 1 << 8, - PNO = 1 << 9, - TDLS = 1 << 10, - TDLS_OFFCHANNEL= 1 << 11, - ND_OFFLOAD = 1 << 12, - KEEP_ALIVE = 1 << 13, - DEBUG_PACKET_FATE = 1 << 14 -}; \ No newline at end of file -- Gitee From 95eb61d43c83eb3262ee428957508898c008a1c5 Mon Sep 17 00:00:00 2001 From: yiyajun Date: Tue, 26 Mar 2024 21:08:20 +0800 Subject: [PATCH 134/210] hal Signed-off-by: yiyajun --- wlan/chip/v1_0/BUILD.gn | 6 +++--- wlan/chip/v1_0/ChipTypes.idl | 2 +- wlan/chip/v1_0/IChipController.idl | 2 +- wlan/chip/v1_0/IChipControllerCallback.idl | 2 +- wlan/chip/v1_0/IChipIface.idl | 2 +- wlan/chip/v1_0/IConcreteChip.idl | 2 +- wlan/chip/v1_0/IConcreteChipCallback.idl | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wlan/chip/v1_0/BUILD.gn b/wlan/chip/v1_0/BUILD.gn index 4b59453e..04c8d3ab 100644 --- a/wlan/chip/v1_0/BUILD.gn +++ b/wlan/chip/v1_0/BUILD.gn @@ -22,12 +22,12 @@ if (defined(ohos_lite)) { module_name = "chip" sources = [ - "IChipController.idl", "ChipTypes.idl", - "IConcreteChipCallback.idl", - "IConcreteChip.idl", + "IChipController.idl", "IChipControllerCallback.idl", "IChipIface.idl", + "IConcreteChip.idl", + "IConcreteChipCallback.idl", ] language = "cpp" diff --git a/wlan/chip/v1_0/ChipTypes.idl b/wlan/chip/v1_0/ChipTypes.idl index 08c3ce7a..6a4e51ed 100644 --- a/wlan/chip/v1_0/ChipTypes.idl +++ b/wlan/chip/v1_0/ChipTypes.idl @@ -60,7 +60,7 @@ enum WifiBand : unsigned int { BAND_5GHZ = 2, BAND_5GHZ_DFS = 4, BAND_5GHZ_WITH_DFS = 6, - BAND_24GHZ_5GHZ = 3,/ + BAND_24GHZ_5GHZ = 3, BAND_24GHZ_5GHZ_WITH_DFS = 7 }; diff --git a/wlan/chip/v1_0/IChipController.idl b/wlan/chip/v1_0/IChipController.idl index c2dbf56b..261837d9 100644 --- a/wlan/chip/v1_0/IChipController.idl +++ b/wlan/chip/v1_0/IChipController.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/wlan/chip/v1_0/IChipControllerCallback.idl b/wlan/chip/v1_0/IChipControllerCallback.idl index f09b001e..f072988c 100644 --- a/wlan/chip/v1_0/IChipControllerCallback.idl +++ b/wlan/chip/v1_0/IChipControllerCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/wlan/chip/v1_0/IChipIface.idl b/wlan/chip/v1_0/IChipIface.idl index 0137f289..6f450b08 100644 --- a/wlan/chip/v1_0/IChipIface.idl +++ b/wlan/chip/v1_0/IChipIface.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/wlan/chip/v1_0/IConcreteChip.idl b/wlan/chip/v1_0/IConcreteChip.idl index aad33245..8219cc15 100644 --- a/wlan/chip/v1_0/IConcreteChip.idl +++ b/wlan/chip/v1_0/IConcreteChip.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 diff --git a/wlan/chip/v1_0/IConcreteChipCallback.idl b/wlan/chip/v1_0/IConcreteChipCallback.idl index 82162f07..2c714c07 100644 --- a/wlan/chip/v1_0/IConcreteChipCallback.idl +++ b/wlan/chip/v1_0/IConcreteChipCallback.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 -- Gitee From eda2ba200c09a41893713641171294e7539aa989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E9=B9=8F=E8=BE=89?= Date: Wed, 27 Mar 2024 10:34:10 +0800 Subject: [PATCH 135/210] change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 梁鹏辉 --- vibrator/bundle.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vibrator/bundle.json b/vibrator/bundle.json index 394a9201..248f7407 100644 --- a/vibrator/bundle.json +++ b/vibrator/bundle.json @@ -24,6 +24,7 @@ "ipc", "hdf_core", "hilog", + "hilog_lite", "c_utils" ], "third_party": [] -- Gitee From d536ccf1572ef2cb13972cd861abf498c38064ac Mon Sep 17 00:00:00 2001 From: yiyajun Date: Wed, 27 Mar 2024 09:51:55 +0800 Subject: [PATCH 136/210] hal Signed-off-by: yiyajun --- wlan/bundle.json | 8 +- wlan/chip/v1_0/BUILD.gn | 2 +- wlan/chip/v1_0/ChipTypes.idl | 93 ++++++---------------- wlan/chip/v1_0/IChipControllerCallback.idl | 2 +- wlan/chip/v1_0/IChipIface.idl | 4 +- wlan/chip/v1_0/IConcreteChip.idl | 6 +- 6 files changed, 34 insertions(+), 81 deletions(-) diff --git a/wlan/bundle.json b/wlan/bundle.json index fc2b1060..03daabbd 100644 --- a/wlan/bundle.json +++ b/wlan/bundle.json @@ -26,12 +26,12 @@ }, "build": { "sub_component": [ - "//drivers/interface/wlan/chip/v1_0:chip", "//drivers/interface/wlan/v1_1:wlan_idl_target", "//drivers/interface/wlan/v1_2:wlan_idl_target", "//drivers/interface/wlan/v1_3:wlan_idl_target", "//drivers/interface/wlan/wpa/v1_0:wpa_idl_target", - "//drivers/interface/wlan/hostapd/v1_0:hostapd_idl_target" + "//drivers/interface/wlan/hostapd/v1_0:hostapd_idl_target", + "//drivers/interface/wlan/chip/v1_0:chip_idl_target" ], "test": [ ], @@ -157,7 +157,7 @@ } }, { - "name": "//drivers/interface/wlan/chip/v1_0:libchip_stub_1.0", + "name": "//drivers/interface/wlan/chip/v1_0:libchip_proxy_1.0", "header": { "header_files": [ ], @@ -173,7 +173,7 @@ } }, { - "name": "//drivers/interface/wlan/chip/v1_0:libchip_proxy_1.0", + "name": "//drivers/interface/wlan/chip/v1_0:libchip_stub_1.0", "header": { "header_files": [ ], diff --git a/wlan/chip/v1_0/BUILD.gn b/wlan/chip/v1_0/BUILD.gn index 04c8d3ab..9ecd0118 100644 --- a/wlan/chip/v1_0/BUILD.gn +++ b/wlan/chip/v1_0/BUILD.gn @@ -27,7 +27,7 @@ if (defined(ohos_lite)) { "IChipControllerCallback.idl", "IChipIface.idl", "IConcreteChip.idl", - "IConcreteChipCallback.idl", + "IConcreteChipCallback.idl", ] language = "cpp" diff --git a/wlan/chip/v1_0/ChipTypes.idl b/wlan/chip/v1_0/ChipTypes.idl index 6a4e51ed..8d45590f 100644 --- a/wlan/chip/v1_0/ChipTypes.idl +++ b/wlan/chip/v1_0/ChipTypes.idl @@ -15,87 +15,44 @@ package ohos.hdi.wlan.chip.v1_0; -enum WifiStatusCode : int{ +enum ErrorCode : int{ SUCCESS, - ERROR_WIFI_CHIP_INVALID, - ERROR_WIFI_IFACE_INVALID, - ERROR_WIFI_RTT_CONTROLLER_INVALID, - ERROR_NOT_SUPPORTED, - ERROR_NOT_AVAILABLE, - ERROR_NOT_STARTED, - ERROR_INVALID_ARGS, - ERROR_BUSY, - ERROR_UNKNOWN -}; - -struct WifiStatus { - WifiStatusCode code; - String description; + INVALID_CHIP, + INVALID_IFACE, + UNSUPPORTED, + UNAVAILABLE, + NOT_INITED, + UNKNOWN }; enum IfaceType : unsigned int { STA, AP, P2P, - NANIFACE, -}; - -struct ChipIfaceCombinationLimit { - enum IfaceType[] types; //Each IfaceType must occur at most once. - unsigned int maxIfaces; -}; - -struct ChipIfaceCombination { - struct ChipIfaceCombinationLimit[] limits; + NANIFACE }; -struct ChipMode { - unsigned int id; - struct ChipIfaceCombination[] availableCombinations; +struct IfaceLimit { + enum IfaceType[] types; + unsigned int IfaceNum; }; -enum WifiBand : unsigned int { - BAND_UNSPECIFIED = 0, - BAND_24GHZ = 1, - BAND_5GHZ = 2, - BAND_5GHZ_DFS = 4, - BAND_5GHZ_WITH_DFS = 6, - BAND_24GHZ_5GHZ = 3, - BAND_24GHZ_5GHZ_WITH_DFS = 7 +struct ComboIface { + struct IfaceLimit[] limits; }; -enum ChipCapabilityMask : unsigned int { - DEBUG_MEMORY_FIRMWARE_DUMP = 1 << 0, - DEBUG_MEMORY_DRIVER_DUMP = 1 << 1, - DEBUG_RING_BUFFER_CONNECT_EVENT = 1 << 2, - DEBUG_RING_BUFFER_POWER_EVENT = 1 << 3, - DEBUG_RING_BUFFER_WAKELOCK_EVENT = 1 << 4, - DEBUG_RING_BUFFER_VENDOR_DATA = 1 << 5, - DEBUG_HOST_WAKE_REASON_STATS = 1 << 6, - DEBUG_ERROR_ALERTS = 1 << 7, - SET_TX_POWER_LIMIT = 1 << 8, - D2D_RTT = 1 << 9, - D2AP_RTT = 1 << 10, - USE_BODY_HEAD_SAR = 1 << 11, - SET_LATENCY_MODE = 1 << 12, - P2P_RAND_MAC = 1 << 13, - WIGIG = 1 << 14 +struct UsableMode { + unsigned int modeId; + struct ComboIface[] usableCombo; }; -enum StaIfaceCapabilityMask : unsigned int { - APF = 1 << 0, - BACKGROUND_SCAN = 1 << 1, - LINK_LAYER_STATS = 1 << 2, - RSSI_MONITOR = 1 << 3, - CONTROL_ROAMING = 1 << 4, - PROBE_IE_WHITELIST = 1 << 5, - SCAN_RAND = 1 << 6, - STA_5G = 1 << 7, - HOTSPOT = 1 << 8, - PNO = 1 << 9, - TDLS = 1 << 10, - TDLS_OFFCHANNEL= 1 << 11, - ND_OFFLOAD = 1 << 12, - KEEP_ALIVE = 1 << 13, - DEBUG_PACKET_FATE = 1 << 14 +enum BandType : unsigned int { + UNSPECIFIED = 0, + TYPE_24GHZ = 1, + TYPE_5GHZ = 2, + TYPE_24GHZ_AND_5GHZ = 3, + TYPE_DFS = 4, + TYPE_24GHZ_AND_DFS = 5, + TYPE_5GHZ_AND_DFS = 6, + ALL_BAND = 7 }; \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipControllerCallback.idl b/wlan/chip/v1_0/IChipControllerCallback.idl index f072988c..fbeb2f31 100644 --- a/wlan/chip/v1_0/IChipControllerCallback.idl +++ b/wlan/chip/v1_0/IChipControllerCallback.idl @@ -18,5 +18,5 @@ package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; [callback] interface IChipControllerCallback { - [oneway] OnSubsystemRestart([in] WifiStatus status); + [oneway] OnSubsystemRestart([in] ErrorCode code); }; \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipIface.idl b/wlan/chip/v1_0/IChipIface.idl index 6f450b08..496373fd 100644 --- a/wlan/chip/v1_0/IChipIface.idl +++ b/wlan/chip/v1_0/IChipIface.idl @@ -22,7 +22,5 @@ interface IChipIface { GetIfaceName([out] String name); - GetIfaceCap([out] unsigned int capabilities); - - GetSupportFreqs([in] enum WifiBand band, [out] unsigned int[] frequencies); + GetSupportFreqs([in] enum BandType band, [out] unsigned int[] frequencies); }; \ No newline at end of file diff --git a/wlan/chip/v1_0/IConcreteChip.idl b/wlan/chip/v1_0/IConcreteChip.idl index 8219cc15..8c078133 100644 --- a/wlan/chip/v1_0/IConcreteChip.idl +++ b/wlan/chip/v1_0/IConcreteChip.idl @@ -22,11 +22,9 @@ import ohos.hdi.wlan.chip.v1_0.IConcreteChipCallback; interface IConcreteChip { GetChipId([out] int id); - RegisterWifiEventCallback([in] IConcreteChipCallback chipEventcallback); + RegisterChipEventCallback([in] IConcreteChipCallback chipEventcallback); - GetIfaceCap([out] unsigned int capabilities); - - GetAvailableModes([out] struct ChipMode[] modes); + GetChipModes([out] struct UsableMode[] modes); GetCurrentMode([out] unsigned int modeId); -- Gitee From 8ba4bbb850e55e712bd85aa915cc5784c9a56c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A4=9A=E6=99=A8=E8=BE=89?= <734222381@qq.com> Date: Thu, 21 Mar 2024 18:22:51 +0800 Subject: [PATCH 137/210] feature: update gnss agnss geofence to 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 褚晨辉 <734222381@qq.com> --- location/agnss/bundle.json | 24 + location/agnss/v1_0/BUILD.gn | 2 +- location/agnss/v2_0/AGnssTypes.idl | 208 +++++++++ location/agnss/v2_0/BUILD.gn | 27 ++ location/agnss/v2_0/IAGnssCallback.idl | 83 ++++ location/agnss/v2_0/IAGnssInterface.idl | 110 +++++ location/geofence/bundle.json | 28 +- location/geofence/v1_0/BUILD.gn | 2 +- location/geofence/v1_0/IGeofenceCallback.idl | 2 +- location/geofence/v2_0/BUILD.gn | 31 ++ location/geofence/v2_0/GeofenceTypes.idl | 84 ++++ location/geofence/v2_0/IGeofenceCallback.idl | 93 ++++ location/geofence/v2_0/IGeofenceInterface.idl | 88 ++++ location/gnss/bundle.json | 24 + location/gnss/v1_0/BUILD.gn | 2 +- location/gnss/v1_0/GnssTypes.idl | 23 +- location/gnss/v1_0/IGnssCallback.idl | 12 +- location/gnss/v1_0/IGnssInterface.idl | 26 +- location/gnss/v2_0/BUILD.gn | 27 ++ location/gnss/v2_0/GnssTypes.idl | 424 ++++++++++++++++++ location/gnss/v2_0/IGnssCallback.idl | 154 +++++++ location/gnss/v2_0/IGnssInterface.idl | 194 ++++++++ 22 files changed, 1631 insertions(+), 37 deletions(-) create mode 100644 location/agnss/v2_0/AGnssTypes.idl create mode 100644 location/agnss/v2_0/BUILD.gn create mode 100644 location/agnss/v2_0/IAGnssCallback.idl create mode 100644 location/agnss/v2_0/IAGnssInterface.idl create mode 100644 location/geofence/v2_0/BUILD.gn create mode 100644 location/geofence/v2_0/GeofenceTypes.idl create mode 100644 location/geofence/v2_0/IGeofenceCallback.idl create mode 100644 location/geofence/v2_0/IGeofenceInterface.idl create mode 100644 location/gnss/v2_0/BUILD.gn create mode 100644 location/gnss/v2_0/GnssTypes.idl create mode 100644 location/gnss/v2_0/IGnssCallback.idl create mode 100644 location/gnss/v2_0/IGnssInterface.idl diff --git a/location/agnss/bundle.json b/location/agnss/bundle.json index e93eb941..16d84f64 100644 --- a/location/agnss/bundle.json +++ b/location/agnss/bundle.json @@ -56,6 +56,30 @@ ], "header_base": "//drivers/interface/location/agnss" } + }, + { + "name": "//drivers/interface/location/agnss/v2_0:liblocation_agnss_proxy_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } + }, + { + "name": "//drivers/interface/location/agnss/v2_0:location_agnss_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } + }, + { + "name": "//drivers/interface/location/agnss/v2_0:liblocation_agnss_stub_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/agnss" + } } ] } diff --git a/location/agnss/v1_0/BUILD.gn b/location/agnss/v1_0/BUILD.gn index aea9fa9f..d036d241 100644 --- a/location/agnss/v1_0/BUILD.gn +++ b/location/agnss/v1_0/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("location_agnss") { diff --git a/location/agnss/v2_0/AGnssTypes.idl b/location/agnss/v2_0/AGnssTypes.idl new file mode 100644 index 00000000..78fb9ed4 --- /dev/null +++ b/location/agnss/v2_0/AGnssTypes.idl @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2024 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 HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file AGnssTypes.idl + * + * @brief Defines the data structure used by the AGNSS module. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.agnss.v2_0; + +/* + * @brief Defines the AGNSS reference information type. + * + * @since 5.0 + */ +enum AGnssRefInfoType { + ANSS_REF_INFO_TYPE_CELLID = 1, + ANSS_REF_INFO_TYPE_MAC = 2, +}; + +/* + * @brief Defines the protocol type of the AGNSS user plane. + * + * @since 5.0 + */ +enum AGnssUserPlaneProtocol { + AGNSS_TYPE_SUPL = 1, + AGNSS_TYPE_C2K = 2, + AGNSS_TYPE_SUPL_IMS = 3, + AGNSS_TYPE_SUPL_EIMS = 4 +}; + +/* + * @brief Defines the action type for operating data services. + * + * @since 5.0 + */ +enum DataLinkSetUpType { + /* Request to establish a data connection. */ + ESTABLISH_DATA_CONNECTION = 1, + + /* Request to release a data connection. */ + RELEASE_DATA_CONNECTION = 2 +}; + +enum DataConnectionState { + DATA_CONNECTION_DISCONNECTED = 1, + DATA_CONNECTION_CONNECTED = 2, +}; + +/* + * @brief Defines the cell id type. + * + * @since 5.0 + */ +enum CellIdType { + CELLID_TYPE_GSM = 1, + CELLID_TYPE_UMTS = 2, + CELLID_TYPE_LTE = 3, + CELLID_TYPE_NR = 4, +}; + +/* + * @brief Defines the setid type. + * + * @since 5.0 + */ +enum SubscriberSetIdType { + AGNSS_SETID_TYPE_NULL = 0, + AGNSS_SETID_TYPE_IMSI = 1, + AGNSS_SETID_TYPE_MSISDN = 2, +}; + +/* + * @brief Defines the APN IP type. + * + * @since 5.0 + */ +enum ApnIpCategory { + APN_CATEGORY_INVALID = 0, + APN_CATEGORY_IPV4 = 1, + APN_CATEGORY_IPV6 = 2, + APN_CATEGORY_IPV4V6 = 3 +}; + +/* + * @brief Defines the cell information structure in the AGNSS reference information. + * + * @since 5.0 + */ +struct AGnssRefCellId { + enum CellIdType type; + + /* Mobile Country Code. */ + unsigned short mcc; + + /* Mobile Network Code. */ + unsigned short mnc; + + /* Location Area Code in 2G, 3G and LTE. */ + unsigned short lac; + + /* Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */ + unsigned int cid; + + /* Tracking Area Code in LTE. */ + unsigned short tac; + + /* Physical Cell id in LTE. */ + unsigned short pcid; + + /* NR Cell ID */ + unsigned int nci; +}; + +/* + * @brief Defines the AGNSS server information. + * + * @since 5.0 + */ +struct AGnssServerInfo { + enum AGnssUserPlaneProtocol type; + String server; + int port; +}; + +/* + * @brief Defines the AGNSS setid information. + * + * @since 5.0 + */ +struct SubscriberSetId { + enum SubscriberSetIdType type; + String id; +}; + +/* + * @brief Defines the AGNSS mac information. + * + * @since 5.0 + */ +struct AGnssRefMac { + unsigned char[] mac; +}; + +/* + * @brief Defines the AGNSS reference information structure. + * + * @since 5.0 + */ +struct AGnssRefInfo { + enum AGnssRefInfoType type; + struct AGnssRefCellId cellId; + struct AGnssRefMac mac; +}; + +/* + * @brief Defines the structure of the request for operating the data service. + * + * @since 5.0 + */ +struct AGnssDataLinkRequest { + enum AGnssUserPlaneProtocol agnssType; + enum DataLinkSetUpType setUpType; + unsigned char[] serverIpAddr; + unsigned char[] serverIpV6Addr; +}; + +/* + * @brief Defines the structure of Data service network state. + * + * @since 5.0 + */ +struct NetworkState { + int netId; + enum ApnIpCategory apnIpCategory; + String apn; + enum DataConnectionState state; +}; +/** @} */ \ No newline at end of file diff --git a/location/agnss/v2_0/BUILD.gn b/location/agnss/v2_0/BUILD.gn new file mode 100644 index 00000000..7a8f312e --- /dev/null +++ b/location/agnss/v2_0/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("location_agnss") { + module_name = "location_agnss" + + sources = [ + "AGnssTypes.idl", + "IAGnssCallback.idl", + "IAGnssInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_location_agnss" +} diff --git a/location/agnss/v2_0/IAGnssCallback.idl b/location/agnss/v2_0/IAGnssCallback.idl new file mode 100644 index 00000000..ab6b0148 --- /dev/null +++ b/location/agnss/v2_0/IAGnssCallback.idl @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2024 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 HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file IAGnssCallback.idl + * + * @brief Defines the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.agnss.v2_0; + +import ohos.hdi.location.agnss.v2_0.AGnssTypes; + +/* + * @brief Defines the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * + * @since 5.0 + */ +[callback] interface IAGnssCallback { + /* + * @brief Request the upper layer to establish or release data services. + * + * @param request Indicates the request information for operating the data service. + * For details, see {@link AGnssDataLinkRequest}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestSetUpAgnssDataLink([in] struct AGnssDataLinkRequest request); + + /* + * @brief Request the upper layer to deliver the subscriber identity. + * + * @param type Indicates the type of setId. For details, see {@link SubscriberSetIdType}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestSubscriberSetId([in] enum SubscriberSetIdType type); + + /* + * @brief Request upper-layer ingest reference information. + * + * @param type Indicates the type of reference information. For details, see {@link AGnssRefInfoType}. + * @return Returns 0 if send request successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestAgnssRefInfo([in] enum AGnssRefInfoType type); +} +/** @} */ \ No newline at end of file diff --git a/location/agnss/v2_0/IAGnssInterface.idl b/location/agnss/v2_0/IAGnssInterface.idl new file mode 100644 index 00000000..a166b6af --- /dev/null +++ b/location/agnss/v2_0/IAGnssInterface.idl @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2024 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 HdiAGnss + * @{ + * + * @brief Provides unified APIs for the AGNSS service. + * + * The upper layer can use the interfaces provided by this module to set the AGNSS callback, AGNSS server address, + * AGNSS reference information, and setId. + * + * @since 5.0 + */ + +/* + * @file IAGnssInterface.idl + * + * @brief Defines the agnss interfaces to set the AGNSS callback, AGNSS server address, AGNSS reference information, + * and setId. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.agnss.v2_0; + +import ohos.hdi.location.agnss.v2_0.IAGnssCallback; +import ohos.hdi.location.agnss.v2_0.AGnssTypes; + +/* + * @brief Defines the agnss interfaces to set the AGNSS callback, AGNSS server address, AGNSS reference information, + * and setId. + * + * @since 5.0 + */ +interface IAGnssInterface { + /* + * @brief Set the agnss callback function. + * + * @param callback Indicates the agnss callback to request the upper layer to establish or release data services, + * request the upper layer to deliver setId, and request the upper layer to deliver the agnss reference information. + * For details, see {@link IAGnssCallback}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssCallback([in] IAGnssCallback callbackObj); + + /* + * @brief Set the Agnss Server Information. + * + * @param server Indicates the AGNSS server information. + * For details, see {@link AGnssServerInfo}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssServer([in] struct AGnssServerInfo server); + + /* + * @brief Ingesting Reference Information. + * + * @param refInfo Indicates the AGNSS reference information structure. + * For details, see {@link AGnssRefInfo}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetAgnssRefInfo([in] struct AGnssRefInfo refInfo); + + /* + * @brief Set Subscriber Identity. + * + * @param id Indicates the AGNSS setid information. + * For details, see {@link SubscriberSetId}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetSubscriberSetId([in] struct SubscriberSetId id); + + /* + * @brief Send network state to AGNSS module. + * + * @param state Indicates the network state. For details, see {@link NetworkState}. + * @return Returns 0 if send successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SendNetworkState([in] struct NetworkState state); +} +/** @} */ \ No newline at end of file diff --git a/location/geofence/bundle.json b/location/geofence/bundle.json index 8ea2fd17..d413ec4b 100644 --- a/location/geofence/bundle.json +++ b/location/geofence/bundle.json @@ -12,7 +12,6 @@ "component": { "name": "drivers_interface_location_geofence", "subsystem": "hdf", - "syscap": [ "SystemCapability.Location.Location.Geofence" ], "adapted_system_type": [ "standard" ], @@ -23,7 +22,8 @@ "ipc", "hdf_core", "hilog", - "c_utils" + "c_utils", + "drivers_interface_location_gnss" ], "third_party": [] }, @@ -57,6 +57,30 @@ ], "header_base": "//drivers/interface/location/geofence" } + }, + { + "name": "//drivers/interface/location/geofence/v2_0:liblocation_geofence_proxy_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/geofence" + } + }, + { + "name": "//drivers/interface/location/geofence/v2_0:location_geofence_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/geofence" + } + }, + { + "name": "//drivers/interface/location/geofence/v2_0:liblocation_geofence_stub_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/geofence" + } } ] } diff --git a/location/geofence/v1_0/BUILD.gn b/location/geofence/v1_0/BUILD.gn index 4efd1f93..a63a2bd5 100644 --- a/location/geofence/v1_0/BUILD.gn +++ b/location/geofence/v1_0/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("location_geofence") { diff --git a/location/geofence/v1_0/IGeofenceCallback.idl b/location/geofence/v1_0/IGeofenceCallback.idl index 4d615bb9..20e2c7cd 100644 --- a/location/geofence/v1_0/IGeofenceCallback.idl +++ b/location/geofence/v1_0/IGeofenceCallback.idl @@ -63,7 +63,7 @@ import ohos.hdi.location.geofence.v1_0.GeofenceTypes; * @param fenceIndex Indicates geofence ID, this geofence ID is unique. * @param location Indicates current Location. For details, see {@link Location}. * @param event Indicates name of the currently report event. For details, see {@link GeofenceEvent}. - * @param timestamp Indicates timestamp when the geofence event is reported. + * @param timestamp Indicates timestamp when the geofence event is reported. Milliseconds since January 1, 1970. * @return Returns 0 if reporting is successed; returns a negative value otherwise. * * @since 3.2 diff --git a/location/geofence/v2_0/BUILD.gn b/location/geofence/v2_0/BUILD.gn new file mode 100644 index 00000000..0b4f3273 --- /dev/null +++ b/location/geofence/v2_0/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("location_geofence") { + module_name = "location_geofence" + sources = [ + "GeofenceTypes.idl", + "IGeofenceCallback.idl", + "IGeofenceInterface.idl", + ] + sequenceable_ext_deps = [ + "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0", + "drivers_interface_location_gnss:liblocation_gnss_stub_2.0", + "drivers_interface_location_gnss:location_gnss_idl_headers", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_location_geofence" +} diff --git a/location/geofence/v2_0/GeofenceTypes.idl b/location/geofence/v2_0/GeofenceTypes.idl new file mode 100644 index 00000000..2ac9329c --- /dev/null +++ b/location/geofence/v2_0/GeofenceTypes.idl @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 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 HdiGeofence + * @{ + * + * @brief Provides unified APIs for the GNSS geofence service. + * + * A gnss service module can use the interfaces of this module to add fences, and delete fences, and monitor + * fence status changes. + * + * @since 5.0 + */ + +/* + * @file GeofenceTypes.idl + * + * @brief Defines the data structure used by the geofence module. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.geofence.v2_0; + +/* + * @brief Defines the type of the geofence event to be listened on. + * + * @since 5.0 + */ +enum GeofenceEvent { + GEOFENCE_EVENT_UNCERTAIN = 1, + GEOFENCE_EVENT_ENTERED = 2, + GEOFENCE_EVENT_EXITED = 4, +}; + +/* + * @brief Define the result and error code of the operation fence. + * + * @since 5.0 + */ +enum GeofenceOperateResult { + GEOFENCE_OPERATION_SUCCESS = 0, + GEOFENCE_OPERATION_ERROR_UNKNOWN = -1, + GEOFENCE_OPERATION_ERROR_TOO_MANY_GEOFENCES = -2, + GEOFENCE_OPERATION_ERROR_GEOFENCE_ID_EXISTS = -3, + GEOFENCE_OPERATION_ERROR_PARAMS_INVALID = -4, +}; + +/* + * @brief Defines the action type of the operation fence. + * + * @since 5.0 + */ +enum GeofenceOperateType { + TYPE_ADD = 1, + TYPE_DELETE = 2, +}; + +/* + * @brief Define geofence parameters. + * + * @since 5.0 + */ +struct GeofenceInfo { + int fenceIndex; + double latitude; + double longitude; + double radius; +}; +/** @} */ \ No newline at end of file diff --git a/location/geofence/v2_0/IGeofenceCallback.idl b/location/geofence/v2_0/IGeofenceCallback.idl new file mode 100644 index 00000000..3f8e01b6 --- /dev/null +++ b/location/geofence/v2_0/IGeofenceCallback.idl @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 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 HdiGeofence + * @{ + * + * @brief Provides unified APIs for the GNSS geofence service. + * + * A gnss service module can use the interfaces of this module to add fences, and delete fences, and monitor + * fence status changes. + * + * @since 5.0 + */ + +/* + * @file IGeofenceCallback.idl + * + * @brief Define callback interfaces for reporting whether the geofence service is available, and reporting + * geofence events, and reporting geofence operation results. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.geofence.v2_0; + +import ohos.hdi.location.geofence.v2_0.GeofenceTypes; +import ohos.hdi.location.gnss.v2_0.GnssTypes; + +/* + * @brief Defines the geofence callback interface for reporting geofence service availability, geofence events, + * and geofence operation results. + * + * @since 5.0 + */ +[callback] interface IGeofenceCallback { + /* + * @brief Report whether the geofence service is available. + * + * @param isAvailable Indicates whether the geofence service is available. + * @return Returns 0 if reporting is successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGeofenceAvailability([in] boolean isAvailable); + + /* + * @brief Report of fence entry and exit events. + * + * @param fenceIndex Indicates geofence ID, this geofence ID is unique. + * @param location Indicates current Location. For details, see {@link Location}. + * @param event Indicates name of the currently report event. For details, see {@link GeofenceEvent}. + * @param timestamp Indicates timestamp when the geofence event is reported. Milliseconds since January 1, 1970. + * @return Returns 0 if reporting is successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGeofenceEvent([in] int fenceIndex, + [in] struct LocationInfo location, + [in] enum GeofenceEvent event, + [in] long timestamp); + + /* + * @brief Report the fence operation result. + * + * @param fenceIndex Indicates geofence ID, this geofence ID is unique. + * @param type Indicates geofence operation type. For details, see {@link GeofenceOperateType}. + * @param result Indicates geofence operation result. For details, see {@link GeofenceOperateResult}. + * @return Returns 0 if reporting is successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGeofenceOperateResult([in] int fenceIndex, + [in] enum GeofenceOperateType type, + [in] enum GeofenceOperateResult result); +} +/** @} */ \ No newline at end of file diff --git a/location/geofence/v2_0/IGeofenceInterface.idl b/location/geofence/v2_0/IGeofenceInterface.idl new file mode 100644 index 00000000..cfc6944e --- /dev/null +++ b/location/geofence/v2_0/IGeofenceInterface.idl @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024 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 HdiGeofence + * @{ + * + * @brief Provides unified APIs for the GNSS geofence service. + * + * A gnss service module can use the interfaces of this module to add fences, and delete fences, and monitor + * fence status changes. + * + * @since 5.0 + */ + +/* + * @file IGeofenceInterface.idl + * + * @brief Define interfaces such as adding fences, deleting fences, and setting callback. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.geofence.v2_0; + +import ohos.hdi.location.geofence.v2_0.IGeofenceCallback; +import ohos.hdi.location.geofence.v2_0.GeofenceTypes; + +/* + * @brief Defines the functions for performing basic operations on geofence. + * + * The operations include adding fences, deleting fences, and setting callback. + * + * @since 5.0 + */ +interface IGeofenceInterface { + /* + * @brief Set callback function for geofence. + * + * @param callback Indicates callback function of geofence, gnss driver use this callback to report + * the geofence service Availability, and report geofence event, and report the geofence operation result. + * For details, see {@link IGeofenceCallback}. + * @return Returns 0 if setup callback successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetGeofenceCallback([in] IGeofenceCallback callbackObj); + + /* + * @brief Add a geofence. + * + * @param fence Indicates geofence configuration parameters. For details, see {@link GeofenceInfo}. + * @param monitorEvent Indicates the geofence events that the application needs to listen to. + * For details, see {@link GeofenceEvent}. + * @return Returns 0 if add geofence successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + AddGnssGeofence([in] struct GeofenceInfo fence, + [in] enum GeofenceEvent monitorEvent); + + /* + * @brief Delete a geofence. + * + * @param fenceIndex Indicates the ID of the geofence. + * @return Returns 0 if delete geofence successed; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + DeleteGnssGeofence([in] int fenceIndex); +} +/** @} */ \ No newline at end of file diff --git a/location/gnss/bundle.json b/location/gnss/bundle.json index 212fc282..0377a419 100644 --- a/location/gnss/bundle.json +++ b/location/gnss/bundle.json @@ -56,6 +56,30 @@ ], "header_base": "//drivers/interface/location/gnss" } + }, + { + "name": "//drivers/interface/location/gnss/v2_0:liblocation_gnss_proxy_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/gnss" + } + }, + { + "name": "//drivers/interface/location/gnss/v2_0:location_gnss_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/gnss" + } + }, + { + "name": "//drivers/interface/location/gnss/v2_0:liblocation_gnss_stub_2.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/location/gnss" + } } ] } diff --git a/location/gnss/v1_0/BUILD.gn b/location/gnss/v1_0/BUILD.gn index 341bd2f0..64612d9b 100644 --- a/location/gnss/v1_0/BUILD.gn +++ b/location/gnss/v1_0/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("location_gnss") { diff --git a/location/gnss/v1_0/GnssTypes.idl b/location/gnss/v1_0/GnssTypes.idl index 7354536c..24fb6f2e 100644 --- a/location/gnss/v1_0/GnssTypes.idl +++ b/location/gnss/v1_0/GnssTypes.idl @@ -17,10 +17,10 @@ * @addtogroup HdiGnss * @{ * - * @brief Provides unified APIs for gnss services to access gnss drivers. + * @brief Provides unified APIs for GNSS services to access GNSS drivers. * - * A gnss service can obtain a gnss driver object or agent and then call APIs provided by this object or agent to - * access gnss devices, thereby Start the GNSS chip, start the navigation, + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, * obtain the satellite status information, and obtain the cache location information. * @@ -30,7 +30,7 @@ /* * @file GnssTypes.idl * - * @brief Defines the data structure used by the agnss module.. + * @brief Defines the data structure used by the GNSS module. * * @since 3.2 * @version 1.0 @@ -45,8 +45,7 @@ package ohos.hdi.location.gnss.v1_0; * * @since 3.2 */ -enum GnssWorkingMode -{ +enum GnssWorkingMode { /* GNSS standalone (no assistance) */ GNSS_WORKING_MODE_STANDALONE = 1, @@ -72,7 +71,7 @@ enum GnssStartType { }; /* - * @brief Defines the gnss reference information type. + * @brief Defines the GNSS reference information type. * * The reference information includes the reference time, reference location, and best location. * @@ -142,7 +141,7 @@ enum GnssCapabilities { /* GNSS supports Geofencing */ GNSS_CAP_SUPPORT_GEOFENCING = 4, - /* GNSS supports Measurements for at least GPS. */ + /* GNSS supports Measurements. */ GNSS_CAP_SUPPORT_MEASUREMENTS = 8, /* GNSS supports Navigation Messages */ @@ -203,10 +202,10 @@ enum SatellitesStatusFlag { struct SatelliteStatusInfo { unsigned int satellitesNumber; - /* Pseudo-random or satellite ID number for the satellite. */ + /* Satellite ID number for the satellite. */ short[] satelliteIds; - /* Defines the constellation of the given SV. */ + /* Defines the constellation type of the given satellite. */ enum GnssConstellationType[] constellation; /* Carrier-to-noise density in dB-Hz. */ @@ -230,7 +229,7 @@ struct SatelliteStatusInfo { * @since 3.2 */ struct GnssBasicConfig { - /* min interval between locations in ms */ + /* Minimus interval between locations in millisecond */ unsigned int minInterval; /* expected accuracy in meters */ @@ -250,7 +249,7 @@ struct GnssBasicConfig { * @since 3.2 */ struct GnssCachingConfig { - /* min interval between locations in ms */ + /* Minimus interval between locations in millisecond */ unsigned int interval; /* If the value is true, the cached locations are reported diff --git a/location/gnss/v1_0/IGnssCallback.idl b/location/gnss/v1_0/IGnssCallback.idl index 71c52f7b..ce4d0fd3 100644 --- a/location/gnss/v1_0/IGnssCallback.idl +++ b/location/gnss/v1_0/IGnssCallback.idl @@ -17,10 +17,10 @@ * @addtogroup HdiGnss * @{ * - * @brief Provides unified APIs for gnss services to access gnss drivers. + * @brief Provides unified APIs for GNSS services to access GNSS drivers. * - * A gnss service can obtain a gnss driver object or agent and then call APIs provided by this object or agent to - * access gnss devices, thereby Start the GNSS chip, start the navigation, + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, * obtain the satellite status information, and obtain the cache location information. * @@ -75,7 +75,7 @@ import ohos.hdi.location.gnss.v1_0.GnssTypes; /* * @brief Reporting NMEA. * - * @param timestamp Indicates the timestamp when the NMEA is reported. + * @param timestamp Indicates the timestamp when the NMEA is reported. Milliseconds since January 1, 1970. * @param nmea Indicates NMEA sentences, follows standard NMEA 0183. * @param length Indicates length of NMEA sentences. * @return Returns 0 If the reporting is successful; returns a negative value otherwise. @@ -111,7 +111,7 @@ import ohos.hdi.location.gnss.v1_0.GnssTypes; /* * @brief Request upper-layer ingest reference information. * - * @param type Indicates the gnss reference information type. For details, see {@link GnssRefInfoType}. + * @param type Indicates the GNSS reference information type. For details, see {@link GnssRefInfoType}. * @return Returns 0 If sending request is successful; returns a negative value otherwise. * * @since 3.2 @@ -132,7 +132,7 @@ import ohos.hdi.location.gnss.v1_0.GnssTypes; /* * @brief Report all location information cached by the bottom-layer GNSS module to the upper layer. * - * @param gnssLocations Indicates all locations of the gnss chip cache. For details, see {@link Location}. + * @param gnssLocations Indicates all locations of the GNSS chip cache. For details, see {@link Location}. * @return Returns 0 If the reporting is successful; returns a negative value otherwise. * * @since 3.2 diff --git a/location/gnss/v1_0/IGnssInterface.idl b/location/gnss/v1_0/IGnssInterface.idl index 1638faa4..f06f68be 100644 --- a/location/gnss/v1_0/IGnssInterface.idl +++ b/location/gnss/v1_0/IGnssInterface.idl @@ -17,10 +17,10 @@ * @addtogroup HdiGnss * @{ * - * @brief Provides unified APIs for gnss services to access gnss drivers. + * @brief Provides unified APIs for GNSS services to access GNSS drivers. * - * A gnss service can obtain a gnss driver object or agent and then call APIs provided by this object or agent to - * access gnss devices, thereby Start the GNSS chip, start the navigation, + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, * obtain the satellite status information, and obtain the cache location information. * @@ -30,7 +30,7 @@ /* * @file IGnssInterface.idl * - * @brief Declares the APIs provided by the gnss module for Start the GNSS chip, start the navigation, + * @brief Declares the APIs provided by the GNSS module for Start the GNSS chip, start the navigation, * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data, * obtain the number of GNSS cache locations, and obtain all cache locations. * @@ -44,7 +44,7 @@ import ohos.hdi.location.gnss.v1_0.IGnssCallback; import ohos.hdi.location.gnss.v1_0.GnssTypes; /* - * @brief Defines the functions for performing basic operations on gnss. + * @brief Defines the functions for performing basic operations on GNSS. * * The functions include Start the GNSS chip, start the navigation, * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data, @@ -54,7 +54,7 @@ import ohos.hdi.location.gnss.v1_0.GnssTypes; */ interface IGnssInterface { /* - * @brief Setting gnss configuration parameters. + * @brief Setting GNSS configuration parameters. * * @param para Indicates GNSS configuration parameters, including basic GNSS parameters and GNSS cache * function configuration parameters. For details, see {@link GnssConfigPara}. @@ -68,9 +68,9 @@ interface IGnssInterface { /* * @brief Enable the GNSS module and transmit the callback of the upper layer to the GNSS module. * - * @param callback Indicates Callback function sent by the upper layer to the gnss driver. The gnss driver returns + * @param callback Indicates Callback function sent by the upper layer to the GNSS driver. The GNSS driver returns * location results and satellite status information by the callbacks. For details, see {@link IGnssCallback}. - * @return Returns 0 if the gnss is successfully enabled; returns a negative value otherwise. + * @return Returns 0 if the GNSS is successfully enabled; returns a negative value otherwise. * * @since 3.2 * @version 1.0 @@ -80,7 +80,7 @@ interface IGnssInterface { /* * @brief Disable the GNSS module. * - * @return Returns 0 if the gnss is successfully disabled; returns a negative value otherwise. + * @return Returns 0 if the GNSS is successfully disabled; returns a negative value otherwise. * * @since 3.2 * @version 1.0 @@ -92,7 +92,7 @@ interface IGnssInterface { * * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning * and GNSS caching function. For details, see {@link GnssStartType}. - * @return Returns 0 if the gnss navigation is successfully started; returns a negative value otherwise. + * @return Returns 0 if the GNSS navigation is successfully started; returns a negative value otherwise. * * @since 3.2 * @version 1.0 @@ -104,7 +104,7 @@ interface IGnssInterface { * * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning * and GNSS caching function. For details, see {@link GnssStartType}. - * @return Returns 0 if the gnss navigation is successfully stopped; returns a negative value otherwise. + * @return Returns 0 if the GNSS navigation is successfully stopped; returns a negative value otherwise. * * @since 3.2 * @version 1.0 @@ -127,7 +127,7 @@ interface IGnssInterface { * @brief Delete the specified auxiliary data. * * @param data Indicates the type of auxiliary data to be deleted. For details, see {@link GnssAuxiliaryData}. - * @return Returns 0 if Deleted successfully; returns a negative value otherwise. + * @return Returns 0 if deleted successfully; returns a negative value otherwise. * * @since 3.2 * @version 1.0 @@ -138,7 +138,7 @@ interface IGnssInterface { * @brief Ingesting Predict Gnss Data. * * @param data Indicates Predict Gnss Data. - * @return Returns 0 if Deleted successfully; returns a negative value otherwise. + * @return Returns 0 if ingesting successfully; returns a negative value otherwise. * * @since 3.2 * @version 1.0 diff --git a/location/gnss/v2_0/BUILD.gn b/location/gnss/v2_0/BUILD.gn new file mode 100644 index 00000000..e7ecd97c --- /dev/null +++ b/location/gnss/v2_0/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("location_gnss") { + module_name = "location_gnss" + + sources = [ + "GnssTypes.idl", + "IGnssCallback.idl", + "IGnssInterface.idl", + ] + + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_location_gnss" +} diff --git a/location/gnss/v2_0/GnssTypes.idl b/location/gnss/v2_0/GnssTypes.idl new file mode 100644 index 00000000..46aab077 --- /dev/null +++ b/location/gnss/v2_0/GnssTypes.idl @@ -0,0 +1,424 @@ +/* + * Copyright (c) 2024 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 HdiGnss + * @{ + * + * @brief Provides unified APIs for GNSS services to access GNSS drivers. + * + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, + * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, + * obtain the satellite status information, and obtain the cache location information. + * + * @since 5.0 + */ + +/* + * @file GnssTypes.idl + * + * @brief Defines the data structure used by the GNSS module. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.gnss.v2_0; + +/* + * @brief Defines the GNSS location validity flag. + * + * @since 5.0 + */ +enum GnssLocationValidity { + GNSS_LOCATION_LAT_VALID = 1, + GNSS_LOCATION_LONG_VALID = 2, + GNSS_LOCATION_ALTITUDE_VALID = 4, + GNSS_LOCATION_SPEED_VALID = 8, + GNSS_LOCATION_BEARING_VALID = 16, + GNSS_LOCATION_HORIZONTAL_ACCURACY_VALID = 32, + GNSS_LOCATION_VERTICAL_ACCURACY_VALID = 64, + GNSS_LOCATION_SPEED_ACCURACY_VALID = 128, + GNSS_LOCATION_BEARING_ACCURACY_VALID = 256, + GNSS_LOCATION_TIME_VALID = 512, + GNSS_LOCATION_TIME_SINCE_BOOT_VALID = 1024, + GNSS_LOCATION_TIME_UNCERTAINTY_VALID = 2048, +}; + +/* + * @brief Defines the GNSS working mode. + * + * Defines the enumerated values of the GNSS working mode. + * + * @since 5.0 + */ +enum GnssWorkingMode { + /* GNSS standalone (no assistance) */ + GNSS_WORKING_MODE_STANDALONE = 1, + + /* AGNSS MS-Based mode */ + GNSS_WORKING_MODE_MS_BASED = 2, + + /* AGPS MS-Assisted mode */ + GNSS_WORKING_MODE_MS_ASSISTED = 3 +}; + +/* + * @brief Defines the GNSS startup type. + * + * Defines the enumerated value of the GNSS startup type, which is used to distinguish between common GNSS positioning + * and GNSS caching(The bottom-layer buffer location is not reported, location is reported only after the upper-layer + * request or the bottom-layer FIFO is full). + * + * @since 5.0 + */ +enum GnssStartType { + GNSS_START_TYPE_NORMAL = 1, + GNSS_START_TYPE_GNSS_CACHE = 2, +}; + +/* + * @brief Defines the GNSS reference information type. + * + * The reference information includes the reference time, reference location, and best location. + * + * @since 5.0 + */ +enum GnssRefInfoType { + GNSS_REF_INFO_TIME = 1, + GNSS_REF_INFO_LOCATION = 2, + GNSS_REF_INFO_BEST_LOCATION = 3, + GNSS_REF_INFO_GNSS_LOCATION_EMERGENCY = 4, + GNSS_REF_INFO_BEST_LOCATION_EMERGENCY = 5, +}; + +/* + * @brief Defines the type of auxiliary data to be deleted. + * + * @since 5.0 + */ +enum GnssAuxiliaryDataType { + GNSS_AUXILIARY_DATA_EPHEMERIS = 1, + GNSS_AUXILIARY_DATA_ALMANAC = 2, + GNSS_AUXILIARY_DATA_POSITION = 4, + GNSS_AUXILIARY_DATA_TIME = 8, + GNSS_AUXILIARY_DATA_IONO = 16, + GNSS_AUXILIARY_DATA_UTC = 32, + GNSS_AUXILIARY_DATA_HEALTH = 64, + GNSS_AUXILIARY_DATA_SVDIR = 128, + GNSS_AUXILIARY_DATA_SVSTEER = 256, + GNSS_AUXILIARY_DATA_SADATA = 512, + GNSS_AUXILIARY_DATA_RTI = 1024, + GNSS_AUXILIARY_DATA_CELLDB_INFO = 2048, + GNSS_AUXILIARY_DATA_ALL = 65535 +}; + +/* + * @brief Defines the enumerated values of the working status of the GNSS module. + * + * @since 5.0 + */ +enum GnssWorkingStatus { + /* GNSS status unknown. */ + GNSS_WORKING_STATUS_NONE = 0, + + /* Navigation started. */ + GNSS_WORKING_STATUS_SESSION_BEGIN = 1, + + /* Navigation stoped. */ + GNSS_WORKING_STATUS_SESSION_END = 2, + + /* The GNSS chip is started, but the navigation is not started. */ + GNSS_WORKING_STATUS_ENGINE_ON = 3, + + /* The GNSS chip is powered off. */ + GNSS_WORKING_STATUS_ENGINE_OFF = 4 +}; + +/* + * @brief Defines the GNSS capability. + * + * @since 5.0 + */ +enum GnssCapabilities { + /* GNSS supports MS-Based AGNSS mode */ + GNSS_CAP_SUPPORT_MSB = 1, + + /* GNSS supports MS-Assisted AGNSS mode */ + GNSS_CAP_SUPPORT_MSA = 2, + + /* GNSS supports Geofencing */ + GNSS_CAP_SUPPORT_GEOFENCING = 4, + + /* GNSS supports Measurements. */ + GNSS_CAP_SUPPORT_MEASUREMENTS = 8, + + /* GNSS supports Navigation Messages */ + GNSS_CAP_SUPPORT_NAV_MESSAGES = 16, + + /* GNSS supports location caching */ + GNSS_CAP_SUPPORT_GNSS_CACHE = 32, +}; + +/* + * @brief Defines the GNSS satellite type. + * + * @since 5.0 + */ +enum ConstellationCategory { + CONSTELLATION_CATEGORY_UNKNOWN = 0, + CONSTELLATION_CATEGORY_GPS = 1, + CONSTELLATION_CATEGORY_SBAS = 2, + CONSTELLATION_CATEGORY_GLONASS = 3, + CONSTELLATION_CATEGORY_QZSS = 4, + CONSTELLATION_CATEGORY_BEIDOU = 5, + CONSTELLATION_CATEGORY_GALILEO = 6, + CONSTELLATION_CATEGORY_IRNSS = 7, + CONSTELLATION_CATEGORY_MAXIMUM = 8, +}; + +/* + * @brief Indicates the satellite additional information. + * + * @since 5.0 + */ +enum SatelliteAdditionalInfo { + SATELLITES_ADDITIONAL_INFO_NULL = 0, + SATELLITES_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST = 1, + SATELLITES_ADDITIONAL_INFO_ALMANAC_DATA_EXIST = 2, + SATELLITES_ADDITIONAL_INFO_USED_IN_FIX = 4, + SATELLITES_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST = 8, +}; + +/* + * @brief Defines the type of GNSS NI request. + * + * @since 5.0 + */ +enum GnssNiRequestCategory { + GNSS_NI_REQUEST_CATEGORY_EMERGENCY_SUPL = 1, + GNSS_NI_REQUEST_CATEGORY_VOICE = 2, + GNSS_NI_REQUEST_CATEGORY_UMTS_CONTROL_PLANE = 3, + GNSS_NI_REQUEST_CATEGORY_UMTS_SUPL = 4, +}; + +/* + * @brief Defines the GNSS NI response command. + * + * @since 5.0 + */ +enum GnssNiResponseCmd { + GNSS_NI_RESPONSE_CMD_ACCEPT = 1, + GNSS_NI_RESPONSE_CMD_NO_RESPONSE = 2, + GNSS_NI_RESPONSE_CMD_REJECT = 3, +}; + +/* + * @brief Defines the type of GNSS NI notification. + * + * @since 5.0 + */ +enum GnssNiNotificationCategory { + GNSS_NI_NOTIFICATION_REQUIRE_NOTIFY = 1, + GNSS_NI_NOTIFICATION_REQUIRE_VERIFY = 2, + GNSS_NI_NOTIFICATION_REQUIRE_PRIVACY_OVERRIDE = 4, +}; + +/* + * @brief Defines the encoding format of GNSS NI request. + * + * @since 5.0 + */ +enum GnssNiRequestEncodingFormat { + GNSS_NI_ENCODING_FORMAT_NULL = 1, + GNSS_NI_ENCODING_FORMAT_SUPL_GSM_DEFAULT = 2, + GNSS_NI_ENCODING_FORMAT_SUPL_UCS2 = 3, + GNSS_NI_ENCODING_FORMAT_SUPL_UTF8 = 4, +}; + +/* + * @brief Defines the satellite status information structure reported by the GNSS chip. + * + * @since 5.0 + */ +struct SatelliteStatusInfo { + unsigned int satellitesNumber; + + /* Satellite ID number for the satellite. */ + short[] satelliteIds; + + /* Defines the constellation type of the given satellite. */ + enum ConstellationCategory[] constellation; + + /* Carrier-to-noise density in dB-Hz. */ + float[] carrierToNoiseDensitys; + + /* Elevation of SV in degrees. */ + float[] elevation; + + /* Azimuth of SV in degrees. */ + float[] azimuths; + + /* Carrier frequency of the signal tracked. */ + float[] carrierFrequencies; + + enum SatelliteAdditionalInfo[] additionalInfo; +}; + +/* + * @brief Defines basic GNSS configuration information. + * + * @since 5.0 + */ +struct GnssBasicConfig { + /* Minimus interval between locations in millisecond */ + unsigned int minInterval; + + enum GnssWorkingMode gnssMode; +}; + +/* + * @brief Defines the configuration information of the GNSS cache function. + * + * @since 5.0 + */ +struct GnssCachingConfig { + /* Minimus interval between locations in millisecond */ + unsigned int interval; + + /* If the value is true, the cached locations are reported + * and the AP is woken up after the FIFO is full. + */ + boolean fifoFullNotify; +}; + +/* + * @brief Defines the GNSS configuration information structure, including common GNSS configuration + * parameters and GNSS cache configuration parameters. + * + * @since 5.0 + */ +struct GnssConfigPara { + struct GnssBasicConfig gnssBasic; + struct GnssCachingConfig gnssCaching; +}; + +/* + * @brief Defines the GNSS reference time. + * + * @since 5.0 + */ +struct GnssRefTime { + /* UTC time received from the NTP server, Milliseconds since January 1, 1970. */ + long time; + + /* Time since the system was booted, and include deep sleep. The unit is milliseconds. */ + long elapsedRealtime; + + /* This is uncertainty of time. The unit is milliseconds. */ + long uncertaintyOfTime; +}; + +/* + * @brief Defines the GNSS positioning result structure. + * + * @since 5.0 + */ +struct LocationInfo { + enum GnssLocationValidity fieldValidity; + + double latitude; + + double longitude; + + /* Altitude in meters. */ + double altitude; + + /* Speed in meters per second. */ + float speed; + + /* Heading in degrees. */ + float bearing; + + /* Horizontal position accuracy in meters. */ + float horizontalAccuracy; + + /* Vertical position accuracy in meters. */ + float verticalAccuracy; + + /* Speed accuracy in meter per seconds. */ + float speedAccuracy; + + /* Bearing accuracy in degrees. */ + float bearingAccuracy; + + /* Timestamp for the location fix. Number of milliseconds since January 1, 1970. */ + long timeForFix; + + /* Time since the system was booted, and include deep sleep. The unit is nanosecond. */ + long timeSinceBoot; + + /* Time uncertainty in nanosecond. */ + long timeUncertainty; +}; + +/* + * @brief Defines the GNSS reference information structure, including the reference time and reference location. + * + * @since 5.0 + */ +struct GnssRefInfo { + enum GnssRefInfoType type; + struct GnssRefTime time; + struct LocationInfo gnssLocation; + struct LocationInfo bestLocation; +}; + + +/* + * @brief Defines the GNSS NI notification request structure. + * + * @since 5.0 + */ +struct GnssNiNotificationRequest { + /* An ID of GNSS NI notifications. */ + short gnssNiNotificationId; + + /* Category of GNSS NI Request. */ + enum GnssNiRequestCategory gnssNiRequestCategory; + + /* Category of notification. */ + enum GnssNiNotificationCategory notificationCategory; + + /* Timeout to wait for user response. The unit is seconds. */ + int requestTimeout; + + /* Default response command when timeout. */ + int defaultResponseCmd; + + /* Supplicant information. */ + String supplicantInfo; + + /* Notification message text. */ + String notificationText; + + /* Supplicant info encoding format. */ + enum GnssNiRequestEncodingFormat supplicantInfoEncoding; + + /* Notification text encoding format. */ + enum GnssNiRequestEncodingFormat notificationTextEncoding; +}; +/** @} */ \ No newline at end of file diff --git a/location/gnss/v2_0/IGnssCallback.idl b/location/gnss/v2_0/IGnssCallback.idl new file mode 100644 index 00000000..879756c3 --- /dev/null +++ b/location/gnss/v2_0/IGnssCallback.idl @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2024 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 HdiGnss + * @{ + * + * @brief Provides unified APIs for GNSS services to access GNSS drivers. + * + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, + * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, + * obtain the satellite status information, and obtain the cache location information. + * + * @since 5.0 + */ + +/* + * @file IGnssCallback.idl + * + * @brief Declares the callbacks for obtain the positioning result, obtain the working status of the GNSS module, + * obtain the nmea, obtain GNSS capability, obtain the satellite status information, and obtain the cache location, + * and request upper-layer ingest reference information, Request upper-layer to inject PGNSS data. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.gnss.v2_0; + +import ohos.hdi.location.gnss.v2_0.GnssTypes; + +/* + * @brief Defines the callbacks for obtain the positioning result, obtain the working status of the GNSS module, + * obtain the nmea, obtain GNSS capability, obtain the satellite status information, and obtain the cache location, + * and request upper-layer ingest reference information, Request upper-layer to inject PGNSS data. + * + * @since 5.0 + */ +[callback] interface IGnssCallback { + /* + * @brief Location reporting. + * + * @param location Indicates GNSS location result. For details, see {@link Location}. + * @return Returns 0 If the location reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportLocation([in] struct LocationInfo location); + + /* + * @brief Reporting the working status of the GNSS module. + * + * @param status Indicates the working status of the GNSS module. For details, see {@link GnssWorkingStatus}. + * @return Returns 0 If the reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGnssWorkingStatus([in] enum GnssWorkingStatus status); + + /* + * @brief Reporting NMEA. + * + * @param timestamp Indicates the timestamp when the NMEA is reported. Milliseconds since January 1, 1970. + * @param nmea Indicates NMEA sentences, follows standard NMEA 0183. + * @param length Indicates length of NMEA sentences. + * @return Returns 0 If the reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportNmea([in] long timestamp, [in] String nmea, [in] int length); + + /* + * @brief GNSS capability reporting. + * + * @param capabilities Indicates the GNSS capability. For details, see {@link GnssCapabilities}. + * @return Returns 0 If the reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGnssCapabilities([in] enum GnssCapabilities capabilities); + + /* + * @brief Satellite status information reporting. + * + * @param info Indicates the satellite status information structure reported by the GNSS chip. + * For details, see {@link SatelliteStatusInfo}. + * @return Returns 0 If the reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportSatelliteStatusInfo([in] struct SatelliteStatusInfo info); + + /* + * @brief Request upper-layer ingest reference information. + * + * @param type Indicates the GNSS reference information type. For details, see {@link GnssRefInfoType}. + * @return Returns 0 If sending request is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestGnssReferenceInfo([in] enum GnssRefInfoType type); + + /* + * @brief Request upper-layer to inject PGNSS data. + * + * @return Returns 0 If sending request is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + RequestPredictGnssData(); + + /* + * @brief Report all location information cached by the bottom-layer GNSS module to the upper layer. + * + * @param gnssLocations Indicates all locations of the GNSS chip cache. For details, see {@link Location}. + * @return Returns 0 If the reporting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportCachedLocation([in] struct LocationInfo[] gnssLocations); + + /* + * @brief Report GNSS Ni notification. + * + * @param notification Indicates the GNSS Ni notification. + * @return Returns 0 if reporting is successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + ReportGnssNiNotification([in] struct GnssNiNotificationRequest notification); +} +/** @} */ \ No newline at end of file diff --git a/location/gnss/v2_0/IGnssInterface.idl b/location/gnss/v2_0/IGnssInterface.idl new file mode 100644 index 00000000..2568e256 --- /dev/null +++ b/location/gnss/v2_0/IGnssInterface.idl @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2024 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 HdiGnss + * @{ + * + * @brief Provides unified APIs for GNSS services to access GNSS drivers. + * + * A GNSS service can obtain a GNSS driver object or agent and then call APIs provided by this object or agent to + * access GNSS devices, thereby Start the GNSS chip, start the navigation, + * set the GNSS working mode, inject reference information, obtain the positioning result, obtain the nmea, + * obtain the satellite status information, and obtain the cache location information. + * + * @since 5.0 + */ + +/* + * @file IGnssInterface.idl + * + * @brief Declares the APIs provided by the GNSS module for Start the GNSS chip, start the navigation, + * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data, + * obtain the number of GNSS cache locations, and obtain all cache locations. + * + * @since 5.0 + * @version 2.0 + */ + +package ohos.hdi.location.gnss.v2_0; + +import ohos.hdi.location.gnss.v2_0.IGnssCallback; +import ohos.hdi.location.gnss.v2_0.GnssTypes; + +/* + * @brief Defines the functions for performing basic operations on GNSS. + * + * The functions include Start the GNSS chip, start the navigation, + * set the GNSS working mode, inject reference information, Delete auxiliary data, inject PGNSS data, + * obtain the number of GNSS cache locations, and obtain all cache locations. + * + * @since 5.0 + */ +interface IGnssInterface { + /* + * @brief Setting GNSS configuration parameters. + * + * @param para Indicates GNSS configuration parameters, including basic GNSS parameters and GNSS cache + * function configuration parameters. For details, see {@link GnssConfigPara}. + * @return Returns 0 If the setting is successful; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetGnssConfigPara([in] struct GnssConfigPara para); + + /* + * @brief Enable the GNSS module and transmit the callback of the upper layer to the GNSS module. + * + * @param callback Indicates Callback function sent by the upper layer to the GNSS driver. The GNSS driver returns + * location results and satellite status information by the callbacks. For details, see {@link IGnssCallback}. + * @return Returns 0 if the GNSS is successfully enabled; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + EnableGnss([in] IGnssCallback callbackObj); + + /* + * @brief Disable the GNSS module. + * + * @return Returns 0 if the GNSS is successfully disabled; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + DisableGnss(); + + /* + * @brief Start the navigation function. + * + * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning + * and GNSS caching function. For details, see {@link GnssStartType}. + * @return Returns 0 if the GNSS navigation is successfully started; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + StartGnss([in] enum GnssStartType type); + + /* + * @brief Stop the navigation function. + * + * @param type Indicates the GNSS startup type, which is used to distinguish between common GNSS positioning + * and GNSS caching function. For details, see {@link GnssStartType}. + * @return Returns 0 if the GNSS navigation is successfully stopped; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + StopGnss([in] enum GnssStartType type); + + /* + * @brief Inject reference information to the GNSS module. + * + * @param refInfo Indicates the GNSS reference information structure, including the reference time and reference + * location. For details, see {@link GnssRefInfo}. + * @return Returns 0 if ingestion succeeded; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetGnssReferenceInfo([in] struct GnssRefInfo refInfo); + + /* + * @brief Delete the specified auxiliary data. + * + * @param data Indicates the type of auxiliary data to be deleted. For details, see {@link GnssAuxiliaryDataType}. + * @return Returns 0 if deleted successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + DeleteAuxiliaryData([in] enum GnssAuxiliaryDataType data); + + /* + * @brief Ingesting Predict Gnss Data. + * + * @param data Indicates Predict Gnss Data. + * @return Returns 0 if ingesting successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SetPredictGnssData([in] String data); + + /* + * @brief Obtain the number of locations that can be cached by the GNSS module. + * + * @param size Indicates an output parameter used to receive the number of locations that can be + * cached by the GNSS module. + * @return Returns 0 if obtain size successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + GetCachedGnssLocationsSize([out] int size); + + /* + * @brief Request to obtain all the location information in the GNSS cache at a time and clear the cache buffer. + * The cache location is reported through callback. + * + * @return Returns 0 if sending request successfully; returns a negative value otherwise. + * @since 5.0 + * @version 2.0 + */ + GetCachedGnssLocations(); + + /* + * @brief Send NI user response command. + * + * @param gnssNiNotificationId Indicates the id of GNSS NI notifications. + * @param userResponse Indicates user reponse command. + * @return Returns 0 if sending response successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SendNiUserResponse([in] int gnssNiNotificationId, [in] enum GnssNiResponseCmd userResponse); + + /* + * @brief Send network initiated message. + * + * @param msg Indicates the network initiated message. + * @param length Indicates length of network initiated message. + * @return Returns 0 if sending message successfully; returns a negative value otherwise. + * + * @since 5.0 + * @version 2.0 + */ + SendNetworkInitiatedMsg([in] String msg, [in] int length); +} +/** @} */ \ No newline at end of file -- Gitee From 5640055f578c9e7b33355d45df007922fd2a9750 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Wed, 27 Mar 2024 14:19:05 +0800 Subject: [PATCH 138/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=93=E4=B8=9A?= =?UTF-8?q?=E6=8B=8D=E7=85=A7=E6=A8=A1=E5=BC=8Ftag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinjihong --- camera/metadata/include/camera_device_ability_items.h | 2 ++ camera/metadata/include/camera_metadata_item_info.h | 3 +++ camera/metadata/src/camera_metadata_info.cpp | 2 ++ camera/metadata/src/metadata_utils.cpp | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index a4d8011e..67e6cb8e 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -181,6 +181,8 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, OHOS_CONTROL_MOVING_PHOTO, + OHOS_ABILITY_SENSOR_WB_VALUES, + OHOS_CONTROL_SENSOR_WB_VALUE, OHOS_DEVICE_CONTROL_END, // Camera device image acquisition related diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 4b4ef41e..d1fd0887 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -179,6 +179,9 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON [OHOS_STATUS_SENSOR_EXPOSURE_TIME - OHOS_DEVICE_CONTROL_START] = {"currentSensorExposureTime", META_TYPE_RATIONAL, 1}, [OHOS_CONTROL_MOVING_PHOTO - OHOS_DEVICE_CONTROL_START] = {"movingPhoto", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_SENSOR_WB_VALUES - + OHOS_DEVICE_CONTROL_START] = {"supportedSensorWbValues", META_TYPE_INT32, -1}, + [OHOS_CONTROL_SENSOR_WB_VALUE - OHOS_DEVICE_CONTROL_START] = {"sensorWbValue", META_TYPE_INT32, 1}, }; static item_info_t g_ohosDeviceExposure[OHOS_DEVICE_EXPOSURE_END - OHOS_DEVICE_EXPOSURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index b9bdfee2..e6bf1564 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -105,6 +105,8 @@ const std::vector g_metadataTags = { OHOS_CONTROL_SENSOR_EXPOSURE_TIME, OHOS_STATUS_SENSOR_EXPOSURE_TIME, OHOS_CONTROL_MOVING_PHOTO, + OHOS_ABILITY_SENSOR_WB_VALUES, + OHOS_CONTROL_SENSOR_WB_VALUE, // Camera device image acquisition related OHOS_ABILITY_DEVICE_AVAILABLE_EXPOSUREMODES, diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index 8791a44d..369d838e 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -293,7 +293,7 @@ void MetadataUtils::ConvertVecToMetadata(const std::vector& cameraAbili ReadData(item.data_type, index, cameraAbility); ReadData(item.count, index, cameraAbility); if (item.count > MAX_SUPPORTED_ITEMS) { - METADATA_ERR_LOG("MetadataUtils::DecodeCameraMetadata item.count out of range:%u", item.count); + METADATA_ERR_LOG("MetadataUtils::ConvertVecToMetadata item.count out of range:%u", item.count); return; } ReadMetadataDataFromVec(index, item, cameraAbility); -- Gitee From f6e0c052bb4333f2e28a06603389b53eedd460d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A8=8A=E6=99=AF=E4=B9=90?= Date: Wed, 27 Mar 2024 07:01:05 +0000 Subject: [PATCH 139/210] fix:Add dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 樊景乐 --- .../v1_0/display_command/display_cmd_responser.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index a1e639b1..ac06c53b 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -413,6 +413,9 @@ EXIT: ret = devCache->SetDisplayClientBuffer(data.buffer, data.seqNo, needFreeBuffer, [&](const BufferHandle& handle)->int32_t { +#ifdef DISPLAY_COMSPOER_DEBUG_DUMP + DumpLayerBuffer(data.devId, data.seqNo, data.fence, handle, "client_"); +#endif int rc = impl_->SetDisplayClientBuffer(data.devId, handle, fdParcel.GetFd()); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); return HDF_SUCCESS; @@ -810,7 +813,7 @@ EXIT: ret = layerCache->SetLayerBuffer(data.buffer, data.seqNo, needFreeBuffer, deletingList, [&](const BufferHandle& handle)->int32_t { #ifdef DISPLAY_COMSPOER_DEBUG_DUMP - DumpLayerBuffer(data.devId, data.layerId, data.fence, handle); + DumpLayerBuffer(data.devId, data.layerId, data.fence, handle, "layer_"); #endif int rc = impl_->SetLayerBuffer(data.devId, data.layerId, handle, fdParcel.GetFd()); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); @@ -959,7 +962,8 @@ EXIT: return strStream.str(); } #ifdef DISPLAY_COMSPOER_DEBUG_DUMP - static void DumpLayerBuffer(uint32_t devId, uint32_t layerId, int32_t fence, const BufferHandle& buffer) + static void DumpLayerBuffer(uint32_t devId, uint32_t layerId, int32_t fence, const BufferHandle& buffer, + std::string tag) { const std::string SWITCH_ON = "on"; const uint32_t DUMP_BUFFER_SWITCH_LEN = 4; @@ -987,7 +991,7 @@ EXIT: const std::string PATH_PREFIX = "/data/local/traces/"; std::stringstream filePath; - filePath << PATH_PREFIX << fileName; + filePath << PATH_PREFIX << tag << fileName; std::ofstream rawDataFile(filePath.str(), std::ofstream::binary); DISPLAY_CHECK((!rawDataFile.good()), HDF_LOGE("open file failed, %{public}s", std::strerror(errno))); -- Gitee From ae5c5a5ed32cc1a7d46a1f42e3309403c5da06a5 Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 28 Mar 2024 14:53:02 +0800 Subject: [PATCH 140/210] add NNRt gatherNd ops Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 06dd8e25..507ed4e6 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -2686,4 +2686,25 @@ struct QuantDTypeCastV2 long axis; }; +/** + * @brief Gathers slices from a tensor by indices. + * + * The {@link NodeType} of this operator is NODE_TYPE_GATHER_ND. + * + * Input: + * + * * x, the target tensor to gather values. + * * indices, the index tensor with int32 or int64 data type. + * + * Output: + * + * * Sliced tensor. Has the same type as input_x and the shape is indices_shape[:-1] + x_shape[indices_shape[-1]:]. + * + * @since 5.0 + * @version 2.1 + */ +struct GatherNd +{ +}; + /** @} */ -- Gitee From 08ce2f0452d47cc5f33ea494944242b376bbf6c1 Mon Sep 17 00:00:00 2001 From: maoyong Date: Thu, 28 Mar 2024 15:03:22 +0800 Subject: [PATCH 141/210] update ops Signed-off-by: maoyong --- nnrt/v2_1/NodeAttrTypes.idl | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/nnrt/v2_1/NodeAttrTypes.idl b/nnrt/v2_1/NodeAttrTypes.idl index 507ed4e6..25f04774 100644 --- a/nnrt/v2_1/NodeAttrTypes.idl +++ b/nnrt/v2_1/NodeAttrTypes.idl @@ -2659,52 +2659,52 @@ struct LogSoftmax }; /** - * @brief Converts the data type. + * @brief Gathers slices from a tensor by indices. * - * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST_V2. - * The v1 version {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST, - * and the corresponding NodeAttrType is {@link QuantDTypeCast}. + * The {@link NodeType} of this operator is NODE_TYPE_GATHER_ND. * * Input: * - * * x, an n-dimensional tensor. + * * x, the target tensor to gather values. + * * indices, the index tensor with int32 or int64 data type. * * Output: * - * * Tensor after the data type conversion. + * * Sliced tensor. Has the same type as input_x and the shape is indices_shape[:-1] + x_shape[indices_shape[-1]:]. * * @since 5.0 * @version 2.1 */ -struct QuantDTypeCastV2 +struct GatherNd { - /** Data type of the input tensor. */ - long srcT; - /** Data type of the output tensor. */ - long dstT; - /** The axis to apply QuantDTypeCastV2 operation. */ - long axis; }; /** - * @brief Gathers slices from a tensor by indices. + * @brief Converts the data type. * - * The {@link NodeType} of this operator is NODE_TYPE_GATHER_ND. + * The {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST_V2. + * The v1 version {@link NodeType} of this operator is NODE_TYPE_QUANT_DTYPE_CAST, + * and the corresponding NodeAttrType is {@link QuantDTypeCast}. * * Input: * - * * x, the target tensor to gather values. - * * indices, the index tensor with int32 or int64 data type. + * * x, an n-dimensional tensor. * * Output: * - * * Sliced tensor. Has the same type as input_x and the shape is indices_shape[:-1] + x_shape[indices_shape[-1]:]. + * * Tensor after the data type conversion. * * @since 5.0 * @version 2.1 */ -struct GatherNd +struct QuantDTypeCastV2 { + /** Data type of the input tensor. */ + long srcT; + /** Data type of the output tensor. */ + long dstT; + /** The axis to apply QuantDTypeCastV2 operation. */ + long axis; }; /** @} */ -- Gitee From d97446bae20512a23b9a6c5482d91cc7e8e5a9e6 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Thu, 28 Mar 2024 15:21:00 +0800 Subject: [PATCH 142/210] fix security alarm Signed-off-by: qinjihong --- .../metadata/include/camera_metadata_info.h | 4 + camera/metadata/include/metadata_utils.h | 2 + camera/metadata/src/camera_metadata_info.cpp | 96 ++++++++++++++----- camera/metadata/src/metadata_utils.cpp | 46 +++++++-- 4 files changed, 118 insertions(+), 30 deletions(-) diff --git a/camera/metadata/include/camera_metadata_info.h b/camera/metadata/include/camera_metadata_info.h index ac5a8dc4..448d0b8d 100644 --- a/camera/metadata/include/camera_metadata_info.h +++ b/camera/metadata/include/camera_metadata_info.h @@ -48,6 +48,10 @@ private: common_metadata_header_t *dst, const void *data); static int AddCameraMetadataItemVerify(common_metadata_header_t *dst, uint32_t item, const void *data, size_t dataCount, uint32_t *dataType); + static int moveMetadataMemery(common_metadata_header_t *dst, + camera_metadata_item_entry_t *itemToDelete, size_t dataBytes); + static int copyMetadataMemory(common_metadata_header_t *dst, camera_metadata_item_entry_t *item, + size_t dataPayloadSize, const void *data); public: // Allocate a new camera metadata buffer and return the metadata header diff --git a/camera/metadata/include/metadata_utils.h b/camera/metadata/include/metadata_utils.h index 041451df..0cb78ebb 100644 --- a/camera/metadata/include/metadata_utils.h +++ b/camera/metadata/include/metadata_utils.h @@ -48,6 +48,8 @@ private: static void WriteMetadataDataToVec(const camera_metadata_item_t &entry, std::vector& cameraAbility); static void ReadMetadataDataFromVec(int32_t &index, camera_metadata_item_t &entry, const std::vector& cameraAbility); + static int copyEncodeToStringMem(common_metadata_header_t *meta, char *encodeData, int32_t encodeDataLen); + static int copyDecodeFromStringMem(common_metadata_header_t *meta, char *decodeData); }; template diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index e6bf1564..cc335f82 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -662,7 +662,12 @@ int CameraMetadata::AddCameraMetadataItem(common_metadata_header_t *dst, uint32_ } } else { metadataItem->data.offset = dst->data_count; - ret = memcpy_s(GetMetadataData(dst) + metadataItem->data.offset, dst->data_capacity - dst->data_count, data, + uint8_t *dstMetadataData = GetMetadataData(dst); + if (dstMetadataData == nullptr) { + METADATA_ERR_LOG("AddCameraMetadataItem GetMetadataData failed"); + return CAM_META_FAILURE; + } + ret = memcpy_s(dstMetadataData + metadataItem->data.offset, dst->data_capacity - dst->data_count, data, dataPayloadBytes); if (ret != EOK) { METADATA_ERR_LOG("AddCameraMetadataItem memory copy failed"); @@ -706,7 +711,12 @@ int CameraMetadata::GetCameraMetadataItem(const common_metadata_header_t *src, u if (dataBytes == 0) { item->data.u8 = localItem->data.value; } else { - item->data.u8 = GetMetadataData(src) + localItem->data.offset; + uint8_t *srcMetadataData = GetMetadataData(src); + if (srcMetadataData == nullptr) { + METADATA_ERR_LOG("GetCameraMetadataItem GetMetadataData failed"); + return CAM_META_FAILURE; + } + item->data.u8 = srcMetadataData + localItem->data.offset; } METADATA_DEBUG_LOG("GetCameraMetadataItem end"); @@ -773,7 +783,12 @@ int CameraMetadata::MetadataExpandItemMem(common_metadata_header_t *dst, camera_ METADATA_ERR_LOG("MetadataExpandItemMem item is null or dst is null"); return CAM_META_INVALID_PARAM; } - uint8_t *start = GetMetadataData(dst) + item->data.offset; + uint8_t *dstMetadataData = GetMetadataData(dst); + if (dstMetadataData == nullptr) { + METADATA_ERR_LOG("MetadataExpandItemMem GetMetadataData failed"); + return CAM_META_FAILURE; + } + uint8_t *start = dstMetadataData + item->data.offset; uint8_t *end = start + oldItemSize; size_t length = dst->data_count - item->data.offset - oldItemSize; if (length != 0) { @@ -793,6 +808,23 @@ int CameraMetadata::MetadataExpandItemMem(common_metadata_header_t *dst, camera_ return CAM_META_SUCCESS; } +int CameraMetadata::copyMetadataMemory(common_metadata_header_t *dst, camera_metadata_item_entry_t *item, + size_t dataPayloadSize, const void *data) +{ + uint8_t *dstMetadataData = GetMetadataData(dst); + int32_t ret = CAM_META_SUCCESS; + if (dstMetadataData == nullptr) { + METADATA_ERR_LOG("UpdateameraMetadataItemSize GetMetadataData failed"); + return CAM_META_FAILURE; + } + ret = memcpy_s(dstMetadataData + item->data.offset, dataPayloadSize, data, dataPayloadSize); + if (ret != EOK) { + METADATA_ERR_LOG("UpdateCameraMetadataItemByIndex memory copy failed"); + return CAM_META_FAILURE; + } + return CAM_META_SUCCESS; +} + int CameraMetadata::UpdateameraMetadataItemSize(camera_metadata_item_entry_t *item, uint32_t dataCount, common_metadata_header_t *dst, const void *data) { @@ -819,18 +851,16 @@ int CameraMetadata::UpdateameraMetadataItemSize(camera_metadata_item_entry_t *it if (dataSize != 0) { item->data.offset = dst->data_count; - ret = memcpy_s(GetMetadataData(dst) + item->data.offset, dataPayloadSize, data, dataPayloadSize); - if (ret != EOK) { - METADATA_ERR_LOG("UpdateCameraMetadataItemByIndex memory copy failed"); - return CAM_META_FAILURE; + ret = copyMetadataMemory(dst, item, dataPayloadSize, data); + if (ret != CAM_META_SUCCESS) { + return ret; } dst->data_count += dataSize; } } else if (dataSize != 0) { - ret = memcpy_s(GetMetadataData(dst) + item->data.offset, dataPayloadSize, data, dataPayloadSize); - if (ret != EOK) { - METADATA_ERR_LOG("UpdateCameraMetadataItemByIndex memory copy failed"); - return CAM_META_FAILURE; + ret = copyMetadataMemory(dst, item, dataPayloadSize, data); + if (ret != CAM_META_SUCCESS) { + return ret; } } @@ -904,6 +934,28 @@ int CameraMetadata::UpdateCameraMetadataItem(common_metadata_header_t *dst, uint return UpdateCameraMetadataItemByIndex(dst, index, data, dataCount, updatedItem); } +int CameraMetadata::moveMetadataMemery(common_metadata_header_t *dst, camera_metadata_item_entry_t *itemToDelete, + size_t dataBytes) +{ + uint8_t *dstMetadataData = GetMetadataData(dst); + if (dstMetadataData == nullptr) { + METADATA_ERR_LOG("UpdateameraMetadataItemSize GetMetadataData failed"); + return CAM_META_FAILURE; + } + int32_t ret = CAM_META_SUCCESS; + uint8_t *start = dstMetadataData + itemToDelete->data.offset; + uint8_t *end = start + dataBytes; + size_t length = dst->data_count - itemToDelete->data.offset - dataBytes; + if (length != 0) { + ret = memmove_s(start, length, end, length); + if (ret != EOK) { + METADATA_ERR_LOG("DeleteCameraMetadataItemByIndex memory move failed"); + return CAM_META_FAILURE; + } + } + return CAM_META_SUCCESS; +} + int CameraMetadata::DeleteCameraMetadataItemByIndex(common_metadata_header_t *dst, uint32_t index) { METADATA_DEBUG_LOG("DeleteCameraMetadataItemByIndex start"); @@ -921,15 +973,9 @@ int CameraMetadata::DeleteCameraMetadataItemByIndex(common_metadata_header_t *ds camera_metadata_item_entry_t *itemToDelete = GetMetadataItems(dst) + index; size_t dataBytes = CalculateCameraMetadataItemDataSize(itemToDelete->data_type, itemToDelete->count); if (dataBytes > 0) { - uint8_t *start = GetMetadataData(dst) + itemToDelete->data.offset; - uint8_t *end = start + dataBytes; - size_t length = dst->data_count - itemToDelete->data.offset - dataBytes; - if (length != 0) { - ret = memmove_s(start, length, end, length); - if (ret != EOK) { - METADATA_ERR_LOG("DeleteCameraMetadataItemByIndex memory move failed"); - return CAM_META_FAILURE; - } + ret = moveMetadataMemery(dst, itemToDelete, dataBytes); + if (ret != CAM_META_SUCCESS) { + return ret; } dst->data_count -= dataBytes; @@ -1020,8 +1066,14 @@ int32_t CameraMetadata::CopyCameraMetadataItems(common_metadata_header_t *newMet } if (oldMetadata->data_count != 0) { - ret = memcpy_s(GetMetadataData(newMetadata), sizeof(uint8_t[oldMetadata->data_count]), - GetMetadataData(oldMetadata), sizeof(uint8_t[oldMetadata->data_count])); + uint8_t *newMetadataData = GetMetadataData(newMetadata); + uint8_t *oldMetadataData = GetMetadataData(oldMetadata); + if (newMetadataData == nullptr || oldMetadataData == nullptr) { + METADATA_ERR_LOG("UpdateameraMetadataItemSize GetMetadataData failed"); + return CAM_META_FAILURE; + } + ret = memcpy_s(newMetadataData, sizeof(uint8_t[oldMetadata->data_count]), oldMetadataData, + sizeof(uint8_t[oldMetadata->data_count])); if (ret != EOK) { METADATA_ERR_LOG("CopyCameraMetadataItems memory copy failed"); return CAM_META_FAILURE; diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index 369d838e..91e2c877 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -451,9 +451,8 @@ std::string MetadataUtils::EncodeToString(std::shared_ptr metada } if (meta->data_count != 0) { - ret = memcpy_s(encodeData, encodeDataLen, GetMetadataData(meta), meta->data_count); - if (ret != EOK) { - METADATA_ERR_LOG("MetadataUtils::EncodeToString Failed to copy memory for data"); + ret = copyEncodeToStringMem(meta, encodeData, encodeDataLen); + if (ret != CAM_META_SUCCESS) { return {}; } encodeData += meta->data_count; @@ -464,6 +463,22 @@ std::string MetadataUtils::EncodeToString(std::shared_ptr metada return s; } +int MetadataUtils::copyEncodeToStringMem(common_metadata_header_t *meta, char *encodeData, int32_t encodeDataLen) +{ + uint8_t *metaMetadataData = GetMetadataData(meta); + int32_t ret = CAM_META_SUCCESS; + if (metaMetadataData == nullptr) { + METADATA_ERR_LOG("MetadataUtils::EncodeToString GetMetadataData failed"); + return CAM_META_FAILURE; + } + ret = memcpy_s(encodeData, encodeDataLen, metaMetadataData, meta->data_count); + if (ret != EOK) { + METADATA_ERR_LOG("MetadataUtils::EncodeToString Failed to copy memory for data"); + return CAM_META_FAILURE; + } + return CAM_META_SUCCESS; +} + std::shared_ptr MetadataUtils::DecodeFromString(std::string setting) { uint32_t ret; @@ -514,11 +529,10 @@ std::shared_ptr MetadataUtils::DecodeFromString(std::string sett if (meta->data_count != 0) { IF_COND_PRINT_MSG_AND_RETURN(totalLen < static_cast(((decodeData - &setting[0]) + meta->data_count)), "MetadataUtils::DecodeFromString Failed at data copy") - ret = memcpy_s(GetMetadataData(meta), meta->data_count, decodeData, meta->data_count); - - IF_COND_PRINT_MSG_AND_RETURN(ret != EOK, - "MetadataUtils::DecodeFromString Failed to copy memory for item data field") - decodeData += meta->data_count; + ret = copyDecodeFromStringMem(meta, decodeData); + if (ret != CAM_META_SUCCESS) { + return {}; + } } METADATA_DEBUG_LOG("MetadataUtils::DecodeFromString String length: %{public}zu, Decoded length: %{public}zu", @@ -526,6 +540,22 @@ std::shared_ptr MetadataUtils::DecodeFromString(std::string sett return metadata; } +int MetadataUtils::copyDecodeFromStringMem(common_metadata_header_t *meta, char *decodeData) +{ + uint8_t *metaMetadataData = GetMetadataData(meta); + uint32_t ret; + if (metaMetadataData == nullptr) { + METADATA_ERR_LOG("MetadataUtils::DecodeFromString GetMetadataData failed"); + return CAM_META_FAILURE; + } + ret = memcpy_s(metaMetadataData, meta->data_count, decodeData, meta->data_count); + + IF_COND_PRINT_MSG_AND_RETURN(ret != EOK, + "MetadataUtils::DecodeFromString Failed to copy memory for item data field") + decodeData += meta->data_count; + return CAM_META_SUCCESS; +} + static void ReadMetadataUInt8(camera_metadata_item_t &entry, MessageParcel &data) { std::vector buffers; -- Gitee From def5c6342c40f855486f5988c46e2a888cdd8c0b Mon Sep 17 00:00:00 2001 From: yiyajun Date: Wed, 27 Mar 2024 15:42:41 +0800 Subject: [PATCH 143/210] hal Signed-off-by: yiyajun --- wlan/chip/v1_0/BUILD.gn | 2 +- wlan/chip/v1_0/ChipTypes.idl | 70 +++++- wlan/chip/v1_0/IChipController.idl | 98 +++++++- wlan/chip/v1_0/IChipControllerCallback.idl | 45 +++- wlan/chip/v1_0/IChipIface.idl | 66 +++++- wlan/chip/v1_0/IConcreteChip.idl | 248 +++++++++++++++++++-- wlan/chip/v1_0/IConcreteChipCallback.idl | 34 ++- 7 files changed, 539 insertions(+), 24 deletions(-) diff --git a/wlan/chip/v1_0/BUILD.gn b/wlan/chip/v1_0/BUILD.gn index 9ecd0118..df4fc360 100644 --- a/wlan/chip/v1_0/BUILD.gn +++ b/wlan/chip/v1_0/BUILD.gn @@ -34,4 +34,4 @@ if (defined(ohos_lite)) { subsystem_name = "hdf" part_name = "drivers_interface_wlan" } -} \ No newline at end of file +} diff --git a/wlan/chip/v1_0/ChipTypes.idl b/wlan/chip/v1_0/ChipTypes.idl index 8d45590f..962a7e25 100644 --- a/wlan/chip/v1_0/ChipTypes.idl +++ b/wlan/chip/v1_0/ChipTypes.idl @@ -13,8 +13,43 @@ * limitations under the License. */ +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file ChipTypes.idl + * + * @brief Provides the enumerated variables, structures in CHIP APIs. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; +/** + * @brief Enumerates the code of status. + * + * @since 5.0 + * @version 1.0 + */ enum ErrorCode : int{ SUCCESS, INVALID_CHIP, @@ -25,6 +60,12 @@ enum ErrorCode : int{ UNKNOWN }; +/** + * @brief Enumerates the types of the interface. + * + * @since 5.0 + * @version 1.0 + */ enum IfaceType : unsigned int { STA, AP, @@ -32,20 +73,44 @@ enum IfaceType : unsigned int { NANIFACE }; +/** + * @brief Defines the limitations of the interface. + * + * @since 5.0 + * @version 1.0 + */ struct IfaceLimit { enum IfaceType[] types; - unsigned int IfaceNum; + unsigned int ifaceNum; }; +/** + * @brief Defines the usable interface of the chip. + * + * @since 5.0 + * @version 1.0 + */ struct ComboIface { struct IfaceLimit[] limits; }; +/** + * @brief Defines the usable mode of the chip. + * + * @since 5.0 + * @version 1.0 + */ struct UsableMode { unsigned int modeId; struct ComboIface[] usableCombo; }; +/** + * @brief Enumerates the types of band. + * + * @since 5.0 + * @version 1.0 + */ enum BandType : unsigned int { UNSPECIFIED = 0, TYPE_24GHZ = 1, @@ -55,4 +120,5 @@ enum BandType : unsigned int { TYPE_24GHZ_AND_DFS = 5, TYPE_5GHZ_AND_DFS = 6, ALL_BAND = 7 -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipController.idl b/wlan/chip/v1_0/IChipController.idl index 261837d9..9388d2e7 100644 --- a/wlan/chip/v1_0/IChipController.idl +++ b/wlan/chip/v1_0/IChipController.idl @@ -13,6 +13,36 @@ * limitations under the License. */ +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IChipController.idl + * + * @brief Provides APIs to controller the wifi chip, register wifi event callback, init or release wifi chip, get available chips + * and get the wifi chip service. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; @@ -20,15 +50,79 @@ import ohos.hdi.wlan.chip.v1_0.IChipControllerCallback; import ohos.hdi.wlan.chip.v1_0.IConcreteChip; interface IChipController { + /** + * @brief Registers wifi event callback messages. + * + * @param eventCallback Indicates the register callback messages. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ RegisterWifiEventCallback([in] IChipControllerCallback eventCallback); - IsInit([out] boolean started); + /** + * @brief Checkes if the hdi service is inited. + * + * @param started Indicates if the hdi service is inited. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + IsInit([out] boolean inited); + /** + * @brief Inites the wifi hdi service. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ Init(); + /** + * @brief Releases the wifi hdi service. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ Release(); + /** + * @brief Obtains the id of chips. + * + * @param chipIds Indicates the id of chips. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetAvailableChips([out] unsigned int[] chipIds); + /** + * @brief Obtains the chip service corresponding to the chip id. + * + * @param chipId Indicates the id of the chip. + * @param chip Indicates the chip service object of the chip id. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetChipService([in] unsigned int chipId, [out] IConcreteChip chip); -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file diff --git a/wlan/chip/v1_0/IChipControllerCallback.idl b/wlan/chip/v1_0/IChipControllerCallback.idl index fbeb2f31..d70bd670 100644 --- a/wlan/chip/v1_0/IChipControllerCallback.idl +++ b/wlan/chip/v1_0/IChipControllerCallback.idl @@ -13,10 +13,51 @@ * limitations under the License. */ +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IChipControllerCallback.idl + * + * @brief Provides APIs to controller callbcak of the wifi chip + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; [callback] interface IChipControllerCallback { - [oneway] OnSubsystemRestart([in] ErrorCode code); -}; \ No newline at end of file + /** + * @brief Obtains the callback for the subsystem restart. + * + * @param code Indicates the errorcode of the subsystem when it is restarted. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] OnVendorHalRestart([in] ErrorCode code); +}; +/** @} */ diff --git a/wlan/chip/v1_0/IChipIface.idl b/wlan/chip/v1_0/IChipIface.idl index 496373fd..9bfaeea8 100644 --- a/wlan/chip/v1_0/IChipIface.idl +++ b/wlan/chip/v1_0/IChipIface.idl @@ -13,14 +13,78 @@ * limitations under the License. */ +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IChipIface.idl + * + * @brief Provides APIs to obtaon the message of iface, include type, name and support frequencies. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; interface IChipIface { + /** + * @brief Obtains the type of the iface. + * + * @param type Indicates the type of the interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetIfaceType([out] enum IfaceType type); + /** + * @brief Obtains the name of the iface. + * + * @param name Indicates the name of the interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetIfaceName([out] String name); + /** + * @brief Obtains the frequencies supported by the corresponding band. + * + * @param band Indicates the wifi band. + * @param frequencies Indicates the supported frequencies. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetSupportFreqs([in] enum BandType band, [out] unsigned int[] frequencies); -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file diff --git a/wlan/chip/v1_0/IConcreteChip.idl b/wlan/chip/v1_0/IConcreteChip.idl index 8c078133..052eee1e 100644 --- a/wlan/chip/v1_0/IConcreteChip.idl +++ b/wlan/chip/v1_0/IConcreteChip.idl @@ -12,7 +12,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IConcreteChip.idl + * + * @brief Provides APIs to concrete the chip, get the specific chip information. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; @@ -20,37 +49,228 @@ import ohos.hdi.wlan.chip.v1_0.IChipIface; import ohos.hdi.wlan.chip.v1_0.IConcreteChipCallback; interface IConcreteChip { + /** + * @brief Obtains the id of the service. + * + * @param id Indicates the chip id. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetChipId([out] int id); + /** + * @brief Registers the callback information of the corresponding chip service. + * + * @param chipEventcallback Indicates the event callback of chip service. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ RegisterChipEventCallback([in] IConcreteChipCallback chipEventcallback); + /** + * @brief Obtains the modes supported by the chip. + * + * @param modes Indicates supported mode of the chip. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetChipModes([out] struct UsableMode[] modes); + /** + * @brief Obtains the mode of the chip id. + * + * @param modeId Indicates the mode of the current chip id. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ GetCurrentMode([out] unsigned int modeId); - CreateApIface([out] IChipIface iface); + /** + * @brief Creates the Ap interface service. + * + * @param iface Indicates Ap interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + CreateApService([out] IChipIface iface); - GetApIfaceNames([out] String[] ifnames); + /** + * @brief Obtains the name of the Ap interface. + * + * @param ifnames Indicates Ap interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetApServiceIfNames([out] String[] ifnames); - GetApIface([in] String ifname, [out] IChipIface iface); + /** + * @brief Obtains the service of the Ap interface. + * + * @param ifnames Indicates Ap interface name. + * @param iface Indicates the Ap interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetApService([in] String ifname, [out] IChipIface iface); - RemoveApIface([in] String ifname); + /** + * @brief Deletes the service of the Ap interface. + * + * @param ifnames Indicates Ap interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RemoveApService([in] String ifname); - CreateP2pIface([out] IChipIface iface); + /** + * @brief Creates the P2p interface service. + * + * @param iface Indicates P2p interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + CreateP2pService([out] IChipIface iface); - GetP2pIfaceNames([out] String[] ifnames); + /** + * @brief Obtains the name of the P2p interface. + * + * @param ifnames Indicates P2p interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetP2pServiceIfNames([out] String[] ifnames); - GetP2pIface([in] String ifname, [out] IChipIface iface); + /** + * @brief Obtains the service of the P2p interface. + * + * @param ifnames Indicates P2p interface name. + * @param iface Indicates the P2p interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetP2pService([in] String ifname, [out] IChipIface iface); - RemoveP2pIface([in] String ifname); + /** + * @brief Deletes the service of the P2p interface. + * + * @param ifnames Indicates P2p interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RemoveP2pService([in] String ifname); - CreateStaIface([out] IChipIface iface); + /** + * @brief Creates the Sta interface service. + * + * @param iface Indicates Sta interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + CreateStaService([out] IChipIface iface); - GetStaIfaceNames([out] String[] ifnames); + /** + * @brief Obtains the name of the Sta interface. + * + * @param ifnames Indicates Sta interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetStaServiceIfNames([out] String[] ifnames); - GetStaIface([in] String ifname, [out] IChipIface iface); + /** + * @brief Obtains the service of the Sta interface. + * + * @param ifnames Indicates Sta interface name. + * @param iface Indicates the Sta interface service object. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetStaService([in] String ifname, [out] IChipIface iface); - RemoveStaIface([in] String ifname); + /** + * @brief Deletes the service of the Sta interface. + * + * @param ifnames Indicates Sta interface name. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RemoveStaService([in] String ifname); + /** + * @brief Sets the mode id of chip. + * + * @param modeId Indicates the id of different mode. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ SetChipMode([in] unsigned int modeId); -}; \ No newline at end of file +}; +/** @} */ \ No newline at end of file diff --git a/wlan/chip/v1_0/IConcreteChipCallback.idl b/wlan/chip/v1_0/IConcreteChipCallback.idl index 2c714c07..15adfdab 100644 --- a/wlan/chip/v1_0/IConcreteChipCallback.idl +++ b/wlan/chip/v1_0/IConcreteChipCallback.idl @@ -12,9 +12,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + +/** + * @addtogroup CHIP + * @{ + * + * @brief Provides APIs for the upper-layer WLAN service. + * + * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback + * get the name and type of the iface, get the support frequencies and set the mode of chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IConcreteChipCallback.idl + * + * @brief Provides APIs to concrete the chip of the chip. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @brief Defines the package path of the chip module interface. + * + * @since 5.0 + * @version 1.0 + */ + package ohos.hdi.wlan.chip.v1_0; import ohos.hdi.wlan.chip.v1_0.ChipTypes; -[callback] interface IConcreteChipCallback {}; \ No newline at end of file +[callback] interface IConcreteChipCallback {}; +/** @} */ \ No newline at end of file -- Gitee From f4ae8b8628d4b97fc05c0a567515ffa6301d2a69 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Sat, 30 Mar 2024 16:00:00 +0800 Subject: [PATCH 144/210] add tag OHOS_ABILITY_EQUIVALENT_FOCUS Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 1 + camera/metadata/include/camera_metadata_item_info.h | 1 + camera/metadata/src/camera_metadata_info.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 67e6cb8e..11e5d7ea 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -292,6 +292,7 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, + OHOS_ABILITY_EQUIVALENT_FOCUS, OHOS_CAMERA_EFFECT_END, // camera secure related diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index d1fd0887..1d11d1d2 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -212,6 +212,7 @@ static item_info_t g_ohosDeviceFocus[OHOS_DEVICE_FOCUS_END - OHOS_DEVICE_FOCUS_S [OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensInfoMinimumFocusDistance", META_TYPE_FLOAT, 1}, [OHOS_CONTROL_LENS_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensFocusDistance", META_TYPE_FLOAT, 1}, + [OHOS_ABILITY_EQUIVALENT_FOCUS, - OHOS_DEVICE_FOCUS_START] = {"equivalentFocus", META_TYPE_INT32, -1}, }; static item_info_t g_ohosDeviceWhite[OHOS_DEVICE_WHITE_BLANCE_END - OHOS_DEVICE_WHITE_BLANCE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index cc335f82..56fa46a2 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -193,6 +193,7 @@ const std::vector g_metadataTags = { OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, + OHOS_ABILITY_EQUIVALENT_FOCUS, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From fbb312e7ed4aeaa8548cff40f762d78c197bff78 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 1 Apr 2024 03:17:47 +0000 Subject: [PATCH 145/210] update camera/metadata/include/camera_device_ability_items.h. Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 11e5d7ea..9fdc9f52 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -206,6 +206,7 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_FOCUS_ASSIST_FLASH_SUPPORTED_MODE, OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, OHOS_CONTROL_LENS_FOCUS_DISTANCE, + OHOS_ABILITY_EQUIVALENT_FOCUS, OHOS_DEVICE_FOCUS_END, OHOS_ABILITY_DEVICE_AVAILABLE_AWBMODES = OHOS_DEVICE_WHITE_BLANCE_START, @@ -292,7 +293,6 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, - OHOS_ABILITY_EQUIVALENT_FOCUS, OHOS_CAMERA_EFFECT_END, // camera secure related -- Gitee From f18eb4bd8f8f5dfdc9eb84f5adf9ee3070674c9f Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 1 Apr 2024 03:22:50 +0000 Subject: [PATCH 146/210] update camera/metadata/src/camera_metadata_info.cpp. Signed-off-by: luzhiye --- camera/metadata/src/camera_metadata_info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 56fa46a2..59caa944 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -124,6 +124,7 @@ const std::vector g_metadataTags = { OHOS_CONTROL_FOCUS_ASSIST_FLASH_SUPPORTED_MODE, OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, OHOS_CONTROL_LENS_FOCUS_DISTANCE, + OHOS_ABILITY_EQUIVALENT_FOCUS, OHOS_ABILITY_DEVICE_AVAILABLE_FLASHMODES, OHOS_CONTROL_FLASHMODE, @@ -193,7 +194,6 @@ const std::vector g_metadataTags = { OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, - OHOS_ABILITY_EQUIVALENT_FOCUS, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From b135665e74d0283bd733e8b537c62adfb64edc42 Mon Sep 17 00:00:00 2001 From: ASheLock Date: Mon, 1 Apr 2024 15:06:58 +0800 Subject: [PATCH 147/210] =?UTF-8?q?ril=5Fadapter=E8=8A=AF=E7=89=87?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=8B=AC=E7=AB=8B=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ASheLock --- ril/bundle.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ril/bundle.json b/ril/bundle.json index 19643963..facd613b 100644 --- a/ril/bundle.json +++ b/ril/bundle.json @@ -75,14 +75,6 @@ "header_files": [], "header_base": "//drivers/interface/ril" } - }, - { - "type": "so", - "name": "//base/telephony/ril_adapter/interfaces/innerkits:hril_innerkits", - "header": { - "header_files": [], - "header_base": "//base/telephony/ril_adapter/interfaces/innerkits/include" - } } ] } -- Gitee From ee9ad9be0243e2abf51bb0c776e739198db45ba3 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 1 Apr 2024 07:33:10 +0000 Subject: [PATCH 148/210] update camera/metadata/include/camera_metadata_item_info.h. Signed-off-by: luzhiye --- camera/metadata/include/camera_metadata_item_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 1d11d1d2..8e89333d 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -212,7 +212,7 @@ static item_info_t g_ohosDeviceFocus[OHOS_DEVICE_FOCUS_END - OHOS_DEVICE_FOCUS_S [OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensInfoMinimumFocusDistance", META_TYPE_FLOAT, 1}, [OHOS_CONTROL_LENS_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensFocusDistance", META_TYPE_FLOAT, 1}, - [OHOS_ABILITY_EQUIVALENT_FOCUS, - OHOS_DEVICE_FOCUS_START] = {"equivalentFocus", META_TYPE_INT32, -1}, + [OHOS_ABILITY_EQUIVALENT_FOCUS - OHOS_DEVICE_FOCUS_START] = {"equivalentFocus", META_TYPE_INT32, -1}, }; static item_info_t g_ohosDeviceWhite[OHOS_DEVICE_WHITE_BLANCE_END - OHOS_DEVICE_WHITE_BLANCE_START] = { -- Gitee From d3da08d32158ed4dcbc847af1522e623ee40210c Mon Sep 17 00:00:00 2001 From: hejiaogirl Date: Mon, 25 Mar 2024 14:14:39 +0800 Subject: [PATCH 149/210] fix : update pin_auth user_auth idl to 2_0 Signed-off-by: hejiaogirl Change-Id: I72c14fe976cae832b1b8cc1ff559a3d4c8d19004 --- pin_auth/bundle.json | 151 ++++---- pin_auth/v2_0/BUILD.gn | 28 ++ pin_auth/v2_0/IAllInOneExecutor.idl | 181 ++++++++++ pin_auth/v2_0/ICollector.idl | 136 ++++++++ pin_auth/v2_0/IExecutorCallback.idl | 109 ++++++ pin_auth/v2_0/IPinAuthInterface.idl | 71 ++++ pin_auth/v2_0/IVerifier.idl | 137 ++++++++ pin_auth/v2_0/PinAuthTypes.idl | 151 ++++++++ user_auth/bundle.json | 149 ++++---- user_auth/v2_0/BUILD.gn | 25 ++ user_auth/v2_0/IMessageCallback.idl | 59 ++++ user_auth/v2_0/IUserAuthInterface.idl | 461 +++++++++++++++++++++++++ user_auth/v2_0/UserAuthTypes.idl | 475 ++++++++++++++++++++++++++ 13 files changed, 1970 insertions(+), 163 deletions(-) create mode 100644 pin_auth/v2_0/BUILD.gn create mode 100644 pin_auth/v2_0/IAllInOneExecutor.idl create mode 100644 pin_auth/v2_0/ICollector.idl create mode 100644 pin_auth/v2_0/IExecutorCallback.idl create mode 100644 pin_auth/v2_0/IPinAuthInterface.idl create mode 100644 pin_auth/v2_0/IVerifier.idl create mode 100644 pin_auth/v2_0/PinAuthTypes.idl create mode 100644 user_auth/v2_0/BUILD.gn create mode 100644 user_auth/v2_0/IMessageCallback.idl create mode 100644 user_auth/v2_0/IUserAuthInterface.idl create mode 100644 user_auth/v2_0/UserAuthTypes.idl diff --git a/pin_auth/bundle.json b/pin_auth/bundle.json index 3a601947..3225e925 100644 --- a/pin_auth/bundle.json +++ b/pin_auth/bundle.json @@ -1,86 +1,73 @@ { - "name": "@ohos/drivers_interface_pin_auth", - "description": "pinauth device driver interface", - "version": "4.0", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "drivers/interface/pin_auth" + "name":"@ohos/drivers_interface_pin_auth", + "description":"pinauth device driver interface", + "version":"5.0", + "license":"Apache License 2.0", + "publishAs":"code-segment", + "segment":{ + "destPath":"drivers/interface/pin_auth" + }, + "dirs":{ + + }, + "scripts":{ + + }, + "component":{ + "name":"drivers_interface_pin_auth", + "subsystem":"hdf", + "adapted_system_type":[ + "standard" + ], + "rom":"1000KB", + "ram":"1000KB", + "deps":{ + "components":[ + "ipc", + "hdf_core", + "hilog", + "c_utils" + ], + "third_party":[ + + ] }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "drivers_interface_pin_auth", - "subsystem": "hdf", - "adapted_system_type": ["standard"], - "rom": "1000KB", - "ram": "1000KB", - "deps": { - "components": [ - "ipc", - "hdf_core", - "hilog", - "c_utils" - ], - "third_party": [] - }, - "build": { - "sub_component": [ - "//drivers/interface/pin_auth/v1_0:pin_auth_idl_target", - "//drivers/interface/pin_auth/v1_1:pin_auth_idl_target" - ], - "test": [ - ], - "inner_kits": [ - { - "name": "//drivers/interface/pin_auth/v1_0:libpin_auth_proxy_1.0", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } - }, - { - "name": "//drivers/interface/pin_auth/v1_0:libpin_auth_stub_1.0", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } - }, - { - "name": "//drivers/interface/pin_auth/v1_0:pin_auth_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } - }, - { - "name": "//drivers/interface/pin_auth/v1_1:libpin_auth_proxy_1.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } - }, - { - "name": "//drivers/interface/pin_auth/v1_1:libpin_auth_stub_1.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } - }, - { - "name": "//drivers/interface/pin_auth/v1_1:pin_auth_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/pin_auth" - } + "build":{ + "sub_component":[ + "//drivers/interface/pin_auth/v2_0:pin_auth_idl_target" + ], + "test":[ + + ], + "inner_kits":[ + { + "name":"//drivers/interface/pin_auth/v2_0:libpin_auth_proxy_2.0", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interface/pin_auth" } - ] - } + }, + { + "name":"//drivers/interface/pin_auth/v2_0:libpin_auth_stub_2.0", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interface/pin_auth" + } + }, + { + "name":"//drivers/interface/pin_auth/v2_0:pin_auth_idl_headers", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interface/pin_auth" + } + } + ] } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/pin_auth/v2_0/BUILD.gn b/pin_auth/v2_0/BUILD.gn new file mode 100644 index 00000000..cc6c8842 --- /dev/null +++ b/pin_auth/v2_0/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("pin_auth") { + module_name = "drivers_peripheral_pin_auth" + sources = [ + "IAllInOneExecutor.idl", + "ICollector.idl", + "IExecutorCallback.idl", + "IPinAuthInterface.idl", + "IVerifier.idl", + "PinAuthTypes.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_pin_auth" +} diff --git a/pin_auth/v2_0/IAllInOneExecutor.idl b/pin_auth/v2_0/IAllInOneExecutor.idl new file mode 100644 index 00000000..4c078bbc --- /dev/null +++ b/pin_auth/v2_0/IAllInOneExecutor.idl @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IAllInOneExecutor.idl + * + * @brief Defines the APIs of the all-in-one executors. These APIs can be used to get executor information, get property, + * enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +import ohos.hdi.pin_auth.v2_0.PinAuthTypes; +import ohos.hdi.pin_auth.v2_0.IExecutorCallback; + +/** + * @brief Defines the APIs of the all-in-one executors. These APIs can be used to get executor information, get property, + * enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ + +interface IAllInOneExecutor { + /** + * @brief Gets executor information. + * + * @param executorInfo Indicates executor information. See {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief Sends parameters to the driver when executor registration is finished. + * + * @param templateIdList Indicates the templates previously registered to the user auth framework. + * @param frameworkPublicKey Indicates the framework public key. + * @param extraInfo Indicates the extra information that is sent to the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, + [in] unsigned char[] extraInfo); + /** + * @brief Cancels an operation. + * + * @param scheduleId Indicates the schedule ID of the operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Sets pin data. + * + * @param scheduleId Indicates the schedule ID of enrollment. + * @param authSubType Indicates the pin sub type. + * @param data Indicates the pin data. + * @param resultCode Indicates the result code. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data, + [in] int resultCode); + /** + * @brief Enrolls templates. + * + * @param scheduleId Indicates the schedule ID of enrollment. + * @param extraInfo Indicates the extra information of enrollment. + * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Authenticates templates. + * + * @param scheduleId Indicates the schedule ID of authentication. + * @param templateIdList Indicates the templates to authenticate. + * @param extraInfo Indicates the extra information of authentication. + * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, + [in] IExecutorCallback callbackObj); + /** + * @brief Deletes templates. + * + * @param templateId Indicates the templates to delete. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Delete([in] unsigned long templateId); + /** + * @brief Get property. + * + * @param templateIdList Indicates the templates to process. + * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}. + * @param property Indicates property. See {@link Property}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetProperty([in] unsigned long[] templateIdList, [in] int[] propertyTypes, [out] struct Property property); +} +/** @} */ \ No newline at end of file diff --git a/pin_auth/v2_0/ICollector.idl b/pin_auth/v2_0/ICollector.idl new file mode 100644 index 00000000..c4968782 --- /dev/null +++ b/pin_auth/v2_0/ICollector.idl @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file ICollector.idl + * + * @brief Defines the APIs of the collectors. These APIs can be used to get executor information, + * cancel, collect data, and send message, etc. + * + * @since 5.0 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +import ohos.hdi.pin_auth.v2_0.PinAuthTypes; +import ohos.hdi.pin_auth.v2_0.IExecutorCallback; + +/** + * @brief Defines the APIs of the collectors. These APIs can be used to get executor information, + * cancel, collect data, and send message, etc. + * + * @since 5.0 + * @version 1.0 + */ + +interface ICollector { + /** + * @brief Gets executor information. + * + * @param executorInfo Indicates executor information. See {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief Sends parameters to the driver when executor registration is finished. + * + * @param templateIdList Indicates the templates previously registered to the user auth framework. + * @param frameworkPublicKey Indicates the framework public key. + * @param extraInfo Indicates the extra information that is sent to the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief Cancels an operation. + * + * @param scheduleId Indicates the schedule ID of the operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Sets pin data. + * + * @param scheduleId Indicates the schedule ID of enrollment. + * @param authSubType Indicates the pin sub type. + * @param data Indicates the pin data. + * @param resultCode Indicates the result code. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data, + [in] int resultCode); + /** + * @brief Collect template data. + * + * @param scheduleId Indicates the schedule ID of collection. + * @param extraInfo Indicates the extra information of collection. + * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Collect([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, + [in] IExecutorCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/pin_auth/v2_0/IExecutorCallback.idl b/pin_auth/v2_0/IExecutorCallback.idl new file mode 100644 index 00000000..50054e9a --- /dev/null +++ b/pin_auth/v2_0/IExecutorCallback.idl @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief Defines the callback for an async API, which can be used to report operation results or + * get information of the async API. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +import ohos.hdi.pin_auth.v2_0.PinAuthTypes; + +/** + * @brief Defines the callback for an async API, which can be used to report operation results or + * get information of the async API. See {@link IExecutor}. + * + * @since 3.2 + * @version 1.0 + */ +[callback] interface IExecutorCallback { + /** + * @brief Defines the function for reporting operation results. + * + * @param result Indicates the result code. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + OnResult([in] int result, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for reporting information in process. + * + * @param tip Indicates tip code. See {@link FaceTipsCode}. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnTip([in] int tip, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for getting pin data. + * + * @param algoParameter is the parameter of the algorithm. + * @param authSubType Indicates the pin sub type. + * @param algoVersion is the version of the algorithm. + * @param challenge is challenge. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + OnGetData([in] unsigned char[] algoParameter, [in] unsigned long authSubType, [in] unsigned int algoVersion, + [in] unsigned char[] challenge); + /** + * @brief Defines the function for reporting message. + * + * @param destRole is the role of destination. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnMessage([in] int destRole, [in] unsigned char[] msg); +} +/** @} */ \ No newline at end of file diff --git a/pin_auth/v2_0/IPinAuthInterface.idl b/pin_auth/v2_0/IPinAuthInterface.idl new file mode 100644 index 00000000..bbadb87b --- /dev/null +++ b/pin_auth/v2_0/IPinAuthInterface.idl @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IPinAuthInterface.idl + * + * @brief Defines the API for getting the executor list of the pin auth driver. + * of driver. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +import ohos.hdi.pin_auth.v2_0.IAllInOneExecutor; +import ohos.hdi.pin_auth.v2_0.ICollector; +import ohos.hdi.pin_auth.v2_0.IVerifier; + +/** + * @brief Defines the API for getting the executor list of the pin auth driver. + * + * @since 3.2 + * @version 1.0 + */ +interface IPinAuthInterface { + /** + * @brief Obtains the executor list of the driver. + * + * @param allInOneExecutors Indicates the all-in-one executor list of the driver. + * See {@link IAllInOneExecutor}. + * @param verifiers Indicates the verifier list of the driver. See {@link IVerifier}. + * @param collectors Indicates the collector list of the driver. See {@link ICollector}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetExecutorList([out] IAllInOneExecutor[] allInOneExecutors, [out] IVerifier[] verifiers, + [out] ICollector[] collectors); +} +/** @} */ \ No newline at end of file diff --git a/pin_auth/v2_0/IVerifier.idl b/pin_auth/v2_0/IVerifier.idl new file mode 100644 index 00000000..9a143181 --- /dev/null +++ b/pin_auth/v2_0/IVerifier.idl @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IVerifier.idl + * + * @brief Defines the APIs of the verifiers. These APIs can be used to get executor information, + * cancel, authenticate, and send message, etc. + * + * @since 5.0 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +import ohos.hdi.pin_auth.v2_0.PinAuthTypes; +import ohos.hdi.pin_auth.v2_0.IExecutorCallback; + +/** + * @brief Defines the APIs of the verifiers. These APIs can be used to get executor information, + * cancel, authenticate, and send message, etc. + * + * @since 5.0 + * @version 1.0 + */ + +interface IVerifier { + /** + * @brief Gets executor information. + * + * @param executorInfo Indicates executor information. See {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief Sends parameters to the driver when executor registration is finished. + * + * @param templateIdList Indicates the templates previously registered to the user auth framework. + * @param frameworkPublicKey Indicates the framework public key. + * @param extraInfo Indicates the extra information that is sent to the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, + [in] unsigned char[] extraInfo); + /** + * @brief Cancels an operation. + * + * @param scheduleId Indicates the schedule ID of the operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Authenticates templates. + * + * @param scheduleId Indicates the schedule ID of authentication. + * @param templateIdList Indicates the templates to authenticate. + * @param extraInfo Indicates the extra information of authentication. + * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, + [in] IExecutorCallback callbackObj); + /** + * @brief Notify collector ready. + * + * @param scheduleId Indicates the schedule ID of the message. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + NotifyCollectorReady([in] unsigned long scheduleId); +} +/** @} */ \ No newline at end of file diff --git a/pin_auth/v2_0/PinAuthTypes.idl b/pin_auth/v2_0/PinAuthTypes.idl new file mode 100644 index 00000000..b31bb736 --- /dev/null +++ b/pin_auth/v2_0/PinAuthTypes.idl @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 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 HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + * @version 1.0 + */ + +/** + * @fiPinTypes.idl + * + * @brief Defines the enumeration and data structure of the pin auth driver, including AuthType, ExecutorRole, + * ExecutorSecureLevel, + * CommandId, ResultCode, ExecutorInfo, and TemplateInfo. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.pin_auth.v2_0; + +/** + * @brief Enumerates the credential types for authentication. + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + /**< Indicates that the authentication type is PIN. */ + PIN = 1, + /**< Indicates that the authentication type is face. */ + FACE = 2, + /**< Indicates that the authentication type is fingerprint. */ + FINGERPRINT = 4, +}; + +/** + * @brief Enumerates executor roles. + * + * @since 3.2 + * @version 2.0 + */ +enum ExecutorRole : int { + /**< Indicates that the executor role is scheduler. */ + SCHEDULER = 0, + /**< Indicates that the executor role is collector. */ + COLLECTOR = 1, + /**< Indicates that the executor role is verifier. */ + VERIFIER = 2, + /**< Indicates that the executor role is the combination of collector and verifier. */ + ALL_IN_ONE = 3, +}; + +/** + * @brief Enumerates executor secure levels. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /**< Indicates that the executor secure level is ESL0. */ + ESL0 = 0, + /**< Indicates that the executor secure level is ESL1. */ + ESL1 = 1, + /**< Indicates that the executor secure level is ESL2. */ + ESL2 = 2, + /**< Indicates that the executor secure level is ESL3. */ + ESL3 = 3, +}; + +/** + * @brief Indicates executor information. + * + * @since 3.2 + * @version 2.0 + */ +struct ExecutorInfo { + /**< Indicates the sensor ID, which must be unique within the driver. */ + unsigned short sensorId; + /**< Indicates the executor matcher. */ + unsigned int executorMatcher; + /**< Indicates the executor role. See @{ExecutorRole}. */ + int executorRole; + /**< Indicates the auth type. See @{AuthType}. */ + int authType; + /**< Indicates the executor secure level. See @{ExecutorSecureLevel}. */ + int esl; + /**< Indicates the public key of the executor. */ + unsigned char[] publicKey; + /**< Indicates extra information. */ + unsigned char[] extraInfo; + /**< Indicates the max acl of template. */ + unsigned int maxTemplateAcl; +}; + +/** + * @brief Enumerates get Property types. + * + * @since 4.0 + * @version 2.0 + */ +enum GetPropertyType : int { + /**< Indicates that the property to get is auth sub type. */ + AUTH_SUB_TYPE = 1, + /**< Indicates that the property to get is lockout duration. */ + LOCKOUT_DURATION = 2, + /**< Indicates that the property to get is remain attempts. */ + REMAIN_ATTEMPTS = 3, + /**< Indicates that the property to get is lockout duration after next fail. */ + NEXT_FAIL_LOCKOUT_DURATION = 6 +}; + +/** + * @brief Indicates executor property. + * + * @since 4.0 + * @version 2.0 + */ +struct Property { + /**< Indicates auth sub type. */ + unsigned long authSubType; + /**< Indicates lockout duration. */ + int lockoutDuration; + /**< Indicates remain attempts. */ + int remainAttempts; + /**< Indicates next fail lockout duration. */ + int nextFailLockoutDuration; +}; +/** @} */ \ No newline at end of file diff --git a/user_auth/bundle.json b/user_auth/bundle.json index fe9f25df..20fd644c 100644 --- a/user_auth/bundle.json +++ b/user_auth/bundle.json @@ -1,86 +1,73 @@ { - "name": "@ohos/drivers_interface_user_auth", - "description": "user_auth device driver", - "version": "5.0", - "license": "Apache License 2.0", - "publishAs": "code-segment", - "segment": { - "destPath": "drivers/interface/user_auth" - }, - "dirs": {}, - "scripts": {}, - "component": { - "name": "drivers_interface_user_auth", - "subsystem": "hdf", - "adapted_system_type": ["standard"], - "rom": "1000KB", - "ram": "1000KB", - "deps": { - "components": [ - "ipc", - "hdf_core", - "hilog", - "c_utils" + "name":"@ohos/drivers_interface_user_auth", + "description":"user_auth device driver", + "version":"5.0", + "license":"Apache License 2.0", + "publishAs":"code-segment", + "segment":{ + "destPath":"drivers/interface/user_auth" + }, + "dirs":{ + + }, + "scripts":{ + + }, + "component":{ + "name":"drivers_interface_user_auth", + "subsystem":"hdf", + "adapted_system_type":[ + "standard" + ], + "rom":"1000KB", + "ram":"1000KB", + "deps":{ + "components":[ + "ipc", + "hdf_core", + "hilog", + "c_utils" ], - "third_party": [] - }, - "build": { - "sub_component": [ - "//drivers/interface/user_auth/v1_2:user_auth_idl_target", - "//drivers/interface/user_auth/v1_3:user_auth_idl_target" + "third_party":[ + + ] + }, + "build":{ + "sub_component":[ + "//drivers/interface/user_auth/v2_0:user_auth_idl_target" ], - "test": [ + "test":[ + ], - "inner_kits": [ - { - "name": "//drivers/interface/user_auth/v1_2:libuser_auth_proxy_1.2", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/user_auth" - } - }, - { - "name": "//drivers/interface/user_auth/v1_2:user_auth_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interfaces/user_auth" - } - }, - { - "name": "//drivers/interface/user_auth/v1_2:libuser_auth_stub_1.2", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/user_auth" - } - }, - { - "name": "//drivers/interface/user_auth/v1_3:libuser_auth_proxy_1.3", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/user_auth" - } - }, - { - "name": "//drivers/interface/user_auth/v1_3:user_auth_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interfaces/user_auth" - } - }, - { - "name": "//drivers/interface/user_auth/v1_3:libuser_auth_stub_1.3", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/user_auth" - } - } + "inner_kits":[ + { + "name":"//drivers/interface/user_auth/v2_0:libuser_auth_proxy_2.0", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interface/user_auth" + } + }, + { + "name":"//drivers/interface/user_auth/v2_0:user_auth_idl_headers", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interfaces/user_auth" + } + }, + { + "name":"//drivers/interface/user_auth/v2_0:libuser_auth_stub_2.0", + "header":{ + "header_files":[ + + ], + "header_base":"//drivers/interface/user_auth" + } + } ] - } - } - } \ No newline at end of file + } + } +} \ No newline at end of file diff --git a/user_auth/v2_0/BUILD.gn b/user_auth/v2_0/BUILD.gn new file mode 100644 index 00000000..f4849d85 --- /dev/null +++ b/user_auth/v2_0/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("user_auth") { + module_name = "drivers_peripheral_user_auth" + sources = [ + "IMessageCallback.idl", + "IUserAuthInterface.idl", + "UserAuthTypes.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_user_auth" +} diff --git a/user_auth/v2_0/IMessageCallback.idl b/user_auth/v2_0/IMessageCallback.idl new file mode 100644 index 00000000..8563d9a2 --- /dev/null +++ b/user_auth/v2_0/IMessageCallback.idl @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 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 HdfUserAuth + * @{ + * + * @brief Provides APIs for the user_auth driver. + * + * The user_auth driver provides a unified interface for the user_auth service to access the user_auth driver. + * After obtaining the user_auth driver proxy, the service can call related APIs to register executors, + * manage credentials, and complete password and biometric authentication. + * @since 5.0 + * @version 1.0 + */ + +/** + * @file IMessageCallback.idl + * + * @brief Defines the callback for an async API, which can be used to send message to framework. + * + * @since 5.0 + * @version 1.0 + */ + +package ohos.hdi.user_auth.v2_0; + +/** + * @brief Defines the callback for an async API, which can be used to send message to framework. + * + * @since 5.0 + * @version 1.0 + */ +[callback] interface IMessageCallback { + /** + * @brief Defines the function for reporting message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param destRole is the role of destination. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + OnMessage([in] unsigned long scheduleId, [in] int destRole, [in] unsigned char[] msg); +} +/** @} */ \ No newline at end of file diff --git a/user_auth/v2_0/IUserAuthInterface.idl b/user_auth/v2_0/IUserAuthInterface.idl new file mode 100644 index 00000000..c60fd9b2 --- /dev/null +++ b/user_auth/v2_0/IUserAuthInterface.idl @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2024 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 HdfUserAuth + * @{ + * + * @brief Provides APIs for the user_auth driver. + * + * The user_auth driver provides a unified interface for the user_auth service to access the user_auth driver. + * After obtaining the user_auth driver proxy, the service can call related APIs to register executors, + * manage credentials, and complete password and biometric authentication. + * @since 3.2 + * @version 1.0 + */ + +/** + * @file IUserAuthInterface.idl + * + * @brief Declares the user_auth driver APIs, which can be used to register executors, + * manage credentials, and complete password and biometric authentication. + * + * @since 3.2 + * @version 1.0 + */ + +package ohos.hdi.user_auth.v2_0; + +import ohos.hdi.user_auth.v2_0.UserAuthTypes; +import ohos.hdi.user_auth.v2_0.IMessageCallback; + +/** + * @brief Declares the APIs of the user_auth driver. + * + * @since 3.2 + * @version 1.0 + */ +interface IUserAuthInterface { + /** + * @brief Initializes the cache information of the user_auth driver. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + Init(); + /** + * @brief Adds an authentication executor to obtain the authentication capability. + * + * @param info Indicates executor registration information. See {@link ExecutorRegisterInfo}. + * @param index Indicates the executor index under the authentication framework. + * @param publicKey Indicates the public key of the authentication framework. + * @param templateIds Indicates template IDs enrolled by the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + AddExecutor([in] struct ExecutorRegisterInfo info, [out] unsigned long index, + [out] unsigned char[] publicKey, [out] unsigned long[] templateIds); + /** + * @brief Deletes an executor. + * + * @param index Indicates the executor index under the authentication framework. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + DeleteExecutor([in] unsigned long index); + /** + * @brief Opens a session for authentication credential management. + * + * @param userId Indicates the user ID. + * @param challenge Indicates the random number, which is used to generate an authentication token. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + OpenSession([in] int userId, [out] unsigned char[] challenge); + /** + * @brief Closes the authentication credential management session. + * + * @param userId Indicates the user ID. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + CloseSession([in] int userId); + /** + * @brief Updates the enrollment result and completes the enrollment. + * + * @param userId Indicates the user ID. + * @param scheduleResult Indicates the enrollment result issued by the executor. + * @param info Indicates the enrollment result. See {@link EnrollResultInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + UpdateEnrollmentResult([in] int userId, [in] unsigned char[] scheduleResult, [out] struct EnrollResultInfo info); + /** + * @brief Cancels an enrollment. + * + * @param userId Indicates the user ID. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + CancelEnrollment([in] int userId); + /** + * @brief Deletes credential information. + * + * @param userId Indicates the user ID. + * @param credentialId Indicates the credential index. + * @param authToken Indicates the authentication token of the user password. + * @param info Indicates the credential information to delete. See {@link CredentialInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + DeleteCredential([in] int userId, [in] unsigned long credentialId, [in] unsigned char[] authToken, + [out] struct CredentialInfo info); + /** + * @brief Obtains credential information. + * + * @param userId Indicates the user ID. + * @param authType Indicates the authentication type. See {@link AuthType}. + * @param infos Indicates credential information. See {@link CredentialInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetCredential([in] int userId, [in] int authType, [out] struct CredentialInfo[] infos); + /** + * @brief Obtains user information. + * + * @param userId Indicates the user ID. + * @param secureUid Indicates the secure user ID. + * @param pinSubType Indicates the sub type of PIN authentication. See {@link PinSubType}. + * @param infos Indicates enrolled information. See {@link EnrolledInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetUserInfo([in] int userId, [out] unsigned long secureUid, [out] int pinSubType, + [out] struct EnrolledInfo[] infos); + /** + * @brief Deletes a pin and a user from the IAM subsystem. + * + * @param userId Indicates the user ID. + * @param authToken Indicates the authentication token of the user password. + * @param deletedInfos Indicates the credential information to delete. See {@link CredentialInfo}. + * @param rootSecret protection key for the user file key. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + DeleteUser([in] int userId, [in] unsigned char[] authToken, [out] struct CredentialInfo[] deletedInfos, + [out] unsigned char[] rootSecret); + /** + * @brief Forcibly deletes a user. + * + * @param userId Indicates the user ID. + * @param deletedInfos Indicates the credential information to delete. See {@link CredentialInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + EnforceDeleteUser([in] int userId, [out] struct CredentialInfo[] deletedInfos); + /** + * @brief Updates the authentication result, and evaluates the result of the authentication solution. + * + * @param contextId Indicates the context index. + * @param scheduleResult Indicates the authentication result issued by the executor. + * @param info Indicates authentication result information. See {@link AuthResultInfo}. + * @param enrolledState EnrolledID information. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + UpdateAuthenticationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct AuthResultInfo info, [out] EnrolledState enrolledState); + /** + * @brief Cancels authentication. + * + * @param contextId Indicates the context index. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + CancelAuthentication([in] unsigned long contextId); + /** + * @brief Updates the identification result, and evaluates the result of the identification solution. + * + * @param contextId Indicates the context index. + * @param scheduleResult Indicates the identification result issued by the executor. + * @param info Indicates identification result information. See {@link IdentifyResultInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + UpdateIdentificationResult([in] unsigned long contextId, [in] unsigned char[] scheduleResult, + [out] struct IdentifyResultInfo info); + /** + * @brief Cancels identification. + * + * @param contextId Indicates the context index. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + CancelIdentification([in] unsigned long contextId); + /** + * @brief Obtains the trust level of the current authentication type. + * + * @param userId Indicates the user ID. + * @param authType Indicates the authentication type. See {@link AuthType}. + * @param authTrustLevel Indicates the authentication trust level. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetAuthTrustLevel([in] int userId, [in] int authType, [out] unsigned int authTrustLevel); + /** + * @brief Obtains the valid authentication methods under the current authentication trust level. + * + * @param userId Indicates the user ID. + * @param authTypes Indicates the authentication types to be filtered. See {@link AuthType}. + * @param authTrustLevel Indicates the authentication trust level. + * @param validTypes Indicates the valid authentication types. See {@link AuthType}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetValidSolution([in] int userId, [in] int[] authTypes, [in] unsigned int authTrustLevel, + [out] int[] validTypes); + /** + * @brief Begins authentication, and generates the authentication solution. + * + * @param contextId Indicates the context index. + * @param param Indicates input parameters. See {@link AuthParam}. + * @param scheduleInfos Indicates scheduling information. See {@link ScheduleInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + BeginAuthentication([in] unsigned long contextId, [in] struct AuthParam param, + [out] struct ScheduleInfo[] scheduleInfos); + /** + * @brief Begins the enrollment of authentication credentials. + * If the authentication type is PIN, this method updates the existing PIN credential. + * + * @param userId Indicates the user ID. + * @param authToken Indicates the authentication token of the user password. + * @param param Indicates input parameters. See {@link EnrollParam}. + * @param info Indicates scheduling information. See {@link ScheduleInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + BeginEnrollment([in] unsigned char[] authToken, [in] struct EnrollParam param, + [out] struct ScheduleInfo info); + /** + * @brief Begins identification, and generates the identification solution. + * + * @param contextId Indicates the context index. + * @param authType Indicates the identification type. See @{AuthType}. + * @param challenge Indicates the identification challenge. + * @param executorSensorHint Indicates the executor sensor hint. + * The value 0 indicates that no value is specified. + * @param scheduleInfo Indicates scheduling information. See {@link ScheduleInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + BeginIdentification([in] unsigned long contextId, [in] int authType, [in] unsigned char[] challenge, + [in] unsigned int executorSensorHint, [out] struct ScheduleInfo scheduleInfo); + /** + * @brief Get all enrolled user information. + * + * @param userInfos List of all userInfo. See @{UserInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 4.0 + * @version 1.0 + */ + GetAllUserInfo([out] UserInfo[] userInfos); + /** + * @brief Get all credential of enrolled users. + * + * @param userInfos List of all users. See @{ExtUserInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 4.0 + * @version 1.0 + */ + GetAllExtUserInfo([out] ExtUserInfo[] userInfos); + + /** + * @brief Querying EnrolledId information. + * + * @param userId Indicates the user ID. + * @param authType Indicates the identification type. See @{AuthType}. + * @param enrolledState Enrolled state. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetEnrolledState([in] int userId, [in] int authType, [out] struct EnrolledState enrolledState); + + /** + * @brief Check if unlock result can be reused and return token. + * + * @param info Request information of reused unLock result. See {@link ReuseUnlockParam}. + * @param reuseInfo Reuse unlock info. See {@link ReuseUnlockInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + CheckReuseUnlockResult([in] struct ReuseUnlockParam reuseParam, [out] ReuseUnlockInfo reuseInfo); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. See {@link ExecutorRole}. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Register message callback. + * + * @param messageCallback Indicates the message callback. See {@link IMessageCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + RegisterMessageCallback([in] IMessageCallback messageCallback); + /** + * @brief Get local schedule from message. + * + * @param remoteDeviceId Indicates the remote device id. + * @param message is message received. + * @param scheduleInfo is schedule info. See {@link ScheduleInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetLocalScheduleFromMessage([in] unsigned char[] remoteDeviceId, [in] unsigned char[] message, + [out] ScheduleInfo scheduleInfo); + /** + * @brief Get signed executor info. + * + * @param authTypes Indicates the auth types. See @{AuthType}. + * @param executorRole Indicates the role of executor. See {@link ExecutorRole}. + * @param remoteDeviceId Indicates the remote device id. + * @param signedExecutorInfo Indicates the signed executor info. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + GetSignedExecutorInfo([in] int[] authTypes, [in] int executorRole, [in] unsigned char[] remoteDeviceId, + [out] unsigned char[] signedExecutorInfo); +} +/** @} */ diff --git a/user_auth/v2_0/UserAuthTypes.idl b/user_auth/v2_0/UserAuthTypes.idl new file mode 100644 index 00000000..32c237b5 --- /dev/null +++ b/user_auth/v2_0/UserAuthTypes.idl @@ -0,0 +1,475 @@ +/* + * Copyright (c) 2024 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 HdfUserAuth + * @{ + * + * @brief Provides APIs for the user_auth driver. + * + * The user_auth driver provides a unified interface for the user_auth service to access the user_auth driver. + + * + * @since 4.0 + * @version 1.0 + */ + + /** + * @file UserAuthTypes.idl + * + * @brief Defines the enumeration values and data structures of the user_auth driver. + * + * @since 4.0 + * @version 1.0 + */ + +package ohos.hdi.user_auth.v2_0; + + /** + * @brief Enumerates the credential types for authentication. + * + * @since 3.2 + * @version 2.0 + */ +enum AuthType : int { + /**< All types. */ + ALL = 0, + /**< PIN authentication. */ + PIN = 1, + /**< Facial authentication. */ + FACE = 2, + /**< Fingerprint authentication. */ + FINGERPRINT = 4, + /**< Recovery key. */ + RECOVERY_KEY = 8, +}; + +/** + * @brief Enumerates executor roles. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorRole : int { + /**< The executor acts as a collector. */ + COLLECTOR = 1, + /**< The executor acts as a verifier. */ + VERIFIER = 2, + /**< The executor acts as a collector and verifier. */ + ALL_IN_ONE = 3, +}; + +/** + * @brief Enumerates executor security levels. + * + * @since 4.0 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /**< ESL0. */ + ESL0 = 0, + /**< ESL1. */ + ESL1 = 1, + /**< ESL2. */ + ESL2 = 2, + /**< ESL3. */ + ESL3 = 3, +}; + +/** + * @brief Defines pin auth's subtype. + * + * @since 3.2 + * @version 2.0 + */ +enum PinSubType : int { + /**< Six digit pin. */ + PIN_SIX = 10000, + /**< Digit pin. */ + PIN_NUMBER = 10001, + /**< Mixing pin. */ + PIN_MIX = 10002, + /**< Four digit pin. */ + PIN_FOUR = 10003, + /**< Pattern. */ + PATTERN = 10004, +}; + +/** + * Schedule mode. + * + * @since 3.2 + * @version 1.0 + */ +enum ScheduleMode : int { + /**< The schedule mode is enrollment. */ + ENROLL = 0, + /**< The schedule mode is authentication. */ + AUTH = 1, + /**< The schedule mode is identification. */ + IDENTIFY = 2, +}; + +/** + * Auth intent. + * + * @since 5.0 + * @version 1.0 + */ +enum AuthIntent : int { + /**< The auth intent is default. */ + DEFUALT = 0, + /**< The auth intent is unlock. */ + UNLOCK = 1, + /**< The auth intent is init. */ + INIT = 2, +}; + +/** + * @brief User type. + * + * @since 5.0 + * @version 1.0 + */ +enum UserType : int { + /**< main user. */ + MAIN = 0, + /**< sub user. */ + SUB = 1, + /**< private user. */ + PRIVATE = 2, +}; + +/** + * @brief Reuse mode. + * + * @since 5.0 + * @version 1.0 + */ +enum ReuseMode : int { + /**< sub user. */ + AUTH_TYPE_RELEVANT = 1, + /**< private user. */ + AUTH_TYPE_IRRELEVANT = 2, +}; + +/** + * @brief Defines executor registration information. + * + * @since 4.0 + * @version 1.0 + */ +struct ExecutorRegisterInfo { + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Executor role. See @{ExecutorRole}. */ + int executorRole; + /**< Executor sensor hint under the same authentication type, 0 is not allowed. */ + unsigned int executorSensorHint; + /**< Executor matcher. */ + unsigned int executorMatcher; + /**< Executor secure level. See @{ExecutorSecureLevel}. */ + int esl; + /**< Public key of the executor. */ + unsigned char[] publicKey; +}; + +/** + * @brief Defines executor information. + * + * @since 4.0 + * @version 1.0 + */ +struct ExecutorInfo { + /**< Executor index under the authentication framework. */ + unsigned long executorIndex; + /**< Executor registration information. See @{ExecutorRegisterInfo}. */ + struct ExecutorRegisterInfo info; +}; + +/** + * @brief Defines executor messages. + * + * @since 4.0 + * @version 1.0 + */ +struct ExecutorSendMsg { + /**< Executor index under the authentication framework. */ + unsigned long executorIndex; + /**< Indicates command ID. */ + int commandId; + /**< Executor message to send. */ + unsigned char[] msg; +}; + +/** + * @brief Defines authentication result information. + * + * @since 4.0 + * @version 1.0 + */ +struct AuthResultInfo { + /**< Authentication result. */ + int result; + /**< Lockout duration, in millisecond. */ + int lockoutDuration; + /**< Remaining authentication attempts before a lockout. */ + int remainAttempts; + /**< Executor messages. See @{ExecutorSendMsg}. */ + struct ExecutorSendMsg[] msgs; + /**< Authentication token. */ + unsigned char[] token; + /**< Protection key for the user file key. */ + unsigned char[] rootSecret; + /**< User ID. */ + int userId; + /**< Credential ID. */ + unsigned long credentialId; +}; + +/** + * @brief Defines identification result information. + * + * @since 4.0 + * @version 1.0 + */ +struct IdentifyResultInfo { + /**< iIdentification result. */ + int result; + /**< User ID. */ + int userId; + /**< Identification token. */ + unsigned char[] token; +}; + +/** + * @brief Defines credential information. + * + * @since 4.0 + * @version 1.0 + */ +struct CredentialInfo { + /**< Credential ID. */ + unsigned long credentialId; + /**< Executor index under the authentication framework. */ + unsigned long executorIndex; + /**< Template ID. */ + unsigned long templateId; + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Executor matcher. */ + unsigned int executorMatcher; + /**< Executor sensor hint under the same authentication type. 0 is not allowed. */ + unsigned int executorSensorHint; +}; + +/** + * @brief Defines credential enrollment information. + * + * @since 4.0 + * @version 1.0 + */ +struct EnrolledInfo { + /**< Enrollment ID. */ + unsigned long enrolledId; + /**< Authentication type. See @{AuthType}. */ + int authType; +}; + +/** + * @brief Defines enrollment result information. + * + * @since 4.0 + * @version 1.0 + */ +struct EnrollResultInfo { + /**< Credential ID. */ + unsigned long credentialId; + /**< Old credential information. See {@link CredentialInfo}. */ + struct CredentialInfo oldInfo; + /**< Protection key for the user file key. */ + unsigned char[] rootSecret; + /**< Old protection key for the user file key. */ + unsigned char[] oldRootSecret; + /**< Indicates the authentication token of the user password. */ + unsigned char[] authToken; +}; + +/** + * @brief Defines scheduling information. + * + * @since 3.2 + * @version 2.0 + */ +struct ScheduleInfo { + /**< Schedule index of authentication. */ + unsigned long scheduleId; + /**< Templates to authenticate. */ + unsigned long[] templateIds; + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Executor matcher. */ + unsigned int executorMatcher; + /**< Operation to perform. See @{scheduleMode}*/ + int scheduleMode; + /**< Executor information. See @{ExecutorInfo}. */ + struct ExecutorInfo[] executors; + /**< Executor messages. */ + unsigned char[][] executorMessages; + /**< Remote message. */ + unsigned char[] remoteMessage; +}; + +/** + * @brief Defines enrolled users information. + * + * @since 4.0 + * @version 1.1 + */ +struct UserInfo { + /**< SecureUid of this user. */ + unsigned long secureUid; + /**< PinSubType of this user. See @{@PinSubType}. */ + int pinSubType; + /**< Related enrolled information list. See @{EnrolledInfo}. */ + struct EnrolledInfo[] enrolledInfos; +}; + +/** + * @brief Defines enrolled users information. + * + * @since 4.1 + * @version 1.2 + */ +struct ExtUserInfo { + /**< User ID. */ + int userId; + /**< info of this user. */ + struct UserInfo userInfo; +}; + +/** + * @brief Defines the authentication param. + * + * @since 5.0 + * @version 1.0 + */ +struct AuthParamBase { + /**< User ID. */ + int userId; + /**< Authentication trust level. */ + unsigned int authTrustLevel; + /**< Executor sensor hint under the same authentication type, 0 is not allowed. */ + unsigned int executorSensorHint; + /**< Challenge of the authentication. */ + unsigned char[] challenge; + /**< Caller name. */ + String callerName; + /**< Caller Type. */ + int callerType; + /**< Calling napi or innerkit api version. */ + int apiVersion; +}; + +/** + * @brief Defines the authentication parameter. + * + * @since 5.0 + * @version 1.0 + */ +struct AuthParam { + /**< Authentication parameter. See @{AuthParamBase}. */ + AuthParamBase baseParam; + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Authentication intent. See @{AuthIntent}. */ + int authIntent; + /**< Is os account verified. */ + boolean isOsAccountVerified; + /**< Remote device id. */ + unsigned char[] remoteDeviceId; + /**< Remote executor info. */ + unsigned char[] remoteExecutorInfo; +}; + +/** + * @brief Request information of reused unlock result. + * + * @since 5.0 + * @version 1.0 + */ +struct ReuseUnlockParam { + /**< Authentication parameter. See @{AuthParam}. */ + AuthParamBase baseParam; + /** Authentication type. See @{AuthType}. */ + int[] authTypes; + /** The allowable reuse duration. */ + unsigned long reuseUnlockResultDuration; + /** Reuse unlock result mode. See @{ReuseMode}. */ + int reuseUnlockResultMode; +}; + +/** + * @brief Defines credential enrollment parameters. + * + * @since 3.2 + * @version 2.0 + */ +struct EnrollParam { + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Executor sensor hint under the same authentication type. 0 is not allowed. */ + unsigned int executorSensorHint; + /**< Caller name. */ + String callerName; + /** Caller Type. */ + int callerType; + /**< Calling napi or innerkit api version. */ + int apiVersion; + /**< User ID. */ + int userId; + /**< User Type. */ + int userType; +}; + +/** +* @brief Define credential enrollment ID information. +* + * @since 5.0 + * @version 1.0 +*/ +struct EnrolledState { + /** Desensitization Enrolled ID. */ + unsigned long credentialDigest; + /** Number of Credential. */ + unsigned short credentialCount; +}; + +/** + * @brief The reuse result of unlock device. + * + * @since 5.0 + * @version 1.0 + */ +struct ReuseUnlockInfo { + /**< Authentication type. See @{AuthType}. */ + int authType; + /**< Authentication token. */ + unsigned char[] token; + /**< Enrolled state. See @{EnrolledState}. */ + EnrolledState enrolledState; +}; + +/** @} */ \ No newline at end of file -- Gitee From 01f2e1e9378f9932551d27d2ec74e0cc3792b36d Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 1 Apr 2024 17:34:59 +0800 Subject: [PATCH 150/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=AB=98=E5=B8=A7?= =?UTF-8?q?=E7=8E=87=E6=8B=8D=E7=85=A7=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 1 + camera/metadata/include/camera_metadata_item_info.h | 2 ++ camera/metadata/src/camera_metadata_info.cpp | 1 + camera/v1_3/Types.idl | 6 ++++++ 4 files changed, 10 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 9fdc9f52..5b3a4393 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -289,6 +289,7 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, + OHOS_ABILITY_CAPTURE_EXPECT_TIME, OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 8e89333d..c4c81781 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -338,6 +338,8 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"motionDetectionSupportValue", META_TYPE_BYTE, 1}, [OHOS_CONTROL_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"motionDetectionControlValue", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_CAPTURE_EXPECT_TIME - + OHOS_CAMERA_EFFECT_START] = {"captureExpectTime", META_TYPE_UINT32, -1}, [OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED - OHOS_CAMERA_EFFECT_START] = {"exposureHintSupported", META_TYPE_BYTE, 1}, [OHOS_CONTROL_EXPOSURE_HINT_MODE - OHOS_CAMERA_EFFECT_START] = {"exposureHintMode", META_TYPE_BYTE, 1}, [OHOS_STATUS_ALGO_MEAN_Y - OHOS_CAMERA_EFFECT_START] = {"algoMeanY", META_TYPE_UINT32, 1}, diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 59caa944..1f18eb3f 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -190,6 +190,7 @@ const std::vector g_metadataTags = { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, + OHOS_ABILITY_CAPTURE_EXPECT_TIME, OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 925e29e6..21b607c3 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -57,6 +57,12 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { * Slow motion mode, which dedicated to video recording slow motion */ HIGH_FRAME_RATE = 13, + + /** + * High resolution photo mode, which dedicated to capture recording high frame rate + */ + HIGH_RESOLUTION_PHOTO = 14, + }; /** -- Gitee From 57a56288d36235f9250fd2c0ec83ed8281da747c Mon Sep 17 00:00:00 2001 From: Bobie Date: Wed, 27 Mar 2024 21:41:03 +0800 Subject: [PATCH 151/210] add annotations Signed-off-by: Bobie --- distributed_audio/audioext/v2_0/BUILD.gn | 2 +- .../audioext/v2_0/IDAudioCallback.idl | 119 ++++++++++++++++++ .../audioext/v2_0/IDAudioManager.idl | 61 +++++++++ distributed_audio/audioext/v2_0/Types.idl | 49 ++++++++ 4 files changed, 230 insertions(+), 1 deletion(-) diff --git a/distributed_audio/audioext/v2_0/BUILD.gn b/distributed_audio/audioext/v2_0/BUILD.gn index a3287a3b..a5d1b965 100644 --- a/distributed_audio/audioext/v2_0/BUILD.gn +++ b/distributed_audio/audioext/v2_0/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("../../../../hdf_core/adapter/uhdf2/hdi.gni") +import("//drivers/hdf_core/adapter/uhdf2/hdi.gni") hdi("daudioext") { module_name = "daudioext" sources = [ diff --git a/distributed_audio/audioext/v2_0/IDAudioCallback.idl b/distributed_audio/audioext/v2_0/IDAudioCallback.idl index f8004a46..2b25a533 100644 --- a/distributed_audio/audioext/v2_0/IDAudioCallback.idl +++ b/distributed_audio/audioext/v2_0/IDAudioCallback.idl @@ -13,17 +13,136 @@ * limitations under the License. */ +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Provides APIs for communication to distributed audio SA service + * + * Call of the transmission interface between the distributed audio HDF service and + * the distributed audio SA service, and provide hardware driver interfaces for + * the upper layer. + * + * @since 5.0 + * @version 2.0 + */ + package ohos.hdi.distributed_audio.audioext.v2_0; import ohos.hdi.distributed_audio.audioext.v2_0.Types; +/** + * @brief Basic operations for Distributed Audio devices. + * + * Enabling and disabling distributed audio devices, setting audio parameters, + * event notifications, and other related operations + * + * @since 5.0 + * @version 2.0 + */ [callback] interface IDAudioCallback { + /** + * @brief Create distributed audio stream. + * + * @param streamId Stream ID for distributed audio devices. + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ CreateStream([in] int streamId); + + /** + * @brief Create distributed audio stream. + * + * @param streamId Stream ID for distributed audio devices. + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ DestroyStream([in] int streamId); + + /** + * @brief Set distributed audio device parameters. + * + * @param streamId Stream ID for distributed audio devices. + * @param param Audio parameters (sampling rate, number of channels, etc.) + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ SetParameters([in] int streamId, [in] struct AudioParameter param); + + /** + * @brief Notify distributed audio SA of events. + * + * @param streamId Stream ID for distributed audio devices. + * @param event Notification event types (such as focus events, volume events) + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ NotifyEvent([in] int streamId, [in] struct DAudioEvent event); + + /** + * @brief Write stream to distributed audio devices. + * + * @param streamId Stream ID for distributed audio devices. + * @param data frame data of audio stream. + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ WriteStreamData([in] int streamId, [in] struct AudioData data); + + /** + * @brief Reading recording streams from distributed audio devices. + * + * @param streamId Stream ID for distributed audio devices. + * @param data Frame data of audio stream. + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ ReadStreamData([in] int streamId, [out] struct AudioData data); + + /** + * @brief Get the current frame rate and timestamp for reading and writing + * + * @param streamId Stream ID for distributed audio devices. + * @param frames current frame number + * @param time current timestamp + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ ReadMmapPosition([in] int streamId, [out] unsigned long frames, [out] struct CurrentTime time); + + /** + * @brief Refresh shared memory information + * + * @param streamId Stream ID for distributed audio devices. + * @param fd file descriptors corresponding to shared memory + * @param ashmemLength The total number of bytes of shared memory. + * @param lengthPerTrans The number of bytes to be transmitted. + * + * @return a value of 0 if success, return a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ RefreshAshmemInfo([in] int streamId, [in] FileDescriptor fd, [in] int ashmemLength, [in] int lengthPerTrans); } \ No newline at end of file diff --git a/distributed_audio/audioext/v2_0/IDAudioManager.idl b/distributed_audio/audioext/v2_0/IDAudioManager.idl index 68b05f43..4f180e04 100644 --- a/distributed_audio/audioext/v2_0/IDAudioManager.idl +++ b/distributed_audio/audioext/v2_0/IDAudioManager.idl @@ -13,13 +13,74 @@ * limitations under the License. */ +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Provides APIs for registration, unregistration, and event notification. + * + * The interface for the distributed audio, providing hardware driver registration, + * unregistration, and event notification capabilities for distributed audio SA. + * + * @since 5.0 + * @version 2.0 + */ + package ohos.hdi.distributed_audio.audioext.v2_0; import ohos.hdi.distributed_audio.audioext.v2_0.IDAudioCallback; import ohos.hdi.distributed_audio.audioext.v2_0.Types; +/** + * @brief Basic operations of Distributed Audio devices + * + * Register and unregister distributed audio devices, and provide event notification + * mechanisms for distributed audio SA to the HDF layer. + * + * @since 5.0 + * @version 2.0 + */ interface IDAudioManager { + /** + * @brief Registering distributed audio device drivers + * + * @param adpName Distributed audio device NetworkID. + * @param devId Distributed audio device Port ID. + * @param capability Distributed audio device capability set (including sampling rate, channels, etc). + * @param callbackObj Distributed Audio SA Callback. + * + * @return a value of 0 if success and a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ RegisterAudioDevice([in] String adpName, [in] int devId, [in] String capability, [in] IDAudioCallback callbackObj); + + /** + * @brief Unregistering distributed audio device drivers + * + * @param adpName Distributed audio device NetworkID. + * @param devId Distributed audio device Port ID. + * + * @return a value of 0 if success and a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ UnRegisterAudioDevice([in] String adpName, [in] int devId); + + /** + * @brief Distribute audio device SA notification events. + * + * @param adpName Distributed audio device NetworkID. + * @param devId Distributed audio device Port ID. + * @param streamId Stream ID for distributed audio devices. + * @param event Notification event types (such as focus events, volume events). + * + * @return a value of 0 if success and a negative value if failed. + * + * @since 5.0 + * @version 2.0 + */ NotifyEvent([in] String adpName, [in] int devId, [in] int streamId, [in] struct DAudioEvent event); } \ No newline at end of file diff --git a/distributed_audio/audioext/v2_0/Types.idl b/distributed_audio/audioext/v2_0/Types.idl index bd15987b..f573e863 100644 --- a/distributed_audio/audioext/v2_0/Types.idl +++ b/distributed_audio/audioext/v2_0/Types.idl @@ -13,11 +13,39 @@ * limitations under the License. */ +/** + * @addtogroup Distributed Audio + * @{ + * + * @brief Provides APIs for communication between drivers and SA of distributed audio. + * + * The Distributed Audio module includes operations on distributed audio devices, + * stream operations, and various callbacks. Communicate with Source SA through the IDAudioCallback + * and IDAudioManager interfaces to achieve distributed functionality. + * + * @since 5.0 + * @version 2.0 + */ + package ohos.hdi.distributed_audio.audioext.v2_0; + +/** + * @brief Enumerates the mode of port operation. + * + * @since 5.0 + * @version 2.0 + */ enum PortOperationMode { NORMAL_MODE = 0, MMAP_MODE = 1, }; + +/** + * @brief Enumerates the audio parameters. + * + * @since 5.0 + * @version 2.0 + */ struct AudioParameter { unsigned int format; unsigned int channelCount; @@ -29,14 +57,35 @@ struct AudioParameter { enum PortOperationMode capturerFlags; String ext; }; + +/** + * @brief Defines audio frame data. + * + * @since 5.0 + * @version 2.0 + */ struct AudioData { struct AudioParameter param; byte[] data; }; + +/** + * @brief Defines the notification event of distributed audio. + * + * @since 5.0 + * @version 2.0 + */ struct DAudioEvent { int type; String content; }; + +/** + * @brief Defines the timestamp of distributed audio. + * + * @since 5.0 + * @version 2.0 + */ struct CurrentTime { long tvSec; long tvNSec; -- Gitee From d9ef628530bdfd0d7cb00a6b71ca51978d119770 Mon Sep 17 00:00:00 2001 From: qinjihong Date: Tue, 2 Apr 2024 15:44:52 +0800 Subject: [PATCH 152/210] fix security alarm Signed-off-by: qinjihong --- camera/metadata/src/metadata_utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index 91e2c877..79ed72df 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -481,7 +481,7 @@ int MetadataUtils::copyEncodeToStringMem(common_metadata_header_t *meta, char *e std::shared_ptr MetadataUtils::DecodeFromString(std::string setting) { - uint32_t ret; + int32_t ret; uint32_t totalLen = setting.capacity(); const uint32_t headerLength = sizeof(common_metadata_header_t); const uint32_t itemLen = sizeof(camera_metadata_item_entry_t); @@ -543,7 +543,7 @@ std::shared_ptr MetadataUtils::DecodeFromString(std::string sett int MetadataUtils::copyDecodeFromStringMem(common_metadata_header_t *meta, char *decodeData) { uint8_t *metaMetadataData = GetMetadataData(meta); - uint32_t ret; + int32_t ret; if (metaMetadataData == nullptr) { METADATA_ERR_LOG("MetadataUtils::DecodeFromString GetMetadataData failed"); return CAM_META_FAILURE; -- Gitee From c2b735cb9f8c6ab209be7d4a37c5ea24929c08d7 Mon Sep 17 00:00:00 2001 From: liufeng Date: Wed, 3 Apr 2024 14:56:44 +0800 Subject: [PATCH 153/210] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=BA=AE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/include/camera_device_ability_items.h | 9 +++++++++ camera/metadata/include/camera_metadata_item_info.h | 6 ++++++ camera/metadata/src/camera_metadata_info.cpp | 3 +++ 3 files changed, 18 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 9fdc9f52..56fe0680 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -113,6 +113,9 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_ABILITY_MOVING_PHOTO, + OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS, + OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH, + OHOS_STATUS_AMBIENT_BRIGHTNESS, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, @@ -666,4 +669,10 @@ typedef enum control_moving_photo_enum { OHOS_CAMERA_MOVING_PHOTO_ON, } control_moving_photo_enum_t; +// OHOS_STATUS_AMBIENT_BRIGHTNESS enumeration values +typedef enum camera_ambient_brightness_type { + OHOS_CAMERA_AMBIENT_BRIGHTNESS_DARK = 0, + OHOS_CAMERA_AMBIENT_BRIGHTNESS_LIGHT, +}camera_ambient_brightness_type_t; + #endif diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 8e89333d..b93c7800 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -88,6 +88,12 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"customSnapshotDuration", META_TYPE_UINT32, 1}, [OHOS_ABILITY_MOVING_PHOTO - OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMovingPhoto", META_TYPE_INT32, -1}, + [OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS - + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityAmbientBrightnessStatus", META_TYPE_UINT32, -1}, + [OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH - + OHOS_CAMERA_PROPERTIES_START] = {"cameraControlAmbientBrightnessStatusReportSwitch", META_TYPE_BYTE, 1}, + [OHOS_STATUS_AMBIENT_BRIGHTNESS - + OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusAmbientBrightness", META_TYPE_UINT32, 1}, }; static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 59caa944..b8bcfc52 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -45,6 +45,9 @@ const std::vector g_metadataTags = { OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_ABILITY_MOVING_PHOTO, + OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS, + OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH, + OHOS_STATUS_AMBIENT_BRIGHTNESS, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, -- Gitee From 9ee695493b0256a1e9c58874d7ded3b7c29284e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Wed, 3 Apr 2024 07:43:34 +0000 Subject: [PATCH 154/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 56fe0680..3ae7b37e 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -670,9 +670,9 @@ typedef enum control_moving_photo_enum { } control_moving_photo_enum_t; // OHOS_STATUS_AMBIENT_BRIGHTNESS enumeration values -typedef enum camera_ambient_brightness_type { +typedef enum camera_ambient_brightness_status_type { OHOS_CAMERA_AMBIENT_BRIGHTNESS_DARK = 0, OHOS_CAMERA_AMBIENT_BRIGHTNESS_LIGHT, -}camera_ambient_brightness_type_t; +}camera_ambient_brightness_status_type_t; #endif -- Gitee From bf7046aaa3feb1e2b483c8b785e8e93b446cf891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Wed, 3 Apr 2024 08:00:20 +0000 Subject: [PATCH 155/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 3ae7b37e..2e9ca94f 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -669,10 +669,16 @@ typedef enum control_moving_photo_enum { OHOS_CAMERA_MOVING_PHOTO_ON, } control_moving_photo_enum_t; -// OHOS_STATUS_AMBIENT_BRIGHTNESS enumeration values +// OHOS_STATUS_AMBIENT_BRIGHTNESS enumeration values typedef enum camera_ambient_brightness_status_type { OHOS_CAMERA_AMBIENT_BRIGHTNESS_DARK = 0, OHOS_CAMERA_AMBIENT_BRIGHTNESS_LIGHT, -}camera_ambient_brightness_status_type_t; +} camera_ambient_brightness_status_type_t; + +// OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS enumeration values +typedef enum camera_supported_enum { + OHOS_CAMERA_NOT_SUPPORTED = 0, + OHOS_CAMERA_SUPPORTED, +} camera_supported_enum_t; #endif -- Gitee From e90c5c7939dcc4b6dca451cf7b451bd86f534cec Mon Sep 17 00:00:00 2001 From: m00804696 Date: Wed, 3 Apr 2024 18:39:23 +0800 Subject: [PATCH 156/210] cache 1 Signed-off-by: m00804696 --- display/composer/cache_manager/cache_manager.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/display/composer/cache_manager/cache_manager.h b/display/composer/cache_manager/cache_manager.h index 15210883..3cd1f126 100644 --- a/display/composer/cache_manager/cache_manager.h +++ b/display/composer/cache_manager/cache_manager.h @@ -65,6 +65,7 @@ public: uint32_t Size() const { + std::lock_guard lock(mutex_); return caches_.size(); } @@ -100,6 +101,7 @@ public: CacheType* SearchCache(IdType id) const { + std::lock_guard lock(mutex_); auto cacheItem = caches_.find(id); if (cacheItem == caches_.end()) { return nullptr; @@ -110,6 +112,7 @@ public: void TravelCaches(std::function func) const { + std::lock_guard lock(mutex_); for (auto const& [key, value] : caches_) { func(key, *value.get()); } -- Gitee From 2280e31dc3e194301126775e7ddbfc0edfa52559 Mon Sep 17 00:00:00 2001 From: suyongliang Date: Tue, 2 Apr 2024 15:24:51 +0800 Subject: [PATCH 157/210] HDI codec interface upgrade 3.0 Signed-off-by: suyongliang --- codec/bundle.json | 25 ++ codec/v2_0/CodecTypes.idl | 4 - codec/v3_0/BUILD.gn | 35 ++ codec/v3_0/CodecExtTypes.idl | 359 +++++++++++++++++++ codec/v3_0/CodecTypes.idl | 477 ++++++++++++++++++++++++++ codec/v3_0/ICodecCallback.idl | 135 ++++++++ codec/v3_0/ICodecComponent.idl | 465 +++++++++++++++++++++++++ codec/v3_0/ICodecComponentManager.idl | 141 ++++++++ 8 files changed, 1637 insertions(+), 4 deletions(-) create mode 100644 codec/v3_0/BUILD.gn create mode 100644 codec/v3_0/CodecExtTypes.idl create mode 100644 codec/v3_0/CodecTypes.idl create mode 100644 codec/v3_0/ICodecCallback.idl create mode 100644 codec/v3_0/ICodecComponent.idl create mode 100644 codec/v3_0/ICodecComponentManager.idl diff --git a/codec/bundle.json b/codec/bundle.json index 694f26a9..934a0076 100644 --- a/codec/bundle.json +++ b/codec/bundle.json @@ -29,6 +29,7 @@ "sub_component": [ "//drivers/interface/codec/v1_0:codec_idl_target", "//drivers/interface/codec/v2_0:codec_idl_target", + "//drivers/interface/codec/v3_0:codec_idl_target", "//drivers/interface/codec/image/v1_0:image_idl_target" ], "test": [ @@ -82,6 +83,30 @@ "header_base": "//drivers/interface/codec" } }, + { + "name": "//drivers/interface/codec/v3_0:libcodec_proxy_3.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/codec" + } + }, + { + "name": "//drivers/interface/codec/v3_0:codec_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/codec" + } + }, + { + "name": "//drivers/interface/codec/v3_0:libcodec_stub_3.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/codec" + } + }, { "name": "//drivers/interface/codec/image/v1_0:libimage_proxy_1.0", "header": { diff --git a/codec/v2_0/CodecTypes.idl b/codec/v2_0/CodecTypes.idl index 773e5162..cf1f8aa7 100644 --- a/codec/v2_0/CodecTypes.idl +++ b/codec/v2_0/CodecTypes.idl @@ -286,10 +286,6 @@ struct CodecVideoPortCap { For details, see {@link BitRateMode}. */ struct RangeValue frameRate; /**< Frame rate range. */ int[] measuredFrameRate; /**< Frame rate measured. */ - boolean isSupportLowLatency; /**< Whether supports low-latency feature */ - boolean isSupportTSVC; /**< Whether supports temporal level scale feature */ - boolean isSupportLTR; /**< Whether supports long-term reference feature */ - int maxLTRFrameNum; /**< Maximum long-term reference frame numbers supported */ }; /** diff --git a/codec/v3_0/BUILD.gn b/codec/v3_0/BUILD.gn new file mode 100644 index 00000000..239c7676 --- /dev/null +++ b/codec/v3_0/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2024 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("../../../hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libcodec_proxy_3.0") { + deps = [] + public_configs = [] + } +} else { + hdi("codec") { + module_name = "codec_service" + + sources = [ + "CodecExtTypes.idl", + "CodecTypes.idl", + "ICodecCallback.idl", + "ICodecComponent.idl", + "ICodecComponentManager.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_codec" + } +} diff --git a/codec/v3_0/CodecExtTypes.idl b/codec/v3_0/CodecExtTypes.idl new file mode 100644 index 00000000..a7bf6b96 --- /dev/null +++ b/codec/v3_0/CodecExtTypes.idl @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2024 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.codec.v3_0; + +import ohos.hdi.codec.v3_0.CodecTypes; + +/** + * @brief Enumerates the extended codec codingtyps. + + * @since 4.1 + * @version 2.0 + */ +enum CodecVideoExType { + CODEC_VIDEO_CodingVP9 = 10, /** VP9 Index in Codec HDI */ + CODEC_VIDEO_CodingHEVC = 11, /** HEVC Index in Codec HDI */ +}; + +/** + * @brief Enumerates the extended HEVC profile. + + * @since 4.1 + * @version 2.0 + */ +enum CodecHevcProfile { + CODEC_HEVC_PROFILE_INVALID = 0x0, + CODEC_HEVC_PROFILE_MAIN = 0x1, + CODEC_HEVC_PROFILE_MAIN10 = 0x2, + CODEC_HEVC_PROFILE_MAIN_STILL = 0x3, + // main_10 profile with HDR SEI support. + CODEC_HEVC_PROFILE_MAIN10_HDR10 = 0x1000, + CODEC_HEVC_PROFILE_MAIN10_HDR10_PLUS = 0x2000, + CODEC_HEVC_PROFILE_MAX = 0x7FFFFFFF +}; + +/** + * @brief Enumerates the extended HEVC level. + + * @since 4.1 + * @version 2.0 + */ +enum CodecHevcLevel { + CODEC_HEVC_LEVEL_INVALID = 0x0, + CODEC_HEVC_MAIN_TIER_LEVEL1 = 0x1, + CODEC_HEVC_HIGH_TIER_LEVEL1 = 0x2, + CODEC_HEVC_MAIN_TIER_LEVEL2 = 0x4, + CODEC_HEVC_HIGH_TIER_LEVEL2 = 0x8, + CODEC_HEVC_MAIN_TIER_LEVEL21 = 0x10, + CODEC_HEVC_HIGH_TIER_LEVEL21 = 0x20, + CODEC_HEVC_MAIN_TIER_LEVEL3 = 0x40, + CODEC_HEVC_HIGH_TIER_LEVEL3 = 0x80, + CODEC_HEVC_MAIN_TIER_LEVEL31 = 0x100, + CODEC_HEVC_HIGH_TIER_LEVEL31 = 0x200, + CODEC_HEVC_MAIN_TIER_LEVEL4 = 0x400, + CODEC_HEVC_HIGH_TIER_LEVEL4 = 0x800, + CODEC_HEVC_MAIN_TIER_LEVEL41 = 0x1000, + CODEC_HEVC_HIGH_TIER_LEVEL41 = 0x2000, + CODEC_HEVC_MAIN_TIER_LEVEL5 = 0x4000, + CODEC_HEVC_HIGH_TIER_LEVEL5 = 0x8000, + CODEC_HEVC_MAIN_TIER_LEVEL51 = 0x10000, + CODEC_HEVC_HIGH_TIER_LEVEL51 = 0x20000, + CODEC_HEVC_MAIN_TIER_LEVEL52 = 0x40000, + CODEC_HEVC_HIGH_TIER_LEVEL52 = 0x80000, + CODEC_HEVC_MAIN_TIER_LEVEL6 = 0x100000, + CODEC_HEVC_HIGH_TIER_LEVEL6 = 0x200000, + CODEC_HEVC_MAIN_TIER_LEVEL61 = 0x400000, + CODEC_HEVC_HIGH_TIER_LEVEL61 = 0x800000, + CODEC_HEVC_MAIN_TIER_LEVEL62 = 0x1000000, + CODEC_HEVC_HIGH_TIER_LEVEL62 = 0x2000000, + CODEC_HEVC_HIGH_TIER_MAX = 0x7FFFFFFF +}; + +/** + * @brief Enumerates the buffer types. + + * @since 4.1 + * @version 2.0 + */ +enum CodecBufferType { + /** Invalid buffer type. */ + CODEC_BUFFER_TYPE_INVALID = 0, + /** Virtual address type. */ + CODEC_BUFFER_TYPE_VIRTUAL_ADDR = 0x1, + /** Shared memory. */ + CODEC_BUFFER_TYPE_AVSHARE_MEM_FD = 0x2, + /** Handle. */ + CODEC_BUFFER_TYPE_HANDLE = 0x4, + /** Dynamic handle. */ + CODEC_BUFFER_TYPE_DYNAMIC_HANDLE = 0x8, + /** DMA memory. */ + CODEC_BUFFER_TYPE_DMA_MEM_FD = 0x10, +}; + +/** + * @brief Defines the SupportBuffer. + + * @since 4.1 + * @version 2.0 + */ +struct SupportBufferType { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned int bufferTypes; /** Supported buffer types */ +}; + +/** + * @brief Define the UseBuffer. + + * @since 4.1 + * @version 2.0 + */ +struct UseBufferType { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned int bufferType; /** Buffer type */ +}; + +/** + * @brief Defines the BufferHandleUsage. + + * @since 4.1 + * @version 2.0 + */ +struct GetBufferHandleUsageParams { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned long usage; /** Usage */ +}; + +/** + * @brief Defines the CodecVideoPortFormatParam. + + * @since 4.1 + * @version 2.0 + */ +struct CodecVideoPortFormatParam { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned int codecColorIndex; /** Color format index */ + unsigned int codecColorFormat; /** Color format defined in Display */ + unsigned int codecCompressFormat; /** See */ + unsigned int framerate; /** Q16 format */ +}; + +/** + * @brief Defines the ControlRateConstantQuality. + + * @since 4.1 + * @version 2.0 + */ +struct ControlRateConstantQuality { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned int qualityValue; /** Control rate constant quality */ +}; + +/** + * @brief Defines the WorkingFrequencyParam. + + * @since 4.1 + * @version 2.0 + */ +struct WorkingFrequencyParam { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int level; /** Working frequency level */ +}; + +/** + * @brief Defines the WorkingFrequencyParam. + + * @since 4.1 + * @version 2.0 + */ +struct ProcessNameParam { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + String processName; /** Process Name */ +}; + +/** + * @brief Defines the AudioL2HCParam. + + * @since 5.0 + * @version 3.0 + */ +struct AudioL2HCParam { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int sampleRate; /** Sample Rate */ + unsigned int sampleFormat; /** Sample Format */ + unsigned int channels; /** Channels */ + unsigned int bitRate; /** Bit Rate */ + unsigned int reserved; /** reserved word */ +}; + +/** + * @brief Enumerates the extended codec indexes. + + * @since 4.1 + * @version 3.0 + */ +enum CodecIndexExType { + /** Extended BufferType index, value = Codec_IndexExtBufferTypeStartUnused + 0x00a00000 */ + Codec_IndexExtBufferTypeStartUnused = 0x6F000000 + 0x00a00000, + /** SupportBuffer */ + Codec_IndexParamSupportBufferType, + /** UseBuffer */ + Codec_IndexParamUseBufferType, + /** GetBufferHandleUsage */ + Codec_IndexParamGetBufferHandleUsage, + /** CodecVideoPortFormatParam */ + Codec_IndexCodecVideoPortFormat, + /** ControlRateConstantQuality */ + Codec_IndexParamControlRateConstantQuality, + /** Codec_IndexParamVideoHevc */ + Codec_IndexParamVideoHevc = 0x6F000000 + 0x00a00007, + /** range/primary/transfer/matrix */ + Codec_IndexColorAspects, + /** WorkingFrequencyParam */ + Codec_IndexParamWorkingFrequency, + /** ProcessNameParam */ + Codec_IndexParamProcessName, + /** AudioL2HCParam */ + Codec_IndexParamAudioL2HC, +}; + +/** + * @brief Structure for controlling HEVC video encoding + + * @since 4.1 + * @version 2.0 + */ +struct CodecVideoParamHevc { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + enum CodecHevcProfile profile; /** Hevc profile. For details, see {@link CodecHevcProfile}. */ + enum CodecHevcLevel level; /** Hevc level. For details, see {@link CodecHevcLevel}. */ + unsigned int keyFrameInterval; /** Distance between consecutive I-frames (including one of the I frams). + 0 means interval is unspecified and can be freely chosen by the codec. + 1 means a stream of only I frams. other means the real value. */ +}; + +/** + * @brief Enumerates the range type of color aspect. + + * @since 4.1 + * @version 2.0 + */ +enum RangeType { + RANGE_UNSPECIFIED, + RANGE_FULL, + RANGE_LIMITED, + RANGE_MAX = 0xff, +}; + +/** + * @brief Enumerates the primaries of color aspect. + + * @since 4.1 + * @version 2.0 + */ +enum Primaries { + PRIMARIES_UNSPECIFIED, + PRIMARIES_BT709, //Rec. ITU-R BT.709-6 + PRIMARIES_BT470_6M, //Rec. ITU-R BT.470-6 System M + PRIMARIES_BT601_625, //Rec. ITU-R BT.601-7 625 or Rec. ITU-R BT.470-6 System B,G + PRIMARIES_BT601_525, //Rec. ITU-R BT.601-7 525 or SMPTE ST 170 or SMPTE ST 240 + PRIMARIES_GENERICFILM, //Generic Film + PRIMARIES_BT2020, //Rec. ITU-R BT.2020-2 or Rec. ITU-R BT.2100-2 + PRIMARIES_MAX = 0xff, +}; + +/** + * @brief Enumerates the Transfer of color aspect. + + * @since 4.1 + * @version 2.0 + */ +enum Transfer { + TRANSFER_UNSPECIFIED, + TRANSFER_LINEAR, //Linear transfer characteristics + TRANSFER_SRGB, //IEC 61966-2-1 sRGB + TRANSFER_SMPTE170, //SMPTE ST 170 or Rec. ITU-R BT.709-6 or BT.601-7 or BT.2020-2 + TRANSFER_GAMMA22, //Rec. ITU-R BT.470-6 System M + TRANSFER_GAMMA28, //Rec. ITU-R BT.470-6 System B,G + TRANSFER_PQ, //Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system + TRANSFER_HLG, //Rec. ITU-R BT.2100-2 hybrid log gamma (HLG) system + TRANSFER_SMPTE240 = 0x40, //SMPTE ST 240 + TRANSFER_XVYCC, //IEC 61966-2-4 + TRANSFER_BT1361, //Rec. ITU-R BT.1361-0 extended colour gamut system + TRANSFER_ST428, //SMPTE ST 428-1 + TRANSFER_MAX = 0xff, +}; + +/** + * @brief Enumerates the MatrixCoeffs of color aspect. + + * @since 4.1 + * @version 2.0 + */ +enum MatrixCoeffs { + MATRIX_UNSPECIFED, + MATRIX_BT709, //Rec. ITU-R BT.709-6 + MATRIX_FCC, //United States Federal Communications Commission + MATRIX_BT601, //Rec. ITU-R BT.601-7 or Rec. ITU-R BT.470-6 System B,G + MATRIX_SMPTE240, //SMPTE ST 240 + MATRIX_BT2020, //Rec. ITU-R BT.2100-2 (non-constant luminance) + MATRIX_BT2020CONSTANT, //Rec. ITU-R BT.2100-2 (constant luminance) + MATRIX_MAX = 0xff, +}; + +/** + * @brief Structure for video color aspsect + + * @since 4.1 + * @version 2.0 + */ +struct ColorAspects { + enum RangeType range; + enum Primaries primaries; + enum Transfer transfer; + enum MatrixCoeffs matrixCoeffs; +}; + +/** + * @brief Structure for controlling color space + + * @since 4.1 + * @version 2.0 + */ +struct CodecVideoColorspace { + unsigned int size; /** Size of the structure */ + union CodecVersionType version; /** Component version */ + unsigned int portIndex; /** Port index */ + unsigned int requestingDataSpace; + unsigned int dataSpaceChanged; + unsigned int pixeFormat; + unsigned int dataSpace; + struct ColorAspects aspects; +}; \ No newline at end of file diff --git a/codec/v3_0/CodecTypes.idl b/codec/v3_0/CodecTypes.idl new file mode 100644 index 00000000..2e13152c --- /dev/null +++ b/codec/v3_0/CodecTypes.idl @@ -0,0 +1,477 @@ +/* + * Copyright (c) 2024 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 Codec + * @{ + * + * @brief Defines APIs of the Codec module. + * + * The Codec module provides APIs for initializing the custom data and audio and video codecs, + * setting codec parameters, and controlling and transferring data. + * + * @since 4.1 + * @version 3.0 + */ + +/** + * @file CodecTypes.idl + * + * @brief Defines custom data types used in the Codec module APIs, + * including the codec types, audio and video parameters, and buffers. + * + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Defines the path for the package of the Codec module APIs. + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v3_0; + +/** + * @brief Enumerates the codec types. + + * @since 4.1 + * @version 2.0 + */ +enum CodecType { + VIDEO_DECODER, /**< Video decoder. */ + VIDEO_ENCODER, /**< Video encoder. */ + AUDIO_DECODER, /**< Audio decoder. */ + AUDIO_ENCODER, /**< Audio encoder. */ + INVALID_TYPE, /**< Invalid type. */ +}; + +/** + * @brief Enumerates the types of audio and video that can be encoded or decoded. + + * @since 4.1 + * @version 2.0 + */ +enum AvCodecRole { + MEDIA_ROLETYPE_IMAGE_JPEG = 0, /**< JPEG image. */ + MEDIA_ROLETYPE_VIDEO_AVC, /**< H.264 video. */ + MEDIA_ROLETYPE_VIDEO_HEVC, /**< H.265 video. */ + MEDIA_ROLETYPE_AUDIO_FIRST = 0x10000, /**< Audio. */ + MEDIA_ROLETYPE_AUDIO_AAC = 0x10000, /**< Advanced Audio Coding (AAC). */ + MEDIA_ROLETYPE_AUDIO_G711A, /**< G.711 a-law audio. */ + MEDIA_ROLETYPE_AUDIO_G711U, /**< G.711 μ-law audio. */ + MEDIA_ROLETYPE_AUDIO_G726, /**< G.726 audio. */ + MEDIA_ROLETYPE_AUDIO_PCM, /**< PCM audio. */ + MEDIA_ROLETYPE_AUDIO_MP3, /**< MP3. */ + MEDIA_ROLETYPE_INVALID, /**< Invalid type. */ +}; + +/** + * @brief Enumerates the codec profiles. + + * @since 4.1 + * @version 2.0 + */ +enum Profile { + INVALID_PROFILE = 0, /**< Invalid profile. */ + AAC_LC_PROFILE = 0x1000, /**< AAC low complexity profile. */ + AAC_MAIN_PROFILE, /**< AAC main profile. */ + AAC_HE_V1_PROFILE, /**< Profile combining AAC high efficiency and spectral band replication (SBR), + also known as HE-AAC, AAC+, or aacPlus v1. */ + AAC_HE_V2_PROFILE, /**< HE-AAC combined with SBR and Parametric Stereo (PS), + also known as AAC++ or aacPlus v2. */ + AAC_LD_PROFILE, /**< AAC low delay profile. */ + AAC_ELD_PROFILE, /**< AAC enhanced low delay profile. */ + AVC_BASELINE_PROFILE = 0x2000, /**< H.264 baseline profile. */ + AVC_MAIN_PROFILE, /**< H.264 main profile. */ + AVC_HIGH_PROFILE, /**< H.264 high profile. */ + HEVC_MAIN_PROFILE = 0x3000, /**< H.265 main profile. */ + HEVC_MAIN_10_PROFILE, /**< H.265 10-bit main profile. */ +}; + +/** + * @brief Enumerates the playback capabilities. + + * @since 4.1 + * @version 2.0 + */ +enum CodecCapsMask { + CODEC_CAP_ADAPTIVE_PLAYBACK = 0x1, /**< Adaptive playback. */ + CODEC_CAP_SECURE_PLAYBACK = 0x2, /**< Secure playback. */ + CODEC_CAP_TUNNEL_PLAYBACK = 0x4, /**< Tunnel playback. */ + CODEC_CAP_MULTI_PLANE = 0x10000, /**< Multi-plane (video image plane and audio channel plane) capability. */ +}; + +/** + * @brief Enumerates the audio sampling rates. + + * @since 4.1 + * @version 2.0 + */ +enum AudioSampleRate { + AUD_SAMPLE_RATE_8000 = 8000, /**< 8000 */ + AUD_SAMPLE_RATE_12000 = 12000, /**< 12000 */ + AUD_SAMPLE_RATE_11025 = 11025, /**< 11025 */ + AUD_SAMPLE_RATE_16000 = 16000, /**< 16000 */ + AUD_SAMPLE_RATE_22050 = 22050, /**< 22050 */ + AUD_SAMPLE_RATE_24000 = 24000, /**< 24000 */ + AUD_SAMPLE_RATE_32000 = 32000, /**< 32000 */ + AUD_SAMPLE_RATE_44100 = 44100, /**< 44100 */ + AUD_SAMPLE_RATE_48000 = 48000, /**< 48000 */ + AUD_SAMPLE_RATE_64000 = 64000, /**< 64000 */ + AUD_SAMPLE_RATE_96000 = 96000, /**< 96000 */ + AUD_SAMPLE_RATE_INVALID, /**< Invalid sampling rate */ +}; + +/** + * @brief Enumerates the audio sampling formats. + * + * For the planar sampling format, the data of each channel is independently stored in data. + * For the packed sampling format, only the first data is used, and the data of each channel is interleaved. + + * @since 4.1 + * @version 2.0 + */ +enum CodecAudioSampleFormat { + AUDIO_SAMPLE_FMT_U8 = 0, /**< Unsigned 8-bit integer, packed. */ + AUDIO_SAMPLE_FMT_S16, /**< Signed 16-bit integer, packed. */ + AUDIO_SAMPLE_FMT_S32, /**< Signed 32-bit integer, packed. */ + AUDIO_SAMPLE_FMT_FLOAT, /**< Float, packed. */ + AUDIO_SAMPLE_FMT_DOUBLE, /**< Double, packed. */ + AUDIO_SAMPLE_FMT_U8P, /**< Unsigned 8-bit integer, planar. */ + AUDIO_SAMPLE_FMT_S16P, /**< Signed 16-bit integer, planar. */ + AUDIO_SAMPLE_FMT_S32P, /**< Signed 32-bit integer, planar. */ + AUDIO_SAMPLE_FMT_FLOATP, /**< Float, planar. */ + AUDIO_SAMPLE_FMT_DOUBLEP, /**< Double, planar. */ + AUDIO_SAMPLE_FMT_INVALID, /**< Invalid sampling format. */ +}; + +/** + * @brief Enumerates the codec processing modes. + + * @since 4.1 + * @version 2.0 + */ +enum CodecProcessMode { + PROCESS_BLOCKING_INPUT_BUFFER = 0x1, /**< Input buffer in sync mode. */ + PROCESS_BLOCKING_OUTPUT_BUFFER = 0x2, /**< Output buffer in sync mode. */ + PROCESS_BLOCKING_CONTROL_FLOW = 0x4, /**< Control flow in sync mode. */ + PROCESS_NONBLOCKING_INPUT_BUFFER = 0x100, /**< Input buffer in async mode. */ + PROCESS_NONBLOCKING_OUTPUT_BUFFER = 0x200, /**< Output buffer in async mode. */ + PROCESS_NONBLOCKING_CONTROL_FLOW = 0x400, /**< Control flow in asynchronous mode. */ +}; + +/** + * @brief Enumerates the shared memory types. + + * @since 4.1 + * @version 2.0 + */ +enum ShareMemTypes { + READ_WRITE_TYPE = 0x1, /**< Shared memory that is readable and writable. */ + READ_ONLY_TYPE = 0x2, /**< Shared memory that is read-only. */ +}; + +/** + * @brief Enumerates the bit rate modes. + + * @since 4.1 + * @version 2.0 + */ +enum BitRateMode { + BIT_RATE_MODE_INVALID, /**< Invalid value. */ + BIT_RATE_MODE_VBR, /**< Variable bit rate. */ + BIT_RATE_MODE_CBR, /**< Constant bit rate. */ + BIT_RATE_MODE_CQ, /**< Constant quality. */ + BIT_RATE_MODE_VCBR, /**< Constrained variable bit rate. */ + BIT_RATE_MODE_ABR, /**< Average bit rate. */ +}; + +/** + * @brief Enumerates the component states. + + * @since 4.1 + * @version 2.0 + */ +enum CodecEventType { + CODEC_EVENT_CMD_COMPLETE, /**< The component has completed a command. */ + CODEC_EVENT_ERROR, /**< The component has detected an error. */ + CODEC_EVENT_MARK, /**< The component has detected the buffer mark. */ + CODEC_EVENT_PORT_SETTINGS_CHANGED, /**< The component has reported port setting changes. */ + CODEC_EVENT_BUFFER_FLAG, /**< The component has detected an EOS. */ + CODEC_EVENT_RESOURCES_ACQUIRED, /**< The component has been granted resources and is automatically + starting the state change from CODEC_STATE_WAIT_FOR_RESOURCES + to CODEC_STATE_IDLE. */ + CODEC_EVENT_COMPONENT_RESUMED, /**< The component is resumed due to reacquisition of resources. */ + CODEC_EVENT_DYNAMIC_RESOURCES_AVAILABLE, /**< The component has acquired previously unavailable + dynamic resources. */ + CODEC_EVENT_PORT_FORMAT_DETECTED, /**< The component has detected a supported format. */ + CODEC_EVENT_KHRONOS_EXTENSIONS = 0x6F000000, /**< Reserved region for introducing Khronos standard extensions. */ + CODEC_EVENT_VENDOR_START_UNUSED = 0x7F000000, /**< Reserved region for introducing vendor extensions. */ + CODEC_EVENT_MAX = 0x7FFFFFFF, /**< Maximum value. */ +}; + +/** + * @brief Enumerates the cmd parameters of the SendCommand API in ICodecComponent. + + * @since 4.1 + * @version 2.0 + */ +enum CodecCommandType +{ + CODEC_COMMAND_STATE_SET, /**< Change the component state. */ + CODEC_COMMAND_FLUSH, /**< Flush the data queue of a component. */ + CODEC_COMMAND_PORT_DISABLE, /**< Disable a port on a component. */ + CODEC_COMMAND_PORT_ENABLE, /**< Enable a port on a component. */ + CODEC_COMMAND_MARK_BUFFER, /**< Mark a component/buffer for observation. */ + CODEC_COMMAND_KHRONOS_EXTENSIONS = 0x6F000000, /**< Reserved region for introducing Khronos standard extensions. */ + CODEC_COMMAND_VENDOR_START_UNUSED = 0x7F000000, /**< Reserved region for introducing vendor extensions. */ + CODEC_COMMAND_MAX = 0x7FFFFFFF, /**< Maximum value. */ +}; + +/** + * @brief Enuerates the component states. + + * @since 4.1 + * @version 2.0 + */ +enum CodecStateType +{ + CODEC_STATE_INVALID, /**< The component has detected that its internal data structures are + corrupted so that the state cannot be correctly determined. */ + CODEC_STATE_LOADED, /**< The component has been loaded but has not completed + initialization. Only ICodecComponent.SetParameter + and ICodecComponent.GetParameter can be called for a + component in this state. */ + CODEC_STATE_IDLE, /**< The component initialization is complete, and the component is + ready to start. */ + CODEC_STATE_EXECUTING, /**< The component has accepted the start command and is processing + data (if the data is available). */ + CODEC_STATE_PAUSE, /**< The component has received the pause command. */ + CODEC_STATE_WAIT_FOR_RESOURCES, /**< The component is waiting for resources, either after preemption + or before it acquires the requested resources. */ + CODEC_STATE_KHRONOS_EXTENSIONS = 0x6F000000, /**< Reserved region for introducing Khronos standard extensions. */ + CODEC_STATE_VENDOR_START_UNUSED = 0x7F000000, /**< Reserved region for introducing vendor extensions. */ + CODEC_STATE_MAX = 0x7FFFFFFF, /**< Maximum value. */ +}; + +/** + * @brief Enuerates the port supplier preferences when establishing a tunnel between two ports. + + * @since 4.1 + * @version 2.0 + */ +enum CodecBufferSupplierType +{ + CODEC_BUFFER_SUPPLY_UNSPECIFIED = 0, /**< The port that provides the buffers is not specified. */ + CODEC_BUFFER_SUPPLY_INPUT, /**< The input port provides the buffers. */ + CODEC_BUFFER_SUPPLY_OUTPUT, /**< The output port provides the buffers. */ + CODEC_BUFFER_SUPPLY_KHRONOS_EXTENSIONS = 0x6F000000, /**< Reserved region for introducing Khronos + standard extensions. */ + CODEC_BUFFER_SUPPLY_VENDOR_START_UNUSED = 0x7F000000, /**< Reserved region for introducing vendor extensions. */ + CODEC_BUFFER_SUPPLY_MAX = 0x7FFFFFFF, /**< Maximum value. */ +}; + +/** + * @brief Defines the alignment structure. + + * @since 4.1 + * @version 2.0 + */ +struct Alignment { + int widthAlignment; /**< Alignment value of the width. */ + int heightAlignment; /**< Alignment value of the height. */ +}; + +/** + * @brief Defines a rectangle. + + * @since 4.1 + * @version 2.0 + */ +struct Rect { + int width; /**< Width of the rectangle. */ + int height; /**< Height of the rectangle. */ +}; + +/** + * @brief Defines a value range. + + * @since 4.1 + * @version 2.0 + */ +struct RangeValue { + int min; /**< Minimum value. */ + int max; /**< Maximum value. */ +}; + +/** + * @brief Defines the video encoding and decoding capabilities. + + * @since 4.1 + * @version 3.0 + */ +struct CodecVideoPortCap { + struct Rect minSize; /**< Minimum resolution supported. */ + struct Rect maxSize; /**< Maximum resolution supported. */ + struct Alignment whAlignment; /**< Alignment values of the width and height. */ + struct RangeValue blockCount; /**< Value range for the number of blocks supported. */ + struct RangeValue blocksPerSecond; /**< Value range for the number of blocks processed per second. */ + struct Rect blockSize; /**< Block size supported. */ + int[] supportPixFmts; /**< Supported pixel formats. For details, see PixeFormat defined by + display_type.h in {@link Display}. */ + enum BitRateMode[] bitRatemode; /**< Transmission rate modes, which can be constant or variable. + For details, see {@link BitRateMode}. */ + struct RangeValue frameRate; /**< Frame rate range. */ + int[] measuredFrameRate; /**< Frame rate measured. */ + boolean isSupportLowLatency; /**< Whether supports low-latency feature */ + boolean isSupportTSVC; /**< Whether supports temporal level scale feature */ + boolean isSupportLTR; /**< Whether supports long-term reference feature */ + int maxLTRFrameNum; /**< Maximum long-term reference frame numbers supported */ +}; + +/** + * @brief Defines the audio encoding and decoding capabilities. + + * @since 4.1 + * @version 2.0 + */ +struct CodecAudioPortCap { + int[] sampleFormats; /**< Supported audio sampling formats. For details, see {@link AudioSampleFormat}. */ + int[] sampleRate; /**< Supported audio sampling rates. For details, see {@link AudioSampleRate}. */ + int[] channelLayouts; /**< Supported channel layouts, which include single channel, balanced channel, + and 3D stereo channel. */ + int[] channelCount; /**< Supported number of audio channels. */ +}; + +/** + * @brief Defines the audio and video encoding and decoding capabilities. + + * @since 4.1 + * @version 2.0 + */ +struct PortCap { + struct CodecVideoPortCap video; /**< Video encoding and decoding capabilities. */ + struct CodecAudioPortCap audio; /**< Audio encoding and decoding capabilities. */ +}; + +/** + * @brief Defines the version type of a component. + + * @since 4.1 + * @version 2.0 + */ +struct CodecVerType { + unsigned char majorVersion; /**< Major version accessor element. */ + unsigned char minorVersion; /**< Minor version accessor element. */ + unsigned char revision; /**< Revision version accessor element. */ + unsigned char step; /**< Step version accessor element. */ +}; + +/** + * @brief Defines the component version information. + + * @since 4.1 + * @version 2.0 + */ +union CodecVersionType { + struct CodecVerType version; /**< Component version. */ + unsigned int nVersion; /**< 32-bit value to make accessing the version easily done in a single + word size copy or compare operation. */ +}; + +/** + * @brief Defines the codec capabilities. + + * @since 4.1 + * @version 2.0 + */ +struct CodecCompCapability { + enum AvCodecRole role; /**< Media type. */ + enum CodecType type; /**< Codec type. */ + String compName; /**< Name of the codec component. */ + int[] supportProfiles; /**< Supported profiles. For details, see {@link Profile}. */ + int maxInst; /**< Maximum instance. */ + boolean isSoftwareCodec; /**< Whether it is a software codec. */ + int processModeMask; /**< Codec processing mode mask. For details, + see {@link CodecProcessMode}. */ + unsigned int capsMask; /**< Mask of the codec playback capabilities. For details, + see {@link CodecCapsMask}. */ + struct RangeValue bitRate; /**< Supported bit rate range. */ + struct PortCap port; /**< Supported audio and video encoding/decoding capabilities. */ + boolean canSwapWidthHeight; /**< Whether width and height verification is supported. */ +}; + +/** + * @brief Defines the codec buffer information. + + * @since 4.1 + * @version 2.0 + */ +struct OmxCodecBuffer { + unsigned int bufferId; /**< Buffer ID. */ + unsigned int size; /**< Size of the structure. */ + union CodecVersionType version; /**< Component version. */ + unsigned int bufferType; /**< Buffer type. For details, see {@link CodecBufferType}. */ + NativeBuffer bufferhandle; /**< Buffer handle used for encoding or decoding. For details, + see {@link NativeBuffer}. */ + FileDescriptor fd; /**< Anonymous shared memory file descriptor. */ + unsigned int allocLen; /**< Size of the buffer allocated. */ + unsigned int filledLen; /**< Size of the buffer filled. */ + unsigned int offset; /**< Offset to the start position of the valid data in the buffer. */ + FileDescriptor fenceFd; /**< Fence file descriptor. */ + enum ShareMemTypes type; /**< Shared memory type. */ + long pts; /**< Timestamp of the first logical sample in the buffer. */ + unsigned int flag; /**< Buffer specific flag. */ + unsigned char[] alongParam; /**< Along frame parameter. */ +}; + +/** + * @brief Defines the structure that is used to pass data from an output port to an input port. + + * @since 4.1 + * @version 2.0 + */ +struct CodecTunnelSetupType { + unsigned int tunnelFlags; /**< Bit flags for tunneling. */ + enum CodecBufferSupplierType supplier; /**< Supplier preference. */ +}; + +/** + * @brief Defines the component information. + + * @since 4.1 + * @version 2.0 + */ +struct CompVerInfo { + String compName; /**< Component name. */ + unsigned char[] compUUID; /**< UUID of the component. */ + union CodecVersionType compVersion; /**< OMX component version. */ + union CodecVersionType specVersion; /**< Version of the specifications on which the component is built. */ +}; + +/** + * @brief Defines the event information to report. + + * @since 4.1 + * @version 2.0 + */ +struct EventInfo { + long appData; /**< Upper-layer instance passed in when the callback is invoked. */ + unsigned int data1; /**< Error type, which can be portIndex or other data. */ + unsigned int data2; /**< Data 2 carried in the reported event. */ + byte[] eventData; /**< Data carried in the reported event. */ +}; diff --git a/codec/v3_0/ICodecCallback.idl b/codec/v3_0/ICodecCallback.idl new file mode 100644 index 00000000..dc3a7226 --- /dev/null +++ b/codec/v3_0/ICodecCallback.idl @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 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 Codec + * @{ + * + * @brief Defines APIs of the Codec module. + * + * The Codec module provides APIs for initializing the custom data and audio and video codecs, + * setting codec parameters, and controlling and transferring data. + * + * @since 4.1 + * @version 3.0 + */ + +/** + * @file ICodecCallback.idl + * + * @brief Defines the callbacks used to report codec events and processing results of the input and output buffers. + * + * + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Defines the path for the package of the Codec module APIs. + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v3_0; + +import ohos.hdi.codec.v3_0.CodecTypes; + +/** + * @brief Defines the callbacks of the Codec module. + * + * The following callbacks are provided: + * - Callback used to report component error events, command completion events, and port setting events. + * For details, see {@link EventHandler}. + * - Callback invoked when the input port has data processed in the buffer. For details, see {@link EmptyBufferDone}. + * - Callback invoked when the output port has data filled into the buffer. For details, see {@link FillBufferDone}. + * The callbacks are registered by using: + * - {@link CreateComponent} when a component is created. + * - {@link SetCallbacks} when the component is in the OMX_StateLoaded state. + */ + + +[callback] interface ICodecCallback { + + /** + * @brief Reports an event, such as an error, a command completion event, and port setting changes. + * + * - When event is CODEC_EVENT_CMD_COMPLETE and eventData is null, + * data2 indicates a state if data1 is CODEC_COMMAND_STATE_SET and indicates a port if + * data1 is any CodecCommandType other than CODEC_COMMAND_STATE_SET. + * - When event is CODEC_EVENT_ERROR, data1 indicates an error code and data2 + * and eventData are both 0. + * - When event is CODEC_EVENT_MARK, data1 and data2 are both 0 and + * eventData points to the mark. + * - When event is CODEC_EVENT_PORT_SETTINGS_CHANGED, data1 indicates a port and data2 + * and eventData are 0. + * - When event is CODEC_EVENT_BUFFER_FLAG, data1 indicates a port, data2 indicates a + * flag, and eventData is 0. + * - When event is CODEC_EVENT_RESOURCES_ACQUIRED or CODEC_EVENT_DYNAMIC_RESOURCES_AVAILABLE, + * data1, data2, and eventData are 0. + * + * @param event Indicates the type of the event to report. For details, see {@link CodecEventType}. + * @param info Indicates the pointer to the information to report. For details, see {@link EventInfo}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + EventHandler([in] enum CodecEventType event, [in] struct EventInfo info); + + /** + * @brief Reports an event indicating that the encoding or decoding in the input buffer is complete. + * + * + * @param appData Indicates the application data. Generally, it is an upper-layer instance + * passed in for the callback. + * @param buffer Indicates information about the input buffer that was emptied. For details, + * see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the + * error codes, see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + EmptyBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); + + /** + * @brief Reports an event indicating that the output buffer is filled. + * + * + * @param appData Indicates the application data. Generally, it is an upper-layer instance + * passed in for the callback. + * @param buffer Indicates information about the buffer that was filled. For details, see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + FillBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); +} diff --git a/codec/v3_0/ICodecComponent.idl b/codec/v3_0/ICodecComponent.idl new file mode 100644 index 00000000..676539d2 --- /dev/null +++ b/codec/v3_0/ICodecComponent.idl @@ -0,0 +1,465 @@ +/* + * Copyright (c) 2024 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 Codec + * @{ + * + * @brief Defines APIs of the Codec module. + * + * The Codec module provides APIs for initializing the custom data and audio and video codecs, + * setting codec parameters, and controlling and transferring data. + * + * @since 4.1 + * @version 3.0 + */ + +/** + * @file ICodecComponent.idl + * + * @brief Declares the APIs for codec components. + * + * You can use these APIs to obtain component information, send commands to components, + * set component parameters, and control and transfer buffer data. + * After creating a component, you can use these APIs to implement encoding and decoding. + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Defines the path for the package of the Codec module APIs. + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v3_0; + +import ohos.hdi.codec.v3_0.CodecTypes; +import ohos.hdi.codec.v3_0.ICodecCallback; + +/** + * @brief Defines the APIs for codec components. + * + * The APIs can be used to: + * - Obtain the component version. + * - Obtain and set component parameters. + * - Send a command to a component and obtain the component state. + * - Set callbacks. + * - Set or release the buffer used by a component. + * - Manage the input and output buffers for encoding and decoding. + * For details, see the description of the APIs. + */ + +interface ICodecComponent { + + /** + * @brief Obtains the version of this codec component. + * + * + * @param verInfo Indicates the pointer to the component version information. For details, see {@link CompVerInfo}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetComponentVersion([out] struct CompVerInfo verInfo); + + /** + * @brief Sends a command to this component. + * + * If the command is used to set the component state, a callback will be invoked to return the result. + * There is no callback invoked for other commands. + * + * @param cmd Indicates the command to send. For details, see {@link CodecCommandType}. + * @param param Indicates the parameter carried in the command. + * - If cmd is CODEC_COMMAND_STATE_SET, param can be set to any value of {@link CodecStateType}. + * - If cmd is CODEC_COMMAND_FLUSH, CODEC_COMMAND_PORT_DISABLE, CODEC_COMMAND_PORT_ENABLE, + * or CODEC_COMMAND_MARK_BUFFER, param is the target port. + * @param cmdData Indicates the pointer to the OMX_MARKTYPE structure when cmd + * is CODEC_COMMAND_MARK_BUFFER. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + SendCommand([in] enum CodecCommandType cmd, [in] unsigned int param, [in] byte[] cmdData); + + /** + * @brief Obtains the parameter settings of this component. + * + * For the component in a state other than OMX_StateInvalid, you can use this API to obtain the + * component's parameter settings. For details about the component states, see {@link OMX_STATETYPE}. + * + * @param index Indicates the index of the structure to fill. For details, + * see OMX_INDEXTYPE defined by OMX IL. + * @param inParamStruct Indicates the pointer to the application allocated structure to be filled by the component. + * @param outParamStruct Indicates the pointer to the application allocated structure filled by the component. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about + * the error codes, see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetParameter([in] unsigned int index, [in] byte[] inParamStruct, [out] byte[] outParamStruct); + + /** + * @brief Sets parameters for this component, that is, sends an initialization + * parameter structure to the component. + * + * You can use this API to set component parameters when: + * - The component is in the OMX_StateLoaded state (the component has been loaded). + * - The component is in the OMX_StateWaitForResources state (the component is waiting for required resources). + * - The component or port is disabled. + * For details about the component states, see {@link OMX_STATETYPE}. + * + * @param index Indicates the index of the structure to set. For details, see OMX_INDEXTYPE defined by OMX IL. + * @param paramStruct Indicates the pointer to the application allocated structure used to set + * parameters for this component. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + SetParameter([in] unsigned int index, [in] byte[] paramStruct); + + /** + * @brief Obtains the configuration of this component. + * + * You can use this API to obtain the component configuration after a component is loaded. + * + * @param index Indicates the index of the structure to fill. For details, see {@link OMX_INDEXTYPE}. + * @param inCfgStruct Indicates the pointer to the application allocated structure to be filled by the component. + * @param outCfgStruct Indicates the pointer to the application allocated structure filled by the component. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetConfig([in] unsigned int index, [in] byte[] inCfgStruct, [out] byte[] outCfgStruct); + + /** + * @brief Sets the component configuration. + * + * You can use this API to set the component configuration after a component is loaded. + * + * @param index Indicates the index of the structure to set. For details, see {@link OMX_INDEXTYPE}. + * @param cfgStruct Indicates the pointer to the application allocated structure used to set the component. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + SetConfig([in] unsigned int index, [in] byte[] cfgStruct); + + /** + * @brief Obtains the extended index of this component based on a given string. + * + * The extended string can be converted into an OpenMAX IL structure index, which is used (as an input parameter) + * in {@link GetParameter} or {@link SetParameter}. + * + * @param paramName Indicates the string that can be converted into the structure index. + * @param indexType Indicates the structure index obtained. For details, see {@link OMX_INDEXTYPE}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetExtensionIndex([in] String paramName, [out] unsigned int indexType); + + /** + * @brief Obtains the current state of this component. + * + * + * + * @param state Indicates the pointer to the state obtained. For details about the component + * states, see {@link CodecStateType}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetState([out] enum CodecStateType state); + + /** + * @brief Sets up tunneling for this component. + * + * For a component in the OMX_StateLoaded state (the component is loaded), you can use this API + * to determine whether + * tunneling is possible and if yes, to set up the tunneling. + * For details about the component states, see {@link OMX_STATETYPE}. + * + * @param port Indicates the port on the component used for the setting. + * @param tunneledComp Indicates the handle of the tunnel component. + * @param tunneledPort Indicates the port on the component to be used for tunneling. + * @param inTunnelSetup Indicates the pointer to the tunnel setup structure {@link OMX_TUNNELSETUPTYPE} to set. + * @param outTunnelSetup Indicates the pointer to the tunnel setup structure {@link OMX_TUNNELSETUPTYPE} set. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + ComponentTunnelRequest([in] unsigned int port, [in] int tunneledComp, [in] unsigned int tunneledPort, [in] + struct CodecTunnelSetupType inTunnelSetup, [out] struct CodecTunnelSetupType outTunnelSetup); + + /** + * @brief Requests the component to use a buffer that is already allocated by another component. + * + * This API is used when: + * - The component is in the OMX_StateLoaded state (the component is loaded) and has received a request for + * changing the state to OMX_StateIdle. + * - The component is in the OMX_StateWaitForResources state, the required resources are available, and the + * component is ready to enter the OMX_StateIdle state. + * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. + * For details about the component states, see {@link OMX_STATETYPE}. + * + * @param portIndex Indicates the component port. + * @param inBuffer Indicates the pointer to the structure of the buffer to be used. For details, see {@link OmxCodecBuffer}. + * @param outBuffer Indicates the pointer to the structure of the buffer to be used. For details, see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + UseBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer outBuffer); + + /** + * @brief Requests the component to allocate a new buffer. + * + * This API is used to request a new buffer from a component when: + * - The component is in the OMX_StateLoaded state and has received a request for changing the + * state to OMX_StateIdle. + * - The component is in the OMX_StateWaitForResources state, the required resources are available, + * and the component is ready to enter the OMX_StateIdle state. + * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. + * For details about the component states, see {@link OMX_STATETYPE}. + * + * @param portIndex Indicates the component port. + * @param inBuffer Indicates the pointer to the structure of the buffer to be allocated. For details about + * the structure, see {@link OmxCodecBuffer}. + * @param outBuffer Indicates the pointer to the structure of the buffer allocated. For details about the + * structure, see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + AllocateBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, + [out] struct OmxCodecBuffer outBuffer); + + /** + * @brief Releases a buffer. + * + * This API is used when: + * - The component is in the OMX_StateIdle state and has received a request for changing the + * state to OMX_StateLoaded. + * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. + * For details about the component states, see {@link OMX_STATETYPE}. + * - This API can be called at any time. However, if it is not called in any of the previous conditions, + * the component may report an OMX_ErrorPortUnpopulated event. + * + * @param portIndex Indicates the component port. + * @param buffer Indicates the pointer to the structure of the buffer to release. For details about the + * structure, see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + FreeBuffer([in] unsigned int portIndex, [in] struct OmxCodecBuffer buffer); + + /** + * @brief Empties a buffer. + * + * This API can be called when the component is in the OMX_StateExecuting or OMX_StatePause state. For details + * about the component states, see {@link OMX_STATETYPE}. + * + * @param buffer Indicates the pointer to the structure of the buffer to empty. For details about the structure, + * see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + EmptyThisBuffer([in] struct OmxCodecBuffer buffer); + + /** + * @brief Fills a buffer with the encoding and decoding output by this component. + * + * This API can be called when the component is in the OMX_StateExecuting or OMX_StatePause state. For details + * about the component states, see {@link OMX_STATETYPE}. + * + * @param buffer Indicates the pointer to the structure of the buffer to be filled. For details about the + * structure, see {@link OmxCodecBuffer}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + FillThisBuffer([in] struct OmxCodecBuffer buffer); + + /** + * @brief Sets callbacks for this component. + * + * The callbacks will be invoked to report an event or report available input or output information when the + * component is in the OMX_StateLoaded state. For details about the component states, see {@link OMX_STATETYPE}. + * + * @param callbacks Indicates the pointer to the {@link ICodecCallback} object. + * @param appData Indicates the pointer to an application-defined value that will be returned by the callback. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + SetCallbacks([in] ICodecCallback callbacks, [in] long appData); + + /** + * @brief Deinitializes this component. + * + * This API will deinitialize and close a component in the OMX_StateLoaded state. For details about the + * component states, see {@link OMX_STATETYPE}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + ComponentDeInit(); + + /** + * @brief Uses the image provided by EGL as a buffer on the specified port. + * + * This API is used when: + * - The component is in the OMX_StateLoaded state and has received a request for changing the + * state to OMX_StateIdle. + * - The component is in the OMX_StateWaitForResources state, the required resources are available, + * and the component is ready to enter the OMX_StateIdle state. + * - The component is in the OMX_StateExecuting, OMX_StatePause, or OMX_StateIdle state on a disabled port. + * For details about the component states, see {@link OMX_STATETYPE}. + * + * @param portIndex Indicates the component port. + * @param inBuffer Indicates the pointer to the {@link OmxCodecBuffer} structure. + * @param outBuffer Indicates the pointer to the {@link OmxCodecBuffer} structure. + * @param eglImage Indicates the pointer to the image allocated by EGL. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + UseEglImage([in] unsigned int portIndex, [in] struct OmxCodecBuffer inBuffer, [out] struct OmxCodecBuffer + outBuffer, [in] byte[] eglImage); + + /** + * @brief Obtains the component role based on the index. + * + * + * + * @param role Indicates the role name obtained. + * @param index Indicates the index of the role. A component supports multiple roles. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error + * codes, see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + ComponentRoleEnum([out] unsigned char[] role, [in] unsigned int index); +} \ No newline at end of file diff --git a/codec/v3_0/ICodecComponentManager.idl b/codec/v3_0/ICodecComponentManager.idl new file mode 100644 index 00000000..875c1667 --- /dev/null +++ b/codec/v3_0/ICodecComponentManager.idl @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2024 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 Codec + * @{ + * + * @brief Defines APIs of the Codec module. + * + * The Codec module provides APIs for initializing the custom data and audio and video codecs, + * setting codec parameters, and controlling and transferring data. + * + * @since 4.1 + * @version 3.0 + */ + +/** + * @file ICodecComponentManager.idl + * + * @brief Declares the APIs for managing Codec components. + * + * You can use the APIs to obtain the component encoding and decoding capabilities, and create or destroy components. + * + * @since 4.1 + * @version 2.0 + */ + +/** + * @brief Defines the path for the package of the Codec module APIs. + * + * @since 4.1 + * @version 2.0 + */ +package ohos.hdi.codec.v3_0; + +import ohos.hdi.codec.v3_0.CodecTypes; +import ohos.hdi.codec.v3_0.ICodecComponent; +import ohos.hdi.codec.v3_0.ICodecCallback; + +/** + * @brief Defines the APIs for managing the codec components. + * + * The APIs can be used to: + * - Obtain the number of codec components and codec capabilities. + * - Create or destroy a codec component. + */ + +interface ICodecComponentManager { + + /** + * @brief Obtains the number of codec components. + * + * Codec capabilities can be further obtained based on the number of codec components. + * + * @param count Indicates the number of codec components obtained. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the + * error codes, see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetComponentNum([out] int count); + + /** + * @brief Obtains codec capabilities. + * + * You can use this API to obtain the encoding and decoding capabilities provided by the Codec module. + * For details, see {@link CodecCompCapability}. + * + * @param capList Indicates the codec capabilities {@link CodecCompCapability} obtained. + * @param count Indicates the number of codec components, which is obtained by {@link GetComponentNum}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + GetComponentCapabilityList([out] struct CodecCompCapability[] capList, [in] int count); + + /** + * @brief Creates a codec component instance. + * + * + * + * @param component Indicates the pointer to the Codec component created. + * @param componentId Indicates the ID of the component created. + * @param compName Indicates the component name. + * @param appData Indicates the pointer to an application-defined value that will be returned by the callback. + * @param callbacks Indicates the pointer to the OMX_CALLBACKTYPE structure. For details, + * see {@link ICodecCallback}. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the error codes, + * see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + CreateComponent([out] ICodecComponent component, [out] unsigned int componentId, [in] String compName, + [in] long appData, [in] ICodecCallback callbacks); + + /** + * @brief Destroys a codec component instance. + * + * + * + * @param componentId Indicates the ID of the codec component to destroy. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. + * @return Returns HDF_FAILURE if the execution fails. + * @return Returns other values if the underlying layer returns a failure. For details about the + * error codes, see OMX_ERRORTYPE defined by OpenMAX IL. + * + * @since 4.1 + * @version 2.0 + */ + DestroyComponent([in] unsigned int componentId); +} \ No newline at end of file -- Gitee From cbe41975bf2250dcf32bf56d54768ea5f1d3958d Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Sun, 7 Apr 2024 15:15:12 +0800 Subject: [PATCH 158/210] commit msg Signed-off-by: xuxuehai --- display/buffer/v1_0/BUILD.gn | 6 ++++++ display/buffer/v1_1/BUILD.gn | 6 ++++++ display/buffer/v1_2/BUILD.gn | 6 ++++++ display/composer/cache_manager/BUILD.gn | 6 ++++++ display/composer/hdifd_parcelable/BUILD.gn | 6 ++++++ display/composer/v1_0/BUILD.gn | 6 ++++++ display/composer/v1_1/BUILD.gn | 6 ++++++ display/composer/v1_2/BUILD.gn | 6 ++++++ 8 files changed, 48 insertions(+) diff --git a/display/buffer/v1_0/BUILD.gn b/display/buffer/v1_0/BUILD.gn index 0e96358e..34773851 100644 --- a/display/buffer/v1_0/BUILD.gn +++ b/display/buffer/v1_0/BUILD.gn @@ -51,6 +51,12 @@ ohos_shared_library("libdisplay_buffer_hdi_impl") { "hilog:libhilog", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" diff --git a/display/buffer/v1_1/BUILD.gn b/display/buffer/v1_1/BUILD.gn index da647f10..cf3723a6 100644 --- a/display/buffer/v1_1/BUILD.gn +++ b/display/buffer/v1_1/BUILD.gn @@ -51,6 +51,12 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_1") { "hilog:libhilog", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" diff --git a/display/buffer/v1_2/BUILD.gn b/display/buffer/v1_2/BUILD.gn index 7b9a4c22..f329dd4e 100644 --- a/display/buffer/v1_2/BUILD.gn +++ b/display/buffer/v1_2/BUILD.gn @@ -57,6 +57,12 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_2") { "hilog:libhilog", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" diff --git a/display/composer/cache_manager/BUILD.gn b/display/composer/cache_manager/BUILD.gn index 1faab993..31fb7687 100644 --- a/display/composer/cache_manager/BUILD.gn +++ b/display/composer/cache_manager/BUILD.gn @@ -32,6 +32,12 @@ ohos_shared_library("libcomposer_buffer_cache") { "hilog:libhilog", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ chipset_base_dir ] subsystem_name = "hdf" diff --git a/display/composer/hdifd_parcelable/BUILD.gn b/display/composer/hdifd_parcelable/BUILD.gn index 91714ec9..f9c98aa8 100644 --- a/display/composer/hdifd_parcelable/BUILD.gn +++ b/display/composer/hdifd_parcelable/BUILD.gn @@ -29,6 +29,12 @@ ohos_shared_library("libhdifd_parcelable") { "hilog:libhilog", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } innerapi_tags = [ "chipsetsdk" ] install_images = [ "system" ] diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index 116d99a2..736509c5 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -58,6 +58,12 @@ ohos_shared_library("libdisplay_composer_hdi_impl") { "init:libbegetutil", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" diff --git a/display/composer/v1_1/BUILD.gn b/display/composer/v1_1/BUILD.gn index 73d23456..c29c10c0 100644 --- a/display/composer/v1_1/BUILD.gn +++ b/display/composer/v1_1/BUILD.gn @@ -59,6 +59,12 @@ ohos_shared_library("libdisplay_composer_hdi_impl_1.1") { "init:libbegetutil", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" diff --git a/display/composer/v1_2/BUILD.gn b/display/composer/v1_2/BUILD.gn index a16db5e2..ae91e4fb 100644 --- a/display/composer/v1_2/BUILD.gn +++ b/display/composer/v1_2/BUILD.gn @@ -60,6 +60,12 @@ ohos_shared_library("libdisplay_composer_hdi_impl_1.2") { "init:libbegetutil", "ipc:ipc_single", ] + + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } install_images = [ "system" ] subsystem_name = "hdf" -- Gitee From c52d942818fe5354e09e3f44c9db7ea900b7c35d Mon Sep 17 00:00:00 2001 From: luzhiye Date: Sun, 7 Apr 2024 08:34:01 +0000 Subject: [PATCH 159/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 21b607c3..66de2f9d 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -59,7 +59,7 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { HIGH_FRAME_RATE = 13, /** - * High resolution photo mode, which dedicated to capture recording high frame rate + * High resolution photo mode, which dedicated to capture recording high pixel */ HIGH_RESOLUTION_PHOTO = 14, -- Gitee From 0b24ac61792b3f36ec8f2cfe18a4c0a20b4eb341 Mon Sep 17 00:00:00 2001 From: xuxuehai Date: Sun, 7 Apr 2024 17:37:42 +0800 Subject: [PATCH 160/210] commit msg Signed-off-by: xuxuehai --- display/buffer/v1_0/BUILD.gn | 2 +- display/buffer/v1_1/BUILD.gn | 2 +- display/buffer/v1_2/BUILD.gn | 2 +- display/composer/cache_manager/BUILD.gn | 2 +- display/composer/hdifd_parcelable/BUILD.gn | 2 +- display/composer/v1_0/BUILD.gn | 2 +- display/composer/v1_1/BUILD.gn | 2 +- display/composer/v1_2/BUILD.gn | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/display/buffer/v1_0/BUILD.gn b/display/buffer/v1_0/BUILD.gn index 34773851..37cedbf4 100644 --- a/display/buffer/v1_0/BUILD.gn +++ b/display/buffer/v1_0/BUILD.gn @@ -51,7 +51,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl") { "hilog:libhilog", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/buffer/v1_1/BUILD.gn b/display/buffer/v1_1/BUILD.gn index cf3723a6..c019e9a3 100644 --- a/display/buffer/v1_1/BUILD.gn +++ b/display/buffer/v1_1/BUILD.gn @@ -51,7 +51,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_1") { "hilog:libhilog", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/buffer/v1_2/BUILD.gn b/display/buffer/v1_2/BUILD.gn index f329dd4e..3aebf800 100644 --- a/display/buffer/v1_2/BUILD.gn +++ b/display/buffer/v1_2/BUILD.gn @@ -57,7 +57,7 @@ ohos_shared_library("libdisplay_buffer_hdi_impl_v1_2") { "hilog:libhilog", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/composer/cache_manager/BUILD.gn b/display/composer/cache_manager/BUILD.gn index 31fb7687..11e68573 100644 --- a/display/composer/cache_manager/BUILD.gn +++ b/display/composer/cache_manager/BUILD.gn @@ -32,7 +32,7 @@ ohos_shared_library("libcomposer_buffer_cache") { "hilog:libhilog", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/composer/hdifd_parcelable/BUILD.gn b/display/composer/hdifd_parcelable/BUILD.gn index f9c98aa8..7abbf47d 100644 --- a/display/composer/hdifd_parcelable/BUILD.gn +++ b/display/composer/hdifd_parcelable/BUILD.gn @@ -29,7 +29,7 @@ ohos_shared_library("libhdifd_parcelable") { "hilog:libhilog", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/composer/v1_0/BUILD.gn b/display/composer/v1_0/BUILD.gn index 736509c5..9f2bcd37 100644 --- a/display/composer/v1_0/BUILD.gn +++ b/display/composer/v1_0/BUILD.gn @@ -58,7 +58,7 @@ ohos_shared_library("libdisplay_composer_hdi_impl") { "init:libbegetutil", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/composer/v1_1/BUILD.gn b/display/composer/v1_1/BUILD.gn index c29c10c0..ad3b5f4e 100644 --- a/display/composer/v1_1/BUILD.gn +++ b/display/composer/v1_1/BUILD.gn @@ -59,7 +59,7 @@ ohos_shared_library("libdisplay_composer_hdi_impl_1.1") { "init:libbegetutil", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true diff --git a/display/composer/v1_2/BUILD.gn b/display/composer/v1_2/BUILD.gn index ae91e4fb..8d476203 100644 --- a/display/composer/v1_2/BUILD.gn +++ b/display/composer/v1_2/BUILD.gn @@ -60,7 +60,7 @@ ohos_shared_library("libdisplay_composer_hdi_impl_1.2") { "init:libbegetutil", "ipc:ipc_single", ] - + sanitize = { cfi = true cfi_cross_dso = true -- Gitee From d4baf359e9807b2c25b23d7d6602e814a8d54461 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 03:25:16 +0000 Subject: [PATCH 161/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 66de2f9d..7b731ea2 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -40,26 +40,36 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { /** * Professional mode, which dedicated to professional photo scene * Abandoned, use the new operationMode below + * @since 3.2 + * @version 1.3 */ PROFESSIONAL_V1_3 = PROFESSIONAL, /** * Professional mode, which dedicated to capture code + * @since 3.2 + * @version 1.3 */ PROFESSIONAL_PHOTO = 11, /** * Professional mode, which dedicated to video code + * @since 3.2 + * @version 1.3 */ PROFESSIONAL_VIDEO = 12, /** - * Slow motion mode, which dedicated to video recording slow motion + * Slow motion mode, which dedicated to video recording slow motion + * @since 3.2 + * @version 1.3 */ HIGH_FRAME_RATE = 13, /** * High resolution photo mode, which dedicated to capture recording high pixel + * @since 3.2 + * @version 1.3 */ HIGH_RESOLUTION_PHOTO = 14, -- Gitee From cf3f759ec039fd01a53522dc8c0e90e58eb347aa Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Mon, 8 Apr 2024 11:35:50 +0800 Subject: [PATCH 162/210] hdi interface Signed-off-by: lvqiang214 --- .../engine/v1_2/IntellVoiceEngineTypes.idl | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl index 103245b1..f1cf05c3 100644 --- a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl +++ b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl @@ -40,6 +40,30 @@ package ohos.hdi.intelligent_voice.engine.v1_2; +import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; + +/** + * @brief Enumerates intelligent voice engine content types. + * + * @since 5.0 + * @version 1.2 + */ +enum ContentType : ohos.hdi.intelligent_voice.engine.v1_0.ContentType { + DEFAULT_DSP_MODLE = 0, /**< Default dsp model */ + SHORT_WORD_DSP_MODEL = 1, /**< Short word dsp model */ +}; + +/** + * @brief Enumerates intelligent voice engine message types. + * + * @since 5.0 + * @version 1.2 + */ +enum IntellVoiceEngineMessageType : ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineMessageType { + INTELL_VOICE_ENGINE_MSG_RECONFIRM_RECOGNITION_COMPLETE = 5, /**< Reconfirm recognition complete */ + INTELL_VOICE_ENGINE_MSG_HEADSET_RECOGNIZE_COMPLETE = 6, /**< Headset recognize complete */ +}; + /** * @brief Enumerates upload hdi file types. * -- Gitee From 74ab20366e173f085949f7b509e2f50d70179c1e Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 03:37:31 +0000 Subject: [PATCH 163/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 7b731ea2..2bf87f1a 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -40,35 +40,35 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { /** * Professional mode, which dedicated to professional photo scene * Abandoned, use the new operationMode below - * @since 3.2 + * @since 4.1 * @version 1.3 */ PROFESSIONAL_V1_3 = PROFESSIONAL, /** * Professional mode, which dedicated to capture code - * @since 3.2 + * @since 5.0 * @version 1.3 */ PROFESSIONAL_PHOTO = 11, /** * Professional mode, which dedicated to video code - * @since 3.2 + * @since 5.0 * @version 1.3 */ PROFESSIONAL_VIDEO = 12, /** * Slow motion mode, which dedicated to video recording slow motion - * @since 3.2 + * @since 5.0 * @version 1.3 */ HIGH_FRAME_RATE = 13, /** * High resolution photo mode, which dedicated to capture recording high pixel - * @since 3.2 + * @since 5.0 * @version 1.3 */ HIGH_RESOLUTION_PHOTO = 14, -- Gitee From d3d65f23c9499682317c8e5a7a1fcb291607561a Mon Sep 17 00:00:00 2001 From: zhoujie223 Date: Sun, 7 Apr 2024 10:14:41 +0800 Subject: [PATCH 164/210] =?UTF-8?q?IssueNo:=20=E8=8E=B7=E5=8F=96IMEISVN?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 获取IMEISVN方式 Sig:SIG_Telephony Feature or Bugfix: Feature Binary Source: No Signed-off-by: zhoujie223 --- ril/bundle.json | 22 ++++++++++ ril/v1_3/BUILD.gn | 34 +++++++++++++++ ril/v1_3/IRil.idl | 87 +++++++++++++++++++++++++++++++++++++++ ril/v1_3/IRilCallback.idl | 71 ++++++++++++++++++++++++++++++++ ril/v1_3/Types.idl | 32 ++++++++++++++ 5 files changed, 246 insertions(+) create mode 100644 ril/v1_3/BUILD.gn create mode 100644 ril/v1_3/IRil.idl create mode 100644 ril/v1_3/IRilCallback.idl create mode 100644 ril/v1_3/Types.idl diff --git a/ril/bundle.json b/ril/bundle.json index 19643963..a6d3dcce 100644 --- a/ril/bundle.json +++ b/ril/bundle.json @@ -29,6 +29,7 @@ "sub_component": [ "//drivers/interface/ril/v1_1:ril_idl_target", "//drivers/interface/ril/v1_2:ril_idl_target", + "//drivers/interface/ril/v1_3:ril_idl_target", "//base/telephony/ril_adapter/interfaces/innerkits:hril_innerkits" ], "test": [ @@ -76,6 +77,27 @@ "header_base": "//drivers/interface/ril" } }, + { + "name": "//drivers/interface/ril/v1_3:libril_proxy_1.3", + "header": { + "header_files": [], + "header_base": "//drivers/interface/ril" + } + }, + { + "name": "//drivers/interface/ril/v1_3:libril_stub_1.3", + "header": { + "header_files": [], + "header_base": "//drivers/interface/ril" + } + }, + { + "name": "//drivers/interface/ril/v1_3:ril_idl_headers_1.3", + "header": { + "header_files": [], + "header_base": "//drivers/interface/ril" + } + }, { "type": "so", "name": "//base/telephony/ril_adapter/interfaces/innerkits:hril_innerkits", diff --git a/ril/v1_3/BUILD.gn b/ril/v1_3/BUILD.gn new file mode 100644 index 00000000..6913ad6c --- /dev/null +++ b/ril/v1_3/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2024 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. + +DRIVERS_DIR = "../../.." +import("$DRIVERS_DIR/hdf_core/adapter/uhdf2/hdi.gni") +if (defined(ohos_lite)) { + group("libril_proxy_1.3") { + deps = [] + public_configs = [] + } +} else { + hdi("ril") { + module_name = "ril_service" + imports = [ "ohos.hdi.ril.v1_2:ril" ] + sources = [ + "IRil.idl", + "IRilCallback.idl", + "Types.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_ril" + } +} diff --git a/ril/v1_3/IRil.idl b/ril/v1_3/IRil.idl new file mode 100644 index 00000000..4073bee8 --- /dev/null +++ b/ril/v1_3/IRil.idl @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 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 Ril + * @{ + * + * @brief Defines Ril-related APIs. + * + * The radio interface layer (RIL) module provides APIs and callbacks for upper-layer + * telephony services, including call, SMS, MMS, network search, and SIM card services. + * + * @since 4.1 + * @version 1.3 + */ + +/** + * @file IRil.idl + * + * @brief Declares the request API of the RIL module. + * + * @since 4.1 + * @version 1.3 + */ + +/** + * @brief Defines the path for the package of the RIL module APIs. + * + * @since 4.1 + * @version 1.3 + */ +package ohos.hdi.ril.v1_3; + +import ohos.hdi.ril.v1_3.IRilCallback; +import ohos.hdi.ril.v1_2.IRil; +import ohos.hdi.ril.v1_3.Types; + +/** + * @brief Declares the request API of the RIL module. + * + * Request APIs are called to make calls, send SMS and MMS messages, activate SIM cards, + * and access the Internet. + * + * @since 4.1 + * @version 1.3 + */ +interface IRil extends ohos.hdi.ril.v1_2.IRil { + /** + * @brief Sets an IRil callback. + * + * @param rilCallback Callback to set. For details, see {@link IRilCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] SetCallback1_3([in] IRilCallback rilCallback); + + /** + * @brief Obtains the international mobile equipment identity software version(IMEISV). + * + * @param slotId Card slot ID. + * @param serialId Serial ID of a request. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-0 value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + [oneway] GetImeiSv([in] int slotId, [in] int serialId); +} +/** @} */ diff --git a/ril/v1_3/IRilCallback.idl b/ril/v1_3/IRilCallback.idl new file mode 100644 index 00000000..1eca3ada --- /dev/null +++ b/ril/v1_3/IRilCallback.idl @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 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 Ril + * @{ + * + * @brief Defines Ril-related APIs. + * + * The radio interface layer (RIL) module provides APIs and callbacks for upper-layer telephony services, + * including call, SMS, MMS, network search, and SIM card services. + * + * @since 4.1 + * @version 1.3 + */ + +/** + * @file IRilCallback.idl + * + * @brief Declares callback APIs of the RIL module. + * + * @since 4.1 + * @version 1.3 + */ + +/** + * @brief Defines the path for the package of the RIL module APIs. + * + * @since 4.1 + * @version 1.3 + */ +package ohos.hdi.ril.v1_3; + +import ohos.hdi.ril.v1_2.IRilCallback; +import ohos.hdi.ril.v1_3.Types; + +/** + * @brief Declares callback APIs of the RIL module. + * + * These APIs provide the callback functions for making calls, sending SMS and MMS messages, + * activating SIM cards, and accessing the Internet. The caller needs to implement these callbacks. + * + * @since 4.1 + * @version 1.3 + */ +[callback] interface IRilCallback extends ohos.hdi.ril.v1_2.IRilCallback { + /** + * @brief Callback for the response of querying the international mobile equipment identity software version (IMEISV). + * + * @param responseInfo Common response information, such as the card slot ID and request sequence ID. + * For details, see {@link RilRadioResponseInfo}. + * @param imeiSv IMEISV of the device. + * + * @since 5.0 + * @version 1.0 + */ + GetImeiSvResponse([in] struct RilRadioResponseInfo responseInfo, [in] String imeiSv); +} +/** @} */ diff --git a/ril/v1_3/Types.idl b/ril/v1_3/Types.idl new file mode 100644 index 00000000..2f8a5e2b --- /dev/null +++ b/ril/v1_3/Types.idl @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 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 Ril + * + * @brief Defines Ril-related APIs. + * + * The radio interface layer (RIL) module provides APIs and callbacks for upper-layer telephony services, + * including call, SMS, MMS, network search, and SIM card services. + * + * @since 4.1 + * @version 1.3 + */ + +package ohos.hdi.ril.v1_3; + +import ohos.hdi.ril.v1_1.Types; +import ohos.hdi.ril.v1_2.Types; + -- Gitee From c4b6a40f5bfcf3a0e5d97fddc3f3069364afcf02 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 03:54:08 +0000 Subject: [PATCH 165/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 2bf87f1a..3cfc6a28 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -40,36 +40,40 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { /** * Professional mode, which dedicated to professional photo scene * Abandoned, use the new operationMode below + * * @since 4.1 - * @version 1.3 + * @version 1.1 */ PROFESSIONAL_V1_3 = PROFESSIONAL, /** * Professional mode, which dedicated to capture code + * * @since 5.0 - * @version 1.3 + * @version 1.0 */ PROFESSIONAL_PHOTO = 11, /** * Professional mode, which dedicated to video code + * * @since 5.0 - * @version 1.3 - */ + * @version 1.0 PROFESSIONAL_VIDEO = 12, /** * Slow motion mode, which dedicated to video recording slow motion + * * @since 5.0 - * @version 1.3 + * @version 1.0 */ HIGH_FRAME_RATE = 13, /** * High resolution photo mode, which dedicated to capture recording high pixel + * * @since 5.0 - * @version 1.3 + * @version 1.0 */ HIGH_RESOLUTION_PHOTO = 14, -- Gitee From efe37a4d4d8966d20b3663595a1295c9b5aec568 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 06:16:25 +0000 Subject: [PATCH 166/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 1 + 1 file changed, 1 insertion(+) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 3cfc6a28..43b02df1 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -59,6 +59,7 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { * * @since 5.0 * @version 1.0 + */ PROFESSIONAL_VIDEO = 12, /** -- Gitee From 3ea63b9a7a52c39d4ea039101d5499523602ab80 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 08:57:55 +0000 Subject: [PATCH 167/210] update camera/v1_3/Types.idl. Signed-off-by: luzhiye --- camera/v1_3/Types.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index 43b02df1..bb87df60 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -66,7 +66,7 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { * Slow motion mode, which dedicated to video recording slow motion * * @since 5.0 - * @version 1.0 + * @version 1.0 */ HIGH_FRAME_RATE = 13, -- Gitee From 0f3e80c861a0bc16d81d3842e46dc59dccd21711 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 13:44:58 +0000 Subject: [PATCH 168/210] update camera/metadata/include/camera_device_ability_items.h. Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 5b3a4393..9b579458 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -289,11 +289,11 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, - OHOS_ABILITY_CAPTURE_EXPECT_TIME, OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, + OHOS_ABILITY_CAPTURE_EXPECT_TIME, OHOS_CAMERA_EFFECT_END, // camera secure related -- Gitee From 4623b31d8de356127f21bd0dd6d7cef7246cf897 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 13:45:53 +0000 Subject: [PATCH 169/210] update camera/metadata/include/camera_metadata_item_info.h. Signed-off-by: luzhiye --- camera/metadata/include/camera_metadata_item_info.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index c4c81781..60bd2419 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -338,13 +338,13 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"motionDetectionSupportValue", META_TYPE_BYTE, 1}, [OHOS_CONTROL_MOTION_DETECTION - OHOS_CAMERA_EFFECT_START] = {"motionDetectionControlValue", META_TYPE_BYTE, 1}, - [OHOS_ABILITY_CAPTURE_EXPECT_TIME - - OHOS_CAMERA_EFFECT_START] = {"captureExpectTime", META_TYPE_UINT32, -1}, [OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED - OHOS_CAMERA_EFFECT_START] = {"exposureHintSupported", META_TYPE_BYTE, 1}, [OHOS_CONTROL_EXPOSURE_HINT_MODE - OHOS_CAMERA_EFFECT_START] = {"exposureHintMode", META_TYPE_BYTE, 1}, [OHOS_STATUS_ALGO_MEAN_Y - OHOS_CAMERA_EFFECT_START] = {"algoMeanY", META_TYPE_UINT32, 1}, [OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID - OHOS_CAMERA_EFFECT_START] = {"previewPhysicalCameraId", META_TYPE_BYTE, 1}, + [OHOS_ABILITY_CAPTURE_EXPECT_TIME - + OHOS_CAMERA_EFFECT_START] = {"captureExpectTime", META_TYPE_UINT32, -1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { -- Gitee From 9e49e9e8b89be770bea119e1e8659662e188aa50 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Mon, 8 Apr 2024 13:46:21 +0000 Subject: [PATCH 170/210] update camera/metadata/src/camera_metadata_info.cpp. Signed-off-by: luzhiye --- camera/metadata/src/camera_metadata_info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 1f18eb3f..8d186ccf 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -190,11 +190,11 @@ const std::vector g_metadataTags = { OHOS_STATUS_SLOW_MOTION_DETECTION, OHOS_ABILITY_MOTION_DETECTION_SUPPORT, OHOS_CONTROL_MOTION_DETECTION, - OHOS_ABILITY_CAPTURE_EXPECT_TIME, OHOS_ABILITY_EXPOSURE_HINT_SUPPORTED, OHOS_CONTROL_EXPOSURE_HINT_MODE, OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, + OHOS_ABILITY_CAPTURE_EXPECT_TIME, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From 663563718c6c3f99a679aa9dacbed43aea7998fc Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Mon, 8 Apr 2024 22:13:33 +0800 Subject: [PATCH 171/210] hdi interface mdf Signed-off-by: lvqiang214 --- intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl | 4 ++-- intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl index f1cf05c3..1d562efc 100644 --- a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl +++ b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl @@ -45,7 +45,7 @@ import ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineTypes; /** * @brief Enumerates intelligent voice engine content types. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ enum ContentType : ohos.hdi.intelligent_voice.engine.v1_0.ContentType { @@ -56,7 +56,7 @@ enum ContentType : ohos.hdi.intelligent_voice.engine.v1_0.ContentType { /** * @brief Enumerates intelligent voice engine message types. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ enum IntellVoiceEngineMessageType : ohos.hdi.intelligent_voice.engine.v1_0.IntellVoiceEngineMessageType { diff --git a/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl index 07a7d77e..760b5c90 100644 --- a/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl +++ b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl @@ -45,7 +45,7 @@ import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; /** * @brief Enumerates intelligent voice trigger model types. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ enum IntellVoiceTriggerModelType : ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerModelType { -- Gitee From 59c20f5699ae255c863ece6ff2dd8c17ca7fcfbe Mon Sep 17 00:00:00 2001 From: Tianshi Liu Date: Sun, 31 Mar 2024 15:10:07 +0800 Subject: [PATCH 172/210] update face auth fingerprint auth hdi to V2_0 Change-Id: Idd4bc3409673fe9b93ab29f045e1706378021962 Signed-off-by: Tianshi Liu --- face_auth/bundle.json | 33 +- face_auth/v2_0/BUILD.gn | 31 ++ face_auth/v2_0/FaceAuthTypes.idl | 267 ++++++++++++++++ face_auth/v2_0/IAllInOneExecutor.idl | 177 +++++++++++ face_auth/v2_0/IExecutorCallback.idl | 89 ++++++ face_auth/v2_0/IFaceAuthInterface.idl | 76 +++++ face_auth/v2_0/ISaCommandCallback.idl | 62 ++++ fingerprint_auth/bundle.json | 33 +- fingerprint_auth/v2_0/BUILD.gn | 27 ++ .../v2_0/FingerprintAuthTypes.idl | 289 ++++++++++++++++++ fingerprint_auth/v2_0/IAllInOneExecutor.idl | 179 +++++++++++ fingerprint_auth/v2_0/IExecutorCallback.idl | 89 ++++++ .../v2_0/IFingerprintAuthInterface.idl | 63 ++++ fingerprint_auth/v2_0/ISaCommandCallback.idl | 62 ++++ 14 files changed, 1419 insertions(+), 58 deletions(-) create mode 100644 face_auth/v2_0/BUILD.gn create mode 100644 face_auth/v2_0/FaceAuthTypes.idl create mode 100644 face_auth/v2_0/IAllInOneExecutor.idl create mode 100644 face_auth/v2_0/IExecutorCallback.idl create mode 100644 face_auth/v2_0/IFaceAuthInterface.idl create mode 100644 face_auth/v2_0/ISaCommandCallback.idl create mode 100644 fingerprint_auth/v2_0/BUILD.gn create mode 100644 fingerprint_auth/v2_0/FingerprintAuthTypes.idl create mode 100644 fingerprint_auth/v2_0/IAllInOneExecutor.idl create mode 100644 fingerprint_auth/v2_0/IExecutorCallback.idl create mode 100644 fingerprint_auth/v2_0/IFingerprintAuthInterface.idl create mode 100644 fingerprint_auth/v2_0/ISaCommandCallback.idl diff --git a/face_auth/bundle.json b/face_auth/bundle.json index 32636e0f..d4ea580d 100644 --- a/face_auth/bundle.json +++ b/face_auth/bundle.json @@ -28,14 +28,13 @@ }, "build": { "sub_component": [ - "//drivers/interface/face_auth/v1_0:face_auth_idl_target", - "//drivers/interface/face_auth/v1_1:face_auth_idl_target" + "//drivers/interface/face_auth/v2_0:face_auth_idl_target" ], "test": [ ], "inner_kits": [ { - "name": "//drivers/interface/face_auth/v1_0:libface_auth_proxy_1.0", + "name": "//drivers/interface/face_auth/v2_0:libface_auth_proxy_2.0", "header": { "header_files": [ ], @@ -43,7 +42,7 @@ } }, { - "name": "//drivers/interface/face_auth/v1_0:libface_auth_stub_1.0", + "name": "//drivers/interface/face_auth/v2_0:libface_auth_stub_2.0", "header": { "header_files": [ ], @@ -51,31 +50,7 @@ } }, { - "name": "//drivers/interface/face_auth/v1_0:face_auth_idl_headers", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/face_auth" - } - }, - { - "name": "//drivers/interface/face_auth/v1_1:libface_auth_proxy_1.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/face_auth" - } - }, - { - "name": "//drivers/interface/face_auth/v1_1:libface_auth_stub_1.1", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/face_auth" - } - }, - { - "name": "//drivers/interface/face_auth/v1_1:face_auth_idl_headers", + "name": "//drivers/interface/face_auth/v2_0:face_auth_idl_headers", "header": { "header_files": [ ], diff --git a/face_auth/v2_0/BUILD.gn b/face_auth/v2_0/BUILD.gn new file mode 100644 index 00000000..01500c37 --- /dev/null +++ b/face_auth/v2_0/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("face_auth") { + module_name = "drivers_peripheral_face_auth" + sources = [ + "FaceAuthTypes.idl", + "IAllInOneExecutor.idl", + "IExecutorCallback.idl", + "IFaceAuthInterface.idl", + "ISaCommandCallback.idl", + ] + sequenceable_ext_deps = [ + "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", + "graphic_surface:surface", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_face_auth" +} diff --git a/face_auth/v2_0/FaceAuthTypes.idl b/face_auth/v2_0/FaceAuthTypes.idl new file mode 100644 index 00000000..8732aea0 --- /dev/null +++ b/face_auth/v2_0/FaceAuthTypes.idl @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2024 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 HdfFaceAuth + * @{ + * + * @brief Provides APIs for the face auth driver. + * + * The face auth driver provides a unified interface for the face auth service to access the face auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file FaceAuthTypes.idl + * + * @brief Defines the enumeration and data structure of the face auth driver, including AuthType, ExecutorRole, ExecutorSecureLevel, + * DriverCommandId, FaceTipsCode, ExecutorInfo, and TemplateInfo. + * + * @since 3.2 + */ + +package ohos.hdi.face_auth.v2_0; + +/** + * @brief Enumerates credential types for authentication. + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + /**< Indicates that the authentication type is PIN. */ + PIN = 1, + /**< Indicates that the authentication type is face. */ + FACE = 2, + /**< Indicates that the authentication type is fingerprint. */ + FINGERPRINT = 4, +}; + +/** + * @brief Enumerates executor roles. + * + * @since 3.2 + * @version 2.0 + */ +enum ExecutorRole : int { + /**< Indicates that the executor role is scheduler. */ + SCHEDULER = 0, + /**< Indicates that the executor role is collector. */ + COLLECTOR = 1, + /**< Indicates that the executor role is verifier. */ + VERIFIER = 2, + /**< Indicates that the executor role is the combination of collector and verifier. */ + ALL_IN_ONE = 3, +}; + +/** + * @brief Enumerates executor secure levels. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /**< Indicates that the executor secure level is ESL0. */ + ESL0 = 0, + /**< Indicates that the executor secure level is ESL1. */ + ESL1 = 1, + /**< Indicates that the executor secure level is ESL2. */ + ESL2 = 2, + /**< Indicates that the executor secure level is ESL3. */ + ESL3 = 3, +}; + +/** + * @brief Enumerates authentication capability levels. + * + * @since 5.0 + * @version 1.0 + */ +enum AuthenticationCapabilityLevel : int { + /**< Indicates that the authentication capability level is ACL0. */ + ATL0 = 0, + /**< Indicates that the authentication capability level is ACL1. */ + ATL1 = 10000, + /**< Indicates that the authentication capability level is ACL2. */ + ATL2 = 20000, + /**< Indicates that the authentication capability level is ACL3. */ + ATL3 = 30000, + /**< Indicates that the authentication capability level is ACL4. */ + ATL4 = 40000, +}; + +/** + * @brief Indicates executor information. + * + * @since 3.2 + * @version 2.0 + */ +struct ExecutorInfo { + /**< Indicates the sensor ID, which must be unique within the driver. */ + unsigned short sensorId; + /**< Indicates the executor matcher. */ + unsigned int executorMatcher; + /**< Indicates the max acl of template. See @{AuthenticationCapabilityLevel}. */ + unsigned int maxTemplateAcl; + /**< Indicates the executor role. See @{ExecutorRole}. */ + int executorRole; + /**< Indicates the auth type. See @{AuthType}. */ + int authType; + /**< Indicates the executor secure level. See @{ExecutorSecureLevel}. */ + int esl; + /**< Indicates the public key of the executor. */ + unsigned char[] publicKey; + /**< Indicates extra information. */ + unsigned char[] extraInfo; +}; + +/** + * @brief Enumerates prompt codes. + * + * @since 3.2 + * @version 1.0 + */ +enum FaceTipsCode : int { + /**< Indicates that the obtained facial image is too bright due to high illumination. */ + FACE_AUTH_TIP_TOO_BRIGHT = 1, + /**< Indicates that the obtained facial image is too dark due to low illumination. */ + FACE_AUTH_TIP_TOO_DARK = 2, + /**< Indicates that the face is too close to the device. */ + FACE_AUTH_TIP_TOO_CLOSE = 3, + /**< Indicates that the face is too far away from the device. */ + FACE_AUTH_TIP_TOO_FAR = 4, + /**< Indicates that the device is too high, and that only the upper part of the face is captured. */ + FACE_AUTH_TIP_TOO_HIGH = 5, + /**< Indicates that the device is too low, and that only the lower part of the face is captured. */ + FACE_AUTH_TIP_TOO_LOW = 6, + /**< Indicates that the device is deviated to the right, and that only the right part of the face is captured. */ + FACE_AUTH_TIP_TOO_RIGHT = 7, + /**< Indicates that the device is deviated to the left, and that only the left part of the face is captured. */ + FACE_AUTH_TIP_TOO_LEFT = 8, + /**< Indicates that the face moves too much during facial information collection. */ + FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, + /**< Indicates that the user is not gazing at the device. */ + FACE_AUTH_TIP_POOR_GAZE = 10, + /**< Indicates that no face is detected. */ + FACE_AUTH_TIP_NOT_DETECTED = 11, + /**< The vendor may add a custom face auth tip after this. */ + VENDOR_FACE_AUTH_TIP_BEGIN = 10000 +}; + +/** + * @brief Enumerates get Property types. + * + * @since 4.0 + * @version 1.1 + */ +enum GetPropertyType : int { + /**< Indicates that the property to get is auth sub type. */ + AUTH_SUB_TYPE = 1, + /**< Indicates that the property to get is lockout duration. */ + LOCKOUT_DURATION = 2, + /**< Indicates that the property to get is remain attempts. */ + REMAIN_ATTEMPTS = 3, + /**< Indicates that the property to get is enroll progress. */ + ENROLL_PROGRESS = 4, + /**< Indicates that the property to get is sensor info. */ + SENSOR_INFO = 5 +}; + +/** + * @brief Indicates executor property. + * + * @since 4.0 + * @version 1.1 + */ +struct Property { + /**< Indicates auth sub type. */ + unsigned long authSubType; + /**< Indicates lockout duration. */ + int lockoutDuration; + /**< Indicates remain attempts. */ + int remainAttempts; + /**< Indicates enroll progress. */ + String enrollmentProgress; + /**< Indicates sensor info. */ + String sensorInfo; +}; + +/** + * @brief Enumerates sa command ids. + * + * @since 4.0 + * @version 1.1 + */ +enum SaCommandId : int { + /**< Indicates that the sa command is begin brightness increase. */ + BEGIN_SCREEN_BRIGHTNESS_INCREASE = 1, + /**< Indicates that the sa command is end brightness increase. */ + END_SCREEN_BRIGHTNESS_INCREASE = 2, +}; + +/** + * @brief Indicates sa command parameter none. + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamNone { +}; + +/** + * @brief Indicates sa command parameter. + * + * @since 4.0 + * @version 1.1 + */ +union SaCommandParam { + /**< Indicates that sa command parameter is none. See {@link SaCommandParamNone}. */ + struct SaCommandParamNone none; +}; + +/** + * @brief Indicates sa command. + * + * @since 4.0 + * @version 2.0 + */ +struct SaCommand { + /**< Indicates sa command id. See {@link SaCommandId}. */ + int id; + /**< Indicates sa command parameter. See {@link SaCommandParam}. */ + union SaCommandParam param; +}; + +/** + * @brief Enumerates driver command IDs. + * + * @since 5.0 + * @version 1.0 + */ +enum DriverCommandId : int { + /**< Indicates the command ID for locking the template. */ + LOCK_TEMPLATE = 1, + /**< Indicates the command ID for unlocking the template. */ + UNLOCK_TEMPLATE = 2, + /**< Indicates the command ID for init algorithm. */ + INIT_ALGORITHM = 3, + /**< The vendor may add a custom command ID after this. */ + VENDOR_COMMAND_BEGIN = 10000 +}; +/** @} */ \ No newline at end of file diff --git a/face_auth/v2_0/IAllInOneExecutor.idl b/face_auth/v2_0/IAllInOneExecutor.idl new file mode 100644 index 00000000..598bba12 --- /dev/null +++ b/face_auth/v2_0/IAllInOneExecutor.idl @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2024 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 HdfFaceAuth + * @{ + * + * @brief Provides APIs for the face auth driver. + * + * The face auth driver provides a unified interface for the face auth service to access the face auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + */ + +/** + * @file IAllInOneExecutor.idl + * + * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + */ + +package ohos.hdi.face_auth.v2_0; + +import ohos.hdi.face_auth.v2_0.FaceAuthTypes; +import ohos.hdi.face_auth.v2_0.IExecutorCallback; +import ohos.hdi.face_auth.v2_0.ISaCommandCallback; + +/** + * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ +interface IAllInOneExecutor { + /** + * @brief Gets executor information. + * + * @param executorInfo Indicates executor information. See {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief Sends parameters to the driver when executor registration is finished. + * + * @param templateIdList Indicates the templates previously registered to the user auth framework. + * @param frameworkPublicKey Indicates the framework public key. + * @param extraInfo Indicates the extra information that is sent to the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief Cancels the enrollment, authentication, or identification operation. + * + * @param scheduleId Indicates the schedule ID of the operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Enrolls templates. + * + * @param scheduleId Indicates the schedule ID of enrollment. + * @param extraInfo Indicates the extra information of enrollment. + * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Authenticates templates. + * + * @param scheduleId Indicates the schedule ID of authentication. + * @param templateIdList Indicates the templates to authenticate. + * @param extraInfo Indicates the extra information of authentication. + * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Identifies templates. + * + * @param scheduleId Indicates the schedule ID of identification. + * @param extraInfo Indicates the extra information of identification. + * @param callbackObj Indicates the callback object of identification. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Deletes templates. + * + * @param templateIdList Indicates the templates to delete. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Delete([in] unsigned long[] templateIdList); + /** + * @brief Sends a command to the driver. + * + * @param commandId Indicates the command ID. See {@link DriverCommandId}. + * @param extraInfo Indicates the extra information of the command. + * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Get property. + * + * @param templateIdList Indicates the templates to process. + * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}. + * @param property Indicates property. See {@link Property}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + GetProperty([in] unsigned long[] templateIdList, [in] int[] propertyTypes, [out] struct Property property); + /** + * @brief Set cached templates. + * + * @param templateIdList Indicates the templates to cache. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SetCachedTemplates([in] unsigned long[] templateIdList); + /** + * @brief Register sa command callback. + * + * @param callbackObj Indicates the sa command callback. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + RegisterSaCommandCallback([in] ISaCommandCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/face_auth/v2_0/IExecutorCallback.idl b/face_auth/v2_0/IExecutorCallback.idl new file mode 100644 index 00000000..c1a97c7b --- /dev/null +++ b/face_auth/v2_0/IExecutorCallback.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2024 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 HdfFaceAuth + * @{ + * + * @brief Provides APIs for the face auth driver. + * + * The face auth driver provides a unified interface for the face auth service to access the face auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief Defines the callback for an async API, which can be used to report operation results or information + * of the async API. + * + * @since 3.2 + */ + +package ohos.hdi.face_auth.v2_0; + +/** + * @brief Defines the callback for an async API, which can be used to report operation results or information + * of the async API. + * + * @since 3.2 + * @version 2.0 + */ +[callback] interface IExecutorCallback { + /** + * @brief Defines the function for reporting operation results. + * + * @param result Indicates the result code. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + OnResult([in] int result, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for reporting information in process. + * + * @param tip Indicates tip code. See {@link FaceTipsCode}. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + OnTip([in] int tip, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for reporting message. + * + * @param destRole is the role of destination. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnMessage([in] int destRole, [in] unsigned char[] msg); +} +/** @} */ \ No newline at end of file diff --git a/face_auth/v2_0/IFaceAuthInterface.idl b/face_auth/v2_0/IFaceAuthInterface.idl new file mode 100644 index 00000000..aed00dc9 --- /dev/null +++ b/face_auth/v2_0/IFaceAuthInterface.idl @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 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 HdfFaceAuth + * @{ + * + * @brief Provides APIs for the face auth driver. + * + * The face auth driver provides a unified interface for the face auth service to access the face auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file IFaceAuthInterface.idl + * + * @brief Defines the API for getting the executor list of the face auth driver. + * + * @since 3.2 + */ + +package ohos.hdi.face_auth.v2_0; + +import ohos.hdi.face_auth.v2_0.IAllInOneExecutor; +sequenceable ohos.hdi.camera.v1_0.BufferProducerSequenceable; + +/** + * @brief Defines the API for getting the executor list of the face auth driver. + * + * @since 3.2 + * @version 2.0 + */ +interface IFaceAuthInterface { + /** + * @brief Obtains the executor list of the driver. + * + * @param allInOneExecutors Indicates the all-in-one executor list of the driver. + * See {@link IAllInOneExecutor}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetExecutorList([out] IAllInOneExecutor[] allInOneExecutors); + /** + * @brief Set buffer producer. + * + * @param bufferProducer Indicates bufferProducer set to executor. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + SetBufferProducer([in] BufferProducerSequenceable bufferProducer); +} +/** @} */ \ No newline at end of file diff --git a/face_auth/v2_0/ISaCommandCallback.idl b/face_auth/v2_0/ISaCommandCallback.idl new file mode 100644 index 00000000..c5e615d5 --- /dev/null +++ b/face_auth/v2_0/ISaCommandCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 HdfFaceAuth + * @{ + * + * @brief Provides APIs for the face auth driver. + * + * The face auth driver provides a unified interface for the face auth service to access the face auth driver. + * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the face auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 4.0 + */ + +/** + * @file ISaCommandCallback.idl + * + * @brief Defines the callback for an async API, which can be used to send command to SA. + * + * @since 4.0 + */ + +package ohos.hdi.face_auth.v2_0; + +import ohos.hdi.face_auth.v2_0.FaceAuthTypes; + +/** + * @brief Defines the callback for an async API, which can be used to send command to SA. + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface ISaCommandCallback { + /** + * @brief Defines the function for sa commands in process. + * + * @param commands Indicates sa commands. See {@link SaCommand}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 4.0 + * @version 1.1 + */ + OnSaCommands([in] struct SaCommand[] commands); +} +/** @} */ \ No newline at end of file diff --git a/fingerprint_auth/bundle.json b/fingerprint_auth/bundle.json index c490401c..b8c39129 100644 --- a/fingerprint_auth/bundle.json +++ b/fingerprint_auth/bundle.json @@ -26,14 +26,13 @@ }, "build": { "sub_component": [ - "//drivers/interface/fingerprint_auth/v1_0:fingerprint_auth_idl_target", - "//drivers/interface/fingerprint_auth/v1_2:fingerprint_auth_idl_target" + "//drivers/interface/fingerprint_auth/v2_0:fingerprint_auth_idl_target" ], "test": [ ], "inner_kits": [ { - "name": "//drivers/interface/fingerprint_auth/v1_0:libfingerprint_auth_proxy_1.0", + "name": "//drivers/interface/fingerprint_auth/v2_0:libfingerprint_auth_proxy_2.0", "header": { "header_files": [ ], @@ -41,7 +40,7 @@ } }, { - "name": "//drivers/interface/fingerprint_auth/v1_0:libfingerprint_auth_stub_1.0", + "name": "//drivers/interface/fingerprint_auth/v2_0:libfingerprint_auth_stub_2.0", "header": { "header_files": [ ], @@ -49,31 +48,7 @@ } }, { - "name": "//drivers/interface/fingerprint_auth/v1_0:fingerprint_auth_idl_headers_1.0", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/fingerprint_auth" - } - }, - { - "name": "//drivers/interface/fingerprint_auth/v1_2:libfingerprint_auth_proxy_1.2", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/fingerprint_auth" - } - }, - { - "name": "//drivers/interface/fingerprint_auth/v1_2:libfingerprint_auth_stub_1.2", - "header": { - "header_files": [ - ], - "header_base": "//drivers/interface/fingerprint_auth" - } - }, - { - "name": "//drivers/interface/fingerprint_auth/v1_2:fingerprint_auth_idl_headers_1.2", + "name": "//drivers/interface/fingerprint_auth/v2_0:fingerprint_auth_idl_headers", "header": { "header_files": [ ], diff --git a/fingerprint_auth/v2_0/BUILD.gn b/fingerprint_auth/v2_0/BUILD.gn new file mode 100644 index 00000000..c722efe9 --- /dev/null +++ b/fingerprint_auth/v2_0/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 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/hdf_core/adapter/uhdf2/hdi.gni") +hdi("fingerprint_auth") { + module_name = "drivers_peripheral_fingerprint_auth" + sources = [ + "FingerprintAuthTypes.idl", + "IAllInOneExecutor.idl", + "IExecutorCallback.idl", + "IFingerprintAuthInterface.idl", + "ISaCommandCallback.idl", + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_fingerprint_auth" +} diff --git a/fingerprint_auth/v2_0/FingerprintAuthTypes.idl b/fingerprint_auth/v2_0/FingerprintAuthTypes.idl new file mode 100644 index 00000000..0f0f7479 --- /dev/null +++ b/fingerprint_auth/v2_0/FingerprintAuthTypes.idl @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file FingerprintAuthTypes.idl + * + * @brief Defines the enumeration and data structure of the fingerprint auth driver, including AuthType, ExecutorRole, ExecutorSecureLevel, + * DriverCommandId, FaceTipsCode, ExecutorInfo, and TemplateInfo. + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v2_0; + +/** + * @brief Enumerates credential types for authentication. + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : int { + /**< Indicates that the authentication type is PIN. */ + PIN = 1, + /**< Indicates that the authentication type is face. */ + FACE = 2, + /**< Indicates that the authentication type is fingerprint. */ + FINGERPRINT = 4, +}; + +/** + * @brief Enumerates executor roles. + * + * @since 3.2 + * @version 2.0 + */ +enum ExecutorRole : int { + /**< Indicates that the executor role is scheduler. */ + SCHEDULER = 0, + /**< Indicates that the executor role is collector. */ + COLLECTOR = 1, + /**< Indicates that the executor role is verifier. */ + VERIFIER = 2, + /**< Indicates that the executor role is the combination of collector and verifier. */ + ALL_IN_ONE = 3, +}; + +/** + * @brief Enumerates executor secure levels. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : int { + /**< Indicates that the executor secure level is ESL0. */ + ESL0 = 0, + /**< Indicates that the executor secure level is ESL1. */ + ESL1 = 1, + /**< Indicates that the executor secure level is ESL2. */ + ESL2 = 2, + /**< Indicates that the executor secure level is ESL3. */ + ESL3 = 3, +}; + +/** + * @brief Enumerates authentication capability levels. + * + * @since 5.0 + * @version 1.0 + */ +enum AuthenticationCapabilityLevel : int { + /**< Indicates that the authentication capability level is ACL0. */ + ATL0 = 0, + /**< Indicates that the authentication capability level is ACL1. */ + ATL1 = 10000, + /**< Indicates that the authentication capability level is ACL2. */ + ATL2 = 20000, + /**< Indicates that the authentication capability level is ACL3. */ + ATL3 = 30000, + /**< Indicates that the authentication capability level is ACL4. */ + ATL4 = 40000, +}; + +/** + * @brief Indicates executor information. + * + * @since 3.2 + * @version 2.0 + */ +struct ExecutorInfo { + /**< Indicates the sensor ID, which must be unique within the driver. */ + unsigned short sensorId; + /**< Indicates the executor matcher. */ + unsigned int executorMatcher; + /**< Indicates the max acl of template. See @{AuthenticationCapabilityLevel}. */ + unsigned int maxTemplateAcl; + /**< Indicates the executor role. See @{ExecutorRole}. */ + int executorRole; + /**< Indicates the auth type. See @{AuthType}. */ + int authType; + /**< Indicates the executor secure level. See @{ExecutorSecureLevel}. */ + int esl; + /**< Indicates the public key of the executor. */ + unsigned char[] publicKey; + /**< Indicates extra information. */ + unsigned char[] extraInfo; +}; + +/** + * @brief Enumerates prompt codes. + * + * @since 3.2 + * @version 1.2 + */ +enum FingerprintTipsCode : int { + /**< Indicates that the image acquired is good. */ + FINGERPRINT_AUTH_TIP_GOOD = 0, + /**< Indicates that the fingerprint image is too noisy due to suspected or detected dirt on sensor. */ + FINGERPRINT_AUTH_TIP_DIRTY = 1, + /**< Indicates that only a partial fingerprint image is detected. */ + FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2, + /**< Indicates that only a partial fingerprint image is detected. */ + FINGERPRINT_AUTH_TIP_PARTIAL = 3, + /**< Indicates that the fingerprint image is incomplete due to quick motion. */ + FINGERPRINT_AUTH_TIP_TOO_FAST = 4, + /**< Indicates that the fingerprint image is unreadable due to lack of motion. */ + FINGERPRINT_AUTH_TIP_TOO_SLOW = 5, + /**< Indicates that the finger is down. */ + FINGERPRINT_AUTH_TIP_FINGER_DOWN = 6, + /**< Indicates that the finger is up. */ + FINGERPRINT_AUTH_TIP_FINGER_UP = 7, + /**< Indicates that a single auth result. The authentication result is carried in a json + character string: {"authResult":1,"authRemainAttempts":3,"lockoutDuration":0} */ + FINGERPRINT_AUTH_TIP_SINGLE_AUTH_RESULT = 8, + /**< The vendor may add a custom fingerprint auth tip after this. */ + VENDOR_FINGERPRINT_AUTH_TIP_BEGIN = 10000 +}; + +/** + * @brief Enumerates get Property types. + * + * @since 4.0 + * @version 1.1 + */ +enum GetPropertyType : int { + /**< Indicates that the property to get is auth sub type. */ + AUTH_SUB_TYPE = 1, + /**< Indicates that the property to get is lockout duration. */ + LOCKOUT_DURATION = 2, + /**< Indicates that the property to get is remain attempts. */ + REMAIN_ATTEMPTS = 3, + /**< Indicates that the property to get is enroll progress. */ + ENROLL_PROGRESS = 4, + /**< Indicates that the property to get is sensor info. */ + SENSOR_INFO = 5 +}; + +/** + * @brief Indicates executor property. + * + * @since 4.0 + * @version 1.1 + */ +struct Property { + /**< Indicates auth sub type. */ + unsigned long authSubType; + /**< Indicates lockout duration. */ + int lockoutDuration; + /**< Indicates remain attempts. */ + int remainAttempts; + /**< Indicates enroll progress. */ + String enrollmentProgress; + /**< Indicates sensor info. */ + String sensorInfo; +}; + +/** + * @brief Enumerates sa command ids. + * + * @since 4.0 + * @version 1.1 + */ +enum SaCommandId : int { + /**< Indicates that the sa command is enable sensor illumination. */ + ENABLE_SENSOR_ILLUMINATION = 1, + /**< Indicates that the sa command is disable sensor illumination. */ + DISABLE_SENSOR_ILLUMINATION = 2, + /**< Indicates that the sa command is turn on sensor illumination. */ + TURN_ON_SENSOR_ILLUMINATION = 3, + /**< Indicates that the sa command is turn off sensor illumination. */ + TURN_OFF_SENSOR_ILLUMINATION = 4, +}; + +/** + * @brief Sa command parameter for enable sensor illumination. + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamEnableSensorIllumination { + /**< Indicates that highlight circle center x-coordinate per thousand to screen width. */ + unsigned int centerX; + /**< Indicates that highlight circle center y-coordinate per thousand to screen height. */ + unsigned int centerY; + /**< Indicates that highlight circle radius, in px. */ + unsigned int radius; + /**< Indicates that highlight brightness. */ + unsigned int brightness; + /**< Indicates that highlight color. */ + unsigned int color; +}; + +/** + * @brief Indicates sa command parameter none. + * + * @since 4.0 + * @version 1.1 + */ +struct SaCommandParamNone { +}; + +/** + * @brief Indicates sa command parameter. + * + * @since 4.0 + * @version 1.1 + */ +union SaCommandParam { + /**< Indicates that sa command parameter is none. See {@link SaCommandParamNone}. */ + struct SaCommandParamNone none; + /**< Indicates that sa command parameter is enable sensor illumination. See {@link SaCommandParamEnableSensorIllumination}. */ + struct SaCommandParamEnableSensorIllumination enableSensorIllumination; +}; + +/** + * @brief Indicates sa command. + * + * @since 4.0 + * @version 2.0 + */ +struct SaCommand { + /**< Indicates sa command id. See {@link SaCommandId}. */ + int id; + /**< Indicates sa command parameter. See {@link SaCommandParam}. */ + union SaCommandParam param; +}; + +/** + * @brief Enumerates driver command IDs. + * + * @since 5.0 + * @version 1.0 + */ +enum DriverCommandId : int { + /**< Indicates the command ID for locking the template. */ + LOCK_TEMPLATE = 1, + /**< Indicates the command ID for unlocking the template. */ + UNLOCK_TEMPLATE = 2, + /**< Indicates the command ID for init algorithm. */ + INIT_ALGORITHM = 3, + /**< The vendor may add a custom command ID after this. */ + VENDOR_COMMAND_BEGIN = 10000 +}; +/** @} */ \ No newline at end of file diff --git a/fingerprint_auth/v2_0/IAllInOneExecutor.idl b/fingerprint_auth/v2_0/IAllInOneExecutor.idl new file mode 100644 index 00000000..96b1fe76 --- /dev/null +++ b/fingerprint_auth/v2_0/IAllInOneExecutor.idl @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + */ + +/** + * @file IAllInOneExecutor.idl + * + * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + */ + +package ohos.hdi.fingerprint_auth.v2_0; + +import ohos.hdi.fingerprint_auth.v2_0.FingerprintAuthTypes; +import ohos.hdi.fingerprint_auth.v2_0.IExecutorCallback; +import ohos.hdi.fingerprint_auth.v2_0.ISaCommandCallback; + +/** + * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 5.0 + * @version 1.0 + */ +interface IAllInOneExecutor { + /** + * @brief Gets executor information. + * + * @param executorInfo Indicates executor information. See {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + GetExecutorInfo([out] struct ExecutorInfo executorInfo); + /** + * @brief Sends parameters to the driver when executor registration is finished. + * + * @param templateIdList Indicates the templates previously registered to the user auth framework. + * @param frameworkPublicKey Indicates the framework public key. + * @param extraInfo Indicates the extra information that is sent to the executors. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** + * @brief Cancels the enrollment, authentication, or identification operation. + * + * @param scheduleId Indicates the schedule ID of the operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send message. + * + * @param scheduleId Indicates the schedule ID of the message. + * @param srcRole is the role of source. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg); + /** + * @brief Enrolls templates. + * + * @param scheduleId Indicates the schedule ID of enrollment. + * @param extraInfo Indicates the extra information of enrollment. + * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Authenticates templates. + * + * @param scheduleId Indicates the schedule ID of authentication. + * @param templateIdList Indicates the templates to authenticate. + * @param endAfterFirstFail Indicates end authentication after the first authentication failure. + * @param extraInfo Indicates the extra information of authentication. + * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] boolean endAfterFirstFail, + [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Identifies templates. + * + * @param scheduleId Indicates the schedule ID of identification. + * @param extraInfo Indicates the extra information of identification. + * @param callbackObj Indicates the callback object of identification. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Identify([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Deletes templates. + * + * @param templateIdList Indicates the templates to delete. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + Delete([in] unsigned long[] templateIdList); + /** + * @brief Sends a command to the driver. + * + * @param commandId Indicates the command ID. See {@link DriverCommandId}. + * @param extraInfo Indicates the extra information of the command. + * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Get property. + * + * @param templateIdList Indicates the templates to process. + * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}. + * @param property Indicates property. See {@link Property}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + GetProperty([in] unsigned long[] templateIdList, [in] int[] propertyTypes, [out] struct Property property); + /** + * @brief Set cached templates. + * + * @param templateIdList Indicates the templates to cache. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + SetCachedTemplates([in] unsigned long[] templateIdList); + /** + * @brief Register sa command callback. + * + * @param callbackObj Indicates the sa command callback. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + */ + RegisterSaCommandCallback([in] ISaCommandCallback callbackObj); +} +/** @} */ \ No newline at end of file diff --git a/fingerprint_auth/v2_0/IExecutorCallback.idl b/fingerprint_auth/v2_0/IExecutorCallback.idl new file mode 100644 index 00000000..0a024da7 --- /dev/null +++ b/fingerprint_auth/v2_0/IExecutorCallback.idl @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief Defines the callback for an async API, which can be used to report operation results or information + * of the async API. + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v2_0; + +/** + * @brief Defines the callback for an async API, which can be used to report operation results or information + * of the async API. + * + * @since 3.2 + * @version 2.0 + */ +[callback] interface IExecutorCallback { + /** + * @brief Defines the function for reporting operation results. + * + * @param result Indicates the result code. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 1.0 + */ + OnResult([in] int result, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for reporting information in process. + * + * @param tip Indicates tip code. See {@link FaceTipsCode}. + * @param extraInfo Indicates extra information to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + OnTip([in] int tip, [in] unsigned char[] extraInfo); + /** + * @brief Defines the function for reporting message. + * + * @param destRole is the role of destination. + * @param msg is the message content. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 5.0 + * @version 1.0 + */ + OnMessage([in] int destRole, [in] unsigned char[] msg); +} +/** @} */ \ No newline at end of file diff --git a/fingerprint_auth/v2_0/IFingerprintAuthInterface.idl b/fingerprint_auth/v2_0/IFingerprintAuthInterface.idl new file mode 100644 index 00000000..2b0fba02 --- /dev/null +++ b/fingerprint_auth/v2_0/IFingerprintAuthInterface.idl @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 3.2 + */ + +/** + * @file IFingerprintAuthInterface.idl + * + * @brief Defines the API for getting the executor list of the fingerprint auth driver. + * + * @since 3.2 + */ + +package ohos.hdi.fingerprint_auth.v2_0; + +import ohos.hdi.fingerprint_auth.v2_0.IAllInOneExecutor; + +/** + * @brief Defines the API for getting the executor list of the fingerprint auth driver. + * + * @since 3.2 + * @version 2.0 + */ +interface IFingerprintAuthInterface { + /** + * @brief Obtains the executor list of the driver. + * + * @param allInOneExecutors Indicates the all-in-one executor list of the driver. + * See {@link IAllInOneExecutor}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 3.2 + * @version 2.0 + */ + GetExecutorList([out] IAllInOneExecutor[] allInOneExecutors); +} +/** @} */ \ No newline at end of file diff --git a/fingerprint_auth/v2_0/ISaCommandCallback.idl b/fingerprint_auth/v2_0/ISaCommandCallback.idl new file mode 100644 index 00000000..2495d497 --- /dev/null +++ b/fingerprint_auth/v2_0/ISaCommandCallback.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 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 HdfFingerprintAuth + * @{ + * + * @brief Provides APIs for the fingerprint auth driver. + * + * The fingerprint auth driver provides a unified interface for the fingerprint auth service to access the fingerprint auth driver. + * After obtaining the fingerprint auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the fingerprint auth executors, the service can call related APIs to get executor information, get + * template information, and enroll, authenticate, and delete templates, etc. + * + * @since 4.0 + */ + +/** + * @file ISaCommandCallback.idl + * + * @brief Defines the callback for an async API, which can be used to send command to SA. + * + * @since 4.0 + */ + +package ohos.hdi.fingerprint_auth.v2_0; + +import ohos.hdi.fingerprint_auth.v2_0.FingerprintAuthTypes; + +/** + * @brief Defines the callback for an async API, which can be used to send command to SA. + * + * @since 4.0 + * @version 1.1 + */ +[callback] interface ISaCommandCallback { + /** + * @brief Defines the function for sa commands in process. + * + * @param commands Indicates sa commands. See {@link SaCommand}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a non-zero value if the operation fails. + * + * @since 4.0 + * @version 1.1 + */ + OnSaCommands([in] struct SaCommand[] commands); +} +/** @} */ \ No newline at end of file -- Gitee From e1ad775dabad41cbbf31a162a8139cff76bb3316 Mon Sep 17 00:00:00 2001 From: lvqiang214 Date: Tue, 9 Apr 2024 08:49:45 +0800 Subject: [PATCH 173/210] hdi interface mdf Signed-off-by: lvqiang214 --- intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl | 4 ++-- intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl | 4 ++-- intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl | 2 +- intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl b/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl index 40b69a14..743eb4d1 100644 --- a/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl +++ b/intelligent_voice/engine/v1_2/IIntellVoiceEngineAdapter.idl @@ -25,7 +25,7 @@ * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ @@ -48,7 +48,7 @@ import ohos.hdi.intelligent_voice.engine.v1_2.IntellVoiceEngineTypes; * * The operations include obtaining wakeup pcm and evaluating wakeup word. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ interface IIntellVoiceEngineAdapter extends ohos.hdi.intelligent_voice.engine.v1_0.IIntellVoiceEngineAdapter { diff --git a/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl b/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl index b763e655..fc3a0403 100644 --- a/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl +++ b/intelligent_voice/engine/v1_2/IIntellVoiceEngineManager.idl @@ -25,7 +25,7 @@ * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ @@ -51,7 +51,7 @@ import ohos.hdi.intelligent_voice.engine.v1_2.IIntellVoiceEngineAdapter; * * The operations include obtaining or sending intelligent voice engine information, creating or releasing an intelligent voice engine adapter. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ interface IIntellVoiceEngineManager extends ohos.hdi.intelligent_voice.engine.v1_1.IIntellVoiceEngineManager { diff --git a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl index 1d562efc..72687c94 100644 --- a/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl +++ b/intelligent_voice/engine/v1_2/IntellVoiceEngineTypes.idl @@ -25,7 +25,7 @@ * starting or stopping the intelligent voice engine, setting parameter to or getting parameter from the intelligent voice engine, * writing audio or reading files from the intelligent voice engine, subscribing callback to the intelligent voice engine. * - * @since 5.0 + * @since 4.0 * @version 1.2 */ diff --git a/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl index 760b5c90..07825d5d 100644 --- a/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl +++ b/intelligent_voice/trigger/v1_2/IntellVoiceTriggerTypes.idl @@ -25,7 +25,7 @@ * setting parameters to or getting parameters from intelligent voice trigger adapter. * * @since 4.0 - * @version 1.0 + * @version 1.2 */ /** @@ -35,7 +35,7 @@ * intelligent voice trigger adapter dsecriptor, intelligent voice trigger properties, intelligent voice trigger model, intelligent voice recognition event. * * @since 4.0 - * @version 1.0 + * @version 1.2 */ package ohos.hdi.intelligent_voice.trigger.v1_2; @@ -51,4 +51,4 @@ import ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerTypes; enum IntellVoiceTriggerModelType : ohos.hdi.intelligent_voice.trigger.v1_0.IntellVoiceTriggerModelType { VOICE_WAKEUP = 1, /**< Voice wakeup */ PROXIMAL_WAKEUP = 2, /**< Proximal wakeup */ -}; \ No newline at end of file +}; -- Gitee From 00be4dfabce6dc4fde20308b77c20815ccc2432c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AD=A6=E6=B5=B7?= Date: Tue, 9 Apr 2024 02:22:34 +0000 Subject: [PATCH 174/210] update audio/v3_0/AudioTypes.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 许学海 --- audio/v3_0/AudioTypes.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index 8b0edef1..4c5c8a92 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -87,6 +87,8 @@ enum AudioCategory { AUDIO_OFFLOAD = 5, /**< Offload */ AUDIO_MULTI_CHANNEL = 6, /**< Multi channel */ AUDIO_DP = 7, /**< Audio dp */ + AUDIO_MMAP_VOIP = 8, /**< Audio voip */ + AUDIO_IN_NAVIGATION = 9, /**< Audio navigation */ }; /** -- Gitee From 11db3c122ae73d018a17ea4986864196a833503b Mon Sep 17 00:00:00 2001 From: luzhiye Date: Tue, 9 Apr 2024 15:42:28 +0800 Subject: [PATCH 175/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E5=BE=AE=E8=B7=9D=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 1 + camera/metadata/include/camera_metadata_item_info.h | 2 ++ camera/metadata/src/camera_metadata_info.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index abfce612..2a17e589 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -297,6 +297,7 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_ABILITY_CAPTURE_EXPECT_TIME, + OHOS_CONTROL_FOCUS_DISTANCE, OHOS_CAMERA_EFFECT_END, // camera secure related diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 0c7ead8c..c4ecf2aa 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -351,6 +351,8 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"previewPhysicalCameraId", META_TYPE_BYTE, 1}, [OHOS_ABILITY_CAPTURE_EXPECT_TIME - OHOS_CAMERA_EFFECT_START] = {"captureExpectTime", META_TYPE_UINT32, -1}, + [OHOS_CONTROL_FOCUS_DISTANCE - + OHOS_CAMERA_EFFECT_START] = {"macroFocusDistance", META_TYPE_FLOAT, 1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index abda8645..4d04c0f0 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -198,6 +198,7 @@ const std::vector g_metadataTags = { OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_ABILITY_CAPTURE_EXPECT_TIME, + OHOS_CONTROL_FOCUS_DISTANCE, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From ab9bfb61192b70df9011e42772add760ed4a9abc Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Sat, 30 Mar 2024 16:23:44 +0800 Subject: [PATCH 176/210] fix: add trace Signed-off-by: fan-jingle --- .../display_command/display_cmd_responser.h | 102 ++++++++++++------ .../v1_0/hdi_impl/display_composer_hdi_impl.h | 2 + .../v1_1/hdi_impl/display_composer_hdi_impl.h | 6 ++ 3 files changed, 78 insertions(+), 32 deletions(-) diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index ac06c53b..ac793e8b 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -309,11 +309,17 @@ protected: int32_t ret = unpacker->ReadUint32(devId) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + { + HdfTrace traceVdi("PrepareDisplayLayers", "HDI:DISP:HARDWARE"); + ret = impl_->PrepareDisplayLayers(devId, needFlush); + } - ret = impl_->PrepareDisplayLayers(devId, needFlush); DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + { + HdfTrace traceVdi("GetDisplayCompChange", "HDI:DISP:HARDWARE"); + ret = impl_->GetDisplayCompChange(devId, layers, types); + } - ret = impl_->GetDisplayCompChange(devId, layers, types); DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); ret = CmdUtils::StartSection(REPLY_CMD_PREPARE_DISPLAY_LAYERS, replyPacker_); @@ -391,11 +397,7 @@ EXIT: bool needFreeBuffer = false; int32_t ret = UnpackDisplayClientBufferInfo(unpacker, inFds, data); HdifdParcelable fdParcel(data.fence); - - if (ret != HDF_SUCCESS) { - goto EXIT; - } - + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); { if (cacheMgr_ == nullptr) { ret = HDF_FAILURE; @@ -416,6 +418,7 @@ EXIT: #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.seqNo, data.fence, handle, "client_"); #endif + HdfTrace traceVdi("SetDisplayClientBuffer", "HDI:DISP:HARDWARE"); int rc = impl_->SetDisplayClientBuffer(data.devId, handle, fdParcel.GetFd()); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); return HDF_SUCCESS; @@ -464,10 +467,11 @@ EXIT: } } } - DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, impl_->SetDisplayClientDamage(devId, rects), - HDF_LOGE("%{public}s, SetDisplayClientDamage error", __func__)); - - if (ret != HDF_SUCCESS) { + if (ret == HDF_SUCCESS) { + HdfTrace traceVdi("SetDisplayClientDamage", "HDI:DISP:HARDWARE"); + impl_->SetDisplayClientDamage(devId, rects); + } else { + HDF_LOGE("%{public}s, SetDisplayClientDamage error", __func__); errMaps_.emplace(REQUEST_CMD_SET_DISPLAY_CLIENT_DAMAGE, ret); } return; @@ -496,7 +500,10 @@ EXIT: goto REPLY; } - ret = impl_->Commit(devId, fence); + { + HdfTrace traceVdi("Commit", "HDI:DISP:HARDWARE"); + ret = impl_->Commit(devId, fence); + } if (ret != HDF_SUCCESS) { HDF_LOGE("%{public}s, commit failed with ret = %{public}d", __func__, ret); } @@ -552,7 +559,10 @@ REPLY: retBool = unpacker->ReadUint8(alpha.gAlpha); DISPLAY_CHECK(retBool == false, goto EXIT); - ret = impl_->SetLayerAlpha(devId, layerId, alpha); + { + HdfTrace traceVdi("SetLayerAlpha", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerAlpha(devId, layerId, alpha); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: @@ -576,7 +586,10 @@ EXIT: ret = CmdUtils::RectUnpack(unpacker, rect); DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerRegion(devId, layerId, rect); + { + HdfTrace traceVdi("SetLayerRegion", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerRegion(devId, layerId, rect); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -599,7 +612,10 @@ EXIT: ret = CmdUtils::RectUnpack(unpacker, rect); DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerCrop(devId, layerId, rect); + { + HdfTrace traceVdi("SetLayerCrop", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerCrop(devId, layerId, rect); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -622,7 +638,10 @@ EXIT: ret = unpacker->ReadUint32(zorder) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerZorder(devId, layerId, zorder); + { + HdfTrace traceVdi("SetLayerZorder", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerZorder(devId, layerId, zorder); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -645,7 +664,10 @@ EXIT: ret = unpacker->ReadBool(preMulti) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerPreMulti(devId, layerId, preMulti); + { + HdfTrace traceVdi("SetLayerPreMulti", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerPreMulti(devId, layerId, preMulti); + } DISPLAY_CHECK(ret != HDF_SUCCESS && ret != DISPLAY_NOT_SUPPORT && ret != HDF_ERR_NOT_SUPPORT, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -668,7 +690,10 @@ EXIT: ret = unpacker->ReadInt32(type) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerTransformMode(devId, layerId, static_cast(type)); + { + HdfTrace traceVdi("SetLayerTransformMode", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerTransformMode(devId, layerId, static_cast(type)); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -703,11 +728,11 @@ EXIT: } } } - - DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, impl_->SetLayerDirtyRegion(devId, layerId, rects), - HDF_LOGE("%{public}s, SetLayerDirtyRegion error", __func__)); - - if (ret != HDF_SUCCESS) { + if (ret == HDF_SUCCESS) { + HdfTrace traceVdi("SetLayerDirtyRegion", "HDI:DISP:HARDWARE"); + impl_->SetLayerDirtyRegion(devId, layerId, rects); + } else { + HDF_LOGE("%{public}s, SetLayerDirtyRegion error", __func__); errMaps_.emplace(REQUEST_CMD_SET_LAYER_DIRTY_REGION, ret); } return; @@ -738,11 +763,11 @@ EXIT: } } } - - DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, impl_->SetLayerVisibleRegion(devId, layerId, rects), - HDF_LOGE("%{public}s, SetLayerDirtyRegion error", __func__)); - - if (ret != HDF_SUCCESS) { + if (ret == HDF_SUCCESS) { + HdfTrace traceVdi("SetLayerVisibleRegion", "HDI:DISP:HARDWARE"); + impl_->SetLayerVisibleRegion(devId, layerId, rects); + } else { + HDF_LOGE("%{public}s, SetLayerDirtyRegion error", __func__); errMaps_.emplace(REQUEST_CMD_SET_LAYER_VISIBLE_REGION, ret); } return; @@ -815,6 +840,7 @@ EXIT: #ifdef DISPLAY_COMSPOER_DEBUG_DUMP DumpLayerBuffer(data.devId, data.layerId, data.fence, handle, "layer_"); #endif + HdfTrace traceVdi("SetLayerBuffer", "HDI:DISP:HARDWARE"); int rc = impl_->SetLayerBuffer(data.devId, data.layerId, handle, fdParcel.GetFd()); DISPLAY_CHK_RETURN(rc != HDF_SUCCESS, HDF_FAILURE, HDF_LOGE(" fail")); return HDF_SUCCESS; @@ -855,7 +881,10 @@ EXIT: ret = unpacker->ReadInt32(type) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerCompositionType(devId, layerId, static_cast(type)); + { + HdfTrace traceVdi("SetLayerCompositionType", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerCompositionType(devId, layerId, static_cast(type)); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -877,7 +906,10 @@ EXIT: ret = unpacker->ReadInt32(type) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerBlendType(devId, layerId, static_cast(type)); + { + HdfTrace traceVdi("SetLayerBlendType", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerBlendType(devId, layerId, static_cast(type)); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -900,7 +932,10 @@ EXIT: ret = unpacker->ReadUint32(maskInfo) ? HDF_SUCCESS : HDF_FAILURE; DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerMaskInfo(devId, layerId, static_cast(maskInfo)); + { + HdfTrace traceVdi("SetLayerMaskInfo", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerMaskInfo(devId, layerId, static_cast(maskInfo)); + } DISPLAY_CHECK(ret != HDF_SUCCESS && ret != DISPLAY_NOT_SUPPORT && ret != HDF_ERR_NOT_SUPPORT, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { @@ -923,7 +958,10 @@ EXIT: ret = CmdUtils::LayerColorUnpack(unpacker, layerColor); DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); - ret = impl_->SetLayerColor(devId, layerId, layerColor); + { + HdfTrace traceVdi("SetLayerColor", "HDI:DISP:HARDWARE"); + ret = impl_->SetLayerColor(devId, layerId, layerColor); + } DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); EXIT: if (ret != HDF_SUCCESS) { diff --git a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h index 35e66561..752ddefb 100644 --- a/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_0/hdi_impl/display_composer_hdi_impl.h @@ -482,6 +482,8 @@ public: // Callback implement virtual int32_t OnHotPlug(uint32_t outputId, bool connected) override { + DISPLAY_TRACE; + HDF_LOGI("OnHotPlug(%{public}u, %{public}u)", outputId, connected); int32_t ret = HDF_SUCCESS; if (hotPlugCb_ != nullptr) { diff --git a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h index d51115f4..47142033 100644 --- a/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_1/hdi_impl/display_composer_hdi_impl.h @@ -71,6 +71,8 @@ public: virtual int32_t OnSeamlessChange(uint32_t outputId) override { + DISPLAY_TRACE; + HDF_LOGD("OnSeamlessChange(%{public}u)", outputId); int32_t ret = HDF_SUCCESS; if (seamlessChangeCb_) { @@ -98,6 +100,8 @@ public: virtual int32_t OnMode(uint32_t modeId, uint64_t vBlankPeriod) override { + DISPLAY_TRACE; + HDF_LOGD("OnMode(%{public}u, %{public}" PRIu64 ")", modeId, vBlankPeriod); int32_t ret = HDF_SUCCESS; if (modeCb_) { @@ -140,6 +144,8 @@ public: virtual int32_t OnRefresh(uint32_t devId) override { + DISPLAY_TRACE; + HDF_LOGD("OnRefresh(%{public}u)", devId); int32_t ret = HDF_SUCCESS; if (refreshCb_ != nullptr) { -- Gitee From 76900cb8b7968c49559074486cb452cbdeb2e86d Mon Sep 17 00:00:00 2001 From: mayongzhi Date: Thu, 11 Apr 2024 09:47:01 +0000 Subject: [PATCH 177/210] update display/composer/cache_manager/cache_manager.h. Signed-off-by: mayongzhi --- display/composer/cache_manager/cache_manager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/display/composer/cache_manager/cache_manager.h b/display/composer/cache_manager/cache_manager.h index 3cd1f126..1532299f 100644 --- a/display/composer/cache_manager/cache_manager.h +++ b/display/composer/cache_manager/cache_manager.h @@ -63,7 +63,7 @@ public: return ret; } - uint32_t Size() const + uint32_t Size() { std::lock_guard lock(mutex_); return caches_.size(); @@ -99,7 +99,7 @@ public: return ret; } - CacheType* SearchCache(IdType id) const + CacheType* SearchCache(IdType id) { std::lock_guard lock(mutex_); auto cacheItem = caches_.find(id); @@ -110,7 +110,7 @@ public: return cacheItem->second.get(); } - void TravelCaches(std::function func) const + void TravelCaches(std::function func) { std::lock_guard lock(mutex_); for (auto const& [key, value] : caches_) { -- Gitee From ea4db8aff85cbfe13f8a1c5814e8743d2ce0e04d Mon Sep 17 00:00:00 2001 From: maoyong Date: Fri, 12 Apr 2024 11:45:18 +0800 Subject: [PATCH 178/210] fix fstack-protector bug Signed-off-by: maoyong --- nnrt/v2_1/BUILD.gn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index cea0ed6d..ffd6d042 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -22,6 +22,12 @@ hdi("nnrt") { "NodeAttrTypes.idl", ] + cflags = [ "-fstack-protector-all" ] + cflags_cc = [ + "-fexceptions", + "-fstack-protector-all" + ] + language = "cpp" innerapi_tags = [ "platformsdk" ] subsystem_name = "hdf" -- Gitee From 43f64b2229114ffa545e13afc784dd96210d8fa5 Mon Sep 17 00:00:00 2001 From: liufeng Date: Fri, 12 Apr 2024 14:22:47 +0800 Subject: [PATCH 179/210] =?UTF-8?q?tag=E5=90=8D=E5=AD=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/include/camera_metadata_item_info.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index c4ecf2aa..877300ae 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -99,7 +99,7 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { [OHOS_SENSOR_EXPOSURE_TIME - OHOS_CAMERA_SENSOR_START] = {"exposureTime", META_TYPE_INT64, 1}, [OHOS_SENSOR_COLOR_CORRECTION_GAINS - OHOS_CAMERA_SENSOR_START] = {"colorCorrectuonGain", META_TYPE_FLOAT, 1}, - [OHOS_SENSOR_ORIENTATION - OHOS_CAMERA_SENSOR_START] = {"orientation", META_TYPE_INT32, 1}, + [OHOS_SENSOR_ORIENTATION - OHOS_CAMERA_SENSOR_START] = {"sensorOrientation", META_TYPE_INT32, 1}, [OHOS_ABILITY_MUTE_MODES - OHOS_CAMERA_SENSOR_START] = {"muteAvailableModes", META_TYPE_BYTE, -1}, [OHOS_CONTROL_MUTE_MODE - OHOS_CAMERA_SENSOR_START] = {"muteMode", META_TYPE_BYTE, 1}, }; @@ -272,7 +272,7 @@ static item_info_t g_ohosStreamJpeg[OHOS_STREAM_JPEG_END - OHOS_STREAM_JPEG_STAR [OHOS_JPEG_GPS_COORDINATES - OHOS_STREAM_JPEG_START] = {"gpsCoordinates", META_TYPE_DOUBLE, -1}, [OHOS_JPEG_GPS_PROCESSING_METHOD - OHOS_STREAM_JPEG_START] = {"gpsProcessingMethod", META_TYPE_BYTE, 1 }, [OHOS_JPEG_GPS_TIMESTAMP - OHOS_STREAM_JPEG_START] = {"gpsTimestamp", META_TYPE_INT64, 1 }, - [OHOS_JPEG_ORIENTATION - OHOS_STREAM_JPEG_START] = {"orientation", META_TYPE_INT32, 1 }, + [OHOS_JPEG_ORIENTATION - OHOS_STREAM_JPEG_START] = {"jpegOrientation", META_TYPE_INT32, 1 }, [OHOS_JPEG_QUALITY - OHOS_STREAM_JPEG_START] = {"quality", META_TYPE_BYTE, 1 }, [OHOS_JPEG_THUMBNAIL_QUALITY - OHOS_STREAM_JPEG_START] = {"thumbnailQuality", META_TYPE_BYTE, 1 }, [OHOS_JPEG_THUMBNAIL_SIZE - OHOS_STREAM_JPEG_START] = {"thumbnailSize", META_TYPE_INT32, -1}, -- Gitee From 21e2f544b70ce47a92769e238b1a80179b6dec60 Mon Sep 17 00:00:00 2001 From: liufeng Date: Sat, 13 Apr 2024 09:39:51 +0800 Subject: [PATCH 180/210] TA Signed-off-by: liufeng --- .../include/camera_device_ability_items.h | 16 ++++++++-------- .../metadata/include/camera_metadata_item_info.h | 12 ++++++------ camera/metadata/src/camera_metadata_info.cpp | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 2a17e589..0823f81e 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -113,9 +113,9 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_ABILITY_MOVING_PHOTO, - OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS, - OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH, - OHOS_STATUS_AMBIENT_BRIGHTNESS, + OHOS_ABILITY_FLASH_SUGGESTION_SUPPORTED, + OHOS_CONTROL_FLASH_SUGGESTION_SWITCH, + OHOS_STATUS_FLASH_SUGGESTION, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, @@ -671,11 +671,11 @@ typedef enum control_moving_photo_enum { OHOS_CAMERA_MOVING_PHOTO_ON, } control_moving_photo_enum_t; -// OHOS_STATUS_AMBIENT_BRIGHTNESS enumeration values -typedef enum camera_ambient_brightness_status_type { - OHOS_CAMERA_AMBIENT_BRIGHTNESS_DARK = 0, - OHOS_CAMERA_AMBIENT_BRIGHTNESS_LIGHT, -} camera_ambient_brightness_status_type_t; +// OHOS_STATUS_FLASH_SUGGESTION enumeration values +typedef enum camera_flash_suggestion_status_type { + OHOS_CAMERA_FLASH_SUPPORTED_OPEN = 0, + OHOS_CAMERA_FLASH_SUPPORTED_CLOSE, +} camera_flash_suggestion_status_type_t; // OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS enumeration values typedef enum camera_supported_enum { diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 877300ae..56599cf6 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -88,12 +88,12 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"customSnapshotDuration", META_TYPE_UINT32, 1}, [OHOS_ABILITY_MOVING_PHOTO - OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityMovingPhoto", META_TYPE_INT32, -1}, - [OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS - - OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityAmbientBrightnessStatus", META_TYPE_UINT32, -1}, - [OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH - - OHOS_CAMERA_PROPERTIES_START] = {"cameraControlAmbientBrightnessStatusReportSwitch", META_TYPE_BYTE, 1}, - [OHOS_STATUS_AMBIENT_BRIGHTNESS - - OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusAmbientBrightness", META_TYPE_UINT32, 1}, + [OHOS_ABILITY_FLASH_SUGGESTION_SUPPORTED - + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityFlashSuggestionSupported", META_TYPE_UINT32, -1}, + [OHOS_CONTROL_FLASH_SUGGESTION_SWITCH - + OHOS_CAMERA_PROPERTIES_START] = {"cameraControlFlashSuggestionSwitch", META_TYPE_BYTE, 1}, + [OHOS_STATUS_FLASH_SUGGESTION - + OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusFlashSuggestion", META_TYPE_UINT32, 1}, }; static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 4d04c0f0..9d0c432d 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -45,9 +45,9 @@ const std::vector g_metadataTags = { OHOS_ABILITY_CAPTURE_DURATION_SUPPORTED, OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, OHOS_ABILITY_MOVING_PHOTO, - OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS, - OHOS_CONTROL_AMBIENT_BRIGHTNESS_STATUS_REPORT_SWITCH, - OHOS_STATUS_AMBIENT_BRIGHTNESS, + OHOS_ABILITY_FLASH_SUGGESTION_SUPPORTED, + OHOS_CONTROL_FLASH_SUGGESTION_SWITCH, + OHOS_STATUS_FLASH_SUGGESTION, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, -- Gitee From 799db6e41d5d4f002e087c06e2ace28d4cd2754e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 03:10:21 +0000 Subject: [PATCH 181/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 0823f81e..1a8b6dca 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -672,10 +672,10 @@ typedef enum control_moving_photo_enum { } control_moving_photo_enum_t; // OHOS_STATUS_FLASH_SUGGESTION enumeration values -typedef enum camera_flash_suggestion_status_type { - OHOS_CAMERA_FLASH_SUPPORTED_OPEN = 0, - OHOS_CAMERA_FLASH_SUPPORTED_CLOSE, -} camera_flash_suggestion_status_type_t; +typedef enum camera_flash_suggestion_surported_enum { + OHOS_CAMERA_FLASH_SUPPORTED_CLOSE = 0, + OHOS_CAMERA_FLASH_SUPPORTED_OPEN, +} camera_flash_suggestion_surported_enum_t; // OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS enumeration values typedef enum camera_supported_enum { -- Gitee From cb416f20a6f2f40bda21d099533002acc11ad757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 03:29:34 +0000 Subject: [PATCH 182/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 1a8b6dca..8c4d17d6 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -673,8 +673,8 @@ typedef enum control_moving_photo_enum { // OHOS_STATUS_FLASH_SUGGESTION enumeration values typedef enum camera_flash_suggestion_surported_enum { - OHOS_CAMERA_FLASH_SUPPORTED_CLOSE = 0, - OHOS_CAMERA_FLASH_SUPPORTED_OPEN, + OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_CLOSE = 0, + OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, } camera_flash_suggestion_surported_enum_t; // OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS enumeration values -- Gitee From bf717c043b6893f63ba1f710a97adbe8fe6d3b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 03:34:15 +0000 Subject: [PATCH 183/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 8c4d17d6..7b25b949 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -677,7 +677,7 @@ typedef enum camera_flash_suggestion_surported_enum { OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, } camera_flash_suggestion_surported_enum_t; -// OHOS_ABILITY_AMBIENT_BRIGHTNESS_STATUS enumeration values +// ABILITY_SUPPORTED_TAGS enumeration values enumeration values typedef enum camera_supported_enum { OHOS_CAMERA_NOT_SUPPORTED = 0, OHOS_CAMERA_SUPPORTED, -- Gitee From 7310a9c72169e3fe3c8cbd9c402dc4788331d402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 07:00:50 +0000 Subject: [PATCH 184/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 7b25b949..535d55ff 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -672,10 +672,10 @@ typedef enum control_moving_photo_enum { } control_moving_photo_enum_t; // OHOS_STATUS_FLASH_SUGGESTION enumeration values -typedef enum camera_flash_suggestion_surported_enum { +typedef enum camera_flash_suggestion_surpported_enum { OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_CLOSE = 0, OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, -} camera_flash_suggestion_surported_enum_t; +} camera_flash_suggestion_surpported_enum_t; // ABILITY_SUPPORTED_TAGS enumeration values enumeration values typedef enum camera_supported_enum { -- Gitee From 5e823f5994421b1132479450f97fd8aef5b308c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 07:01:39 +0000 Subject: [PATCH 185/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 535d55ff..bbb09c1b 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -677,7 +677,7 @@ typedef enum camera_flash_suggestion_surpported_enum { OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, } camera_flash_suggestion_surpported_enum_t; -// ABILITY_SUPPORTED_TAGS enumeration values enumeration values +// ABILITY_SUPPORTED_TAGS enumeration values typedef enum camera_supported_enum { OHOS_CAMERA_NOT_SUPPORTED = 0, OHOS_CAMERA_SUPPORTED, -- Gitee From e88b9e99d0c0889212263af032de9b1b5584981e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Sat, 13 Apr 2024 08:28:39 +0000 Subject: [PATCH 186/210] update camera/metadata/include/camera_device_ability_items.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/include/camera_device_ability_items.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index bbb09c1b..22dd92f5 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -672,10 +672,10 @@ typedef enum control_moving_photo_enum { } control_moving_photo_enum_t; // OHOS_STATUS_FLASH_SUGGESTION enumeration values -typedef enum camera_flash_suggestion_surpported_enum { +typedef enum camera_flash_suggestion_supported_enum { OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_CLOSE = 0, OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, -} camera_flash_suggestion_surpported_enum_t; +} camera_flash_suggestion_supported_enum_t; // ABILITY_SUPPORTED_TAGS enumeration values typedef enum camera_supported_enum { -- Gitee From c96ebe999407e6ceeddbe4cd9e7c6aa9b7f48c87 Mon Sep 17 00:00:00 2001 From: shenhao3 Date: Fri, 29 Mar 2024 17:24:09 +0800 Subject: [PATCH 187/210] Skip Validate of HDI 1.2 in driver interface Signed-off-by: shenhao3 --- display/composer/v1_2/DisplayComposerType.idl | 11 + .../display_command/display_cmd_requester.h | 170 ++++++++++- .../display_command/display_cmd_responser.h | 264 ++++++++++++++++++ .../v1_2/display_command/display_cmd_utils.h | 6 +- .../v1_2/hdi_impl/display_composer_hdi_impl.h | 25 +- .../include/idisplay_composer_interface.h | 21 ++ 6 files changed, 493 insertions(+), 4 deletions(-) diff --git a/display/composer/v1_2/DisplayComposerType.idl b/display/composer/v1_2/DisplayComposerType.idl index b874aaa1..cd1b6ddf 100644 --- a/display/composer/v1_2/DisplayComposerType.idl +++ b/display/composer/v1_2/DisplayComposerType.idl @@ -66,4 +66,15 @@ enum DispCmd : ohos.hdi.display.composer.v1_0.DispCmd { REQUEST_CMD_BUTT_V1_2, REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE = 515, /**< Reply cmd */ REPLY_CMD_BUTT_V1_2, +}; + + +/** + * @brief Enumerates the property id of the display vdi. + * + * @since 5.0 + * @version 1.0 + */ +enum DisplayPropertyID { + DISPLAY_PROPERTY_ID_SKIP_VALIDATE = 1, }; \ No newline at end of file diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index 2bf77970..d7d62954 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -39,7 +39,7 @@ public: auto requester = std::make_unique(hdi); DISPLAY_CHK_RETURN(requester == nullptr, nullptr, HDF_LOGE("%{public}s: CmdRequester is nullptr", __func__)); - auto ret = requester->Init(V1_0::DisplayCmdUtils::INIT_ELEMENT_COUNT); + auto ret = requester->Init(CmdUtils::INIT_ELEMENT_COUNT); if (ret != HDF_SUCCESS) { HDF_LOGE("DisplayCmdRequester init failed"); return nullptr; @@ -47,10 +47,178 @@ public: return requester; } + int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t &fence, bool isSupportSkipValidate, + int32_t &skipState, bool &needFlush) + { + uint32_t replyEleCnt = 0; + std::vector outFds; + std::shared_ptr replyData; + + int32_t ret = CmdUtils::StartSection(REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE, requestPacker_); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = requestPacker_->WriteUint32(devId) ? HDF_SUCCESS : HDF_FAILURE; + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = requestPacker_->WriteBool(isSupportSkipValidate) ? HDF_SUCCESS : HDF_FAILURE; + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = CmdUtils::EndSection(requestPacker_); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = CmdUtils::EndPack(requestPacker_); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = DoRequest(replyEleCnt, outFds, replyData); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); + + ret = DoReplyResults(replyEleCnt, outFds, replyData, [&](void *data) -> int32_t { + FenceData *fenceData = reinterpret_cast(data); + if (fenceData == nullptr) { + fence = -1; + skipState = -1; + needFlush = false; + return HDF_FAILURE; + } + fence = fenceData->fence_; + skipState = fenceData->skipValidateState_; + needFlush = fenceData->needFlush_; + return HDF_SUCCESS; + }); + if (ret != HDF_SUCCESS) { + HDF_LOGE("DoReplyResults failure, ret=%{public}d", ret); + } + +EXIT: + return PeriodDataReset() == HDF_SUCCESS ? ret : HDF_FAILURE; + } + + int32_t OnReplyCommitAndGetReleaseFence(std::shared_ptr replyUnpacker, + std::vector replyFds, int32_t &fenceFd, int32_t &skipState, bool &needFlush) + { + uint32_t devId = 0; + int32_t ret = CmdUtils::FileDescriptorUnpack(replyUnpacker, replyFds, fenceFd); + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, + HDF_LOGE("%{public}s: FileDescriptorUnpack failed", __func__)); + + int32_t retBool = replyUnpacker->ReadInt32(skipState); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: read skipValidateState failed", __func__)); + + if (skipState != HDF_SUCCESS) { + retBool = replyUnpacker->ReadUint32(devId); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, HDF_LOGE("%{public}s: read devId failed", __func__)); + + retBool = replyUnpacker->ReadBool(needFlush); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, HDF_LOGE("%{public}s: read needFlush failed", __func__)); + + // unpack layers vector + uint32_t vectSize = 0; + retBool = replyUnpacker->ReadUint32(vectSize); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: HDI 1.2 read vect size failed", __func__)); + + compChangeLayers_[devId].resize(vectSize); + for (uint32_t i = 0; i < vectSize; i++) { + DISPLAY_CHK_RETURN(replyUnpacker->ReadUint32(compChangeLayers_[devId][i]) == false, HDF_FAILURE, + HDF_LOGE("%{public}s: HDI 1.2 read layer vector failed", __func__)); + } + // unpack types vector + vectSize = 0; + retBool = replyUnpacker->ReadUint32(vectSize); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: HDI 1.2 read vect size failed", __func__)); + + compChangeTypes_[devId].resize(vectSize); + for (uint32_t i = 0; i < vectSize; i++) { + DISPLAY_CHK_RETURN(replyUnpacker->ReadInt32(compChangeTypes_[devId][i]) == false, HDF_FAILURE, + HDF_LOGE("%{public}s: HDI 1.2 read composition type vector failed", __func__)); + } + } + return HDF_SUCCESS; + } + + int32_t ProcessUnpackCmd(std::shared_ptr replyUnpacker, int32_t unpackCmd, + std::vector replyFds, std::function fn) + { + int32_t ret = HDF_SUCCESS; + while (replyUnpacker->NextSection()) { + bool retBool = replyUnpacker->BeginSection(unpackCmd); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: BeginSection failed", __func__)); + + FenceData fenceData; + std::unordered_map errMaps; + switch (unpackCmd) { + case REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE: + ret = OnReplyCommitAndGetReleaseFence(replyUnpacker, replyFds, fenceData.fence_, + fenceData.skipValidateState_, fenceData.needFlush_); + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, + HDF_LOGE("%{public}s: OnReplyCommit failed unpackCmd=%{public}s", + __func__, CmdUtils::CommandToString(unpackCmd))); + + ret = fn(&fenceData); + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, + HDF_LOGE("%{public}s: return fence fd error, unpackCmd=%{public}s", + __func__, CmdUtils::CommandToString(unpackCmd))); + break; + default: + HDF_LOGE("Unpack command failure"); + return HDF_FAILURE; + } + } + return HDF_SUCCESS; + } + + int32_t DoReplyResults(uint32_t replyEleCnt, std::vector replyFds, std::shared_ptr replyData, + std::function fn) + { + std::shared_ptr replyUnpacker = std::make_shared(); + DISPLAY_CHK_RETURN(replyUnpacker == nullptr, HDF_FAILURE, + HDF_LOGE("%{public}s: HDI 1.2 CommandDataUnpacker construct failed", __func__)); + replyUnpacker->Init(replyData.get(), replyEleCnt * CmdUtils::ELEMENT_SIZE); +#ifdef DEBUG_DISPLAY_CMD_RAW_DATA + replyUnpacker->Dump(); +#endif // DEBUG_DISPLAY_CMD_RAW_DATA + int32_t unpackCmd = -1; + bool retBool = replyUnpacker->PackBegin(unpackCmd); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: PackBegin failed", __func__)); + DISPLAY_CHK_RETURN(unpackCmd != CONTROL_CMD_REPLY_BEGIN, HDF_FAILURE, + HDF_LOGE("%{public}s: PackBegin cmd not match, unpackCmd=%{public}d", __func__, unpackCmd)); + if (ProcessUnpackCmd(replyUnpacker, unpackCmd, replyFds, fn) != HDF_SUCCESS) { + return HDF_FAILURE; + } + + retBool = replyUnpacker->PackEnd(unpackCmd); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: PackEnd failed", __func__)); + + DISPLAY_CHK_RETURN(unpackCmd != CONTROL_CMD_REPLY_END, HDF_FAILURE, + HDF_LOGE("%{public}s: PackEnd failed, endCmd = %{public}s", + __func__, CmdUtils::CommandToString(unpackCmd))); + + return HDF_SUCCESS; + } + protected: sptr hdi_1_2_; private: using BaseType1_1 = V1_1::DisplayCmdRequester; + using BaseType1_1::requestPacker_; + using BaseType1_1::DoRequest; + using BaseType1_1::PeriodDataReset; + using BaseType1_1::DoReplyResults; + + // Composition layers/types changed + using BaseType1_1::compChangeLayers_; + using BaseType1_1::compChangeTypes_; + // CommitAndGetReleaseFence + struct FenceData { + int32_t fence_ = -1; + int32_t skipValidateState_ = -1; + bool needFlush_ = false; + }; }; using HdiDisplayCmdRequester = V1_2::DisplayCmdRequester, V1_2::IDisplayComposer>; } // namespace V1_2 diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index 0037f674..590cf87f 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -18,6 +18,7 @@ #include "v1_1/display_command/display_cmd_responser.h" #include "v1_2/display_composer_type.h" +#include "v1_2/display_command/display_cmd_utils.h" #define DISPLAY_TRACE HdfTrace trace(__func__, "HDI:DISP:") @@ -44,8 +45,271 @@ public: virtual ~DisplayCmdResponser() {} + int32_t ProcessRequestCmd(std::shared_ptr unpacker, int32_t cmd, + const std::vector& inFds, std::vector& outFds) + { + int32_t ret = HDF_SUCCESS; + HDF_LOGD("%{public}s: HDI 1.2 PackSection, cmd-[%{public}d] = %{public}s", + __func__, cmd, CmdUtils::CommandToString(cmd)); + switch (cmd) { + case REQUEST_CMD_PREPARE_DISPLAY_LAYERS: + OnPrepareDisplayLayers(unpacker); + break; + case REQUEST_CMD_SET_DISPLAY_CLIENT_BUFFER: + OnSetDisplayClientBuffer(unpacker, inFds); + break; + case REQUEST_CMD_SET_DISPLAY_CLIENT_DAMAGE: + OnSetDisplayClientDamage(unpacker); + break; + case REQUEST_CMD_COMMIT: + OnCommit(unpacker, outFds); + break; + case REQUEST_CMD_SET_LAYER_ALPHA: + OnSetLayerAlpha(unpacker); + break; + case REQUEST_CMD_SET_LAYER_REGION: + OnSetLayerRegion(unpacker); + break; + case REQUEST_CMD_SET_LAYER_CROP: + OnSetLayerCrop(unpacker); + break; + case REQUEST_CMD_SET_LAYER_ZORDER: + OnSetLayerZorder(unpacker); + break; + case REQUEST_CMD_SET_LAYER_PREMULTI: + OnSetLayerPreMulti(unpacker); + break; + case REQUEST_CMD_SET_LAYER_TRANSFORM_MODE: + OnSetLayerTransformMode(unpacker); + break; + case REQUEST_CMD_SET_LAYER_DIRTY_REGION: + OnSetLayerDirtyRegion(unpacker); + break; + case REQUEST_CMD_SET_LAYER_VISIBLE_REGION: + OnSetLayerVisibleRegion(unpacker); + break; + case REQUEST_CMD_SET_LAYER_BUFFER: + OnSetLayerBuffer(unpacker, inFds); + break; + case REQUEST_CMD_SET_LAYER_COMPOSITION_TYPE: + OnSetLayerCompositionType(unpacker); + break; + case REQUEST_CMD_SET_LAYER_BLEND_TYPE: + OnSetLayerBlendType(unpacker); + break; + case REQUEST_CMD_SET_LAYER_MASK_INFO: + OnSetLayerMaskInfo(unpacker); + break; + case CONTROL_CMD_REQUEST_END: + ret = OnRequestEnd(unpacker); + break; + case REQUEST_CMD_SET_LAYER_COLOR: + OnSetLayerColor(unpacker); + break; + case REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE: + OnCommitAndGetReleaseFence(unpacker, outFds); + break; + default: + HDF_LOGE("%{public}s: not support this cmd, unpacked cmd = %{public}d", __func__, cmd); + ret = HDF_FAILURE; + break; + } + return ret; + } + + void ReplyCommitAndGetReleaseFence(std::vector& outFds, uint32_t& devId, int32_t& fence, + int32_t& skipRet, std::vector& compLayers, std::vector& compTypes, bool& needFlush) + { + int32_t ret = HDF_SUCCESS; + uint32_t vectSize = 0; + + HdifdParcelable fdParcel(fence); + DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, + CmdUtils::StartSection(REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE, replyPacker_), + HDF_LOGE("%{public}s, StartSection error", __func__)); + + DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, CmdUtils::FileDescriptorPack(fdParcel.GetFd(), replyPacker_, outFds), + HDF_LOGE("%{public}s, FileDescriptorPack error", __func__)); + + DISPLAY_CHECK(replyPacker_->WriteInt32(skipRet) == false, + HDF_LOGE("%{public}s, write skip validate return value error", __func__)); + if (skipRet != HDF_SUCCESS) { + DISPLAY_CHECK(replyPacker_->WriteUint32(devId) == false, + HDF_LOGE("%{public}s, write devId error", __func__)); + + DISPLAY_CHECK(replyPacker_->WriteBool(needFlush) == false, + HDF_LOGE("%{public}s, write needFlush error", __func__)); + + // Write compLayers vector + vectSize = static_cast(compLayers.size()); + DISPLAY_CHECK(replyPacker_->WriteUint32(vectSize) == false, + HDF_LOGE("%{public}s, write compLayers.size error", __func__)); + + for (uint32_t i = 0; i < vectSize; i++) { + DISPLAY_CHECK(replyPacker_->WriteUint32(compLayers[i]) == false, + HDF_LOGE("%{public}s, write compLayers error", __func__)); + } + // Write compTypes vector + vectSize = static_cast(compTypes.size()); + DISPLAY_CHECK(replyPacker_->WriteUint32(vectSize) == false, + HDF_LOGE("%{public}s, write compTypes.size error", __func__)); + + for (uint32_t i = 0; i < vectSize; i++) { + DISPLAY_CHECK(replyPacker_->WriteUint32(compTypes[i]) == false, + HDF_LOGE("%{public}s, write compTypes error", __func__)); + } + } + DISPLAY_CHK_CONDITION(ret, HDF_SUCCESS, CmdUtils::EndSection(replyPacker_), + HDF_LOGE("%{public}s, EndSection error", __func__)); + + replyCommandCnt_++; + +#ifndef DISPLAY_COMMUNITY + fdParcel.Move(); +#endif // DISPLAY_COMMUNITY + + if (ret != HDF_SUCCESS) { + errMaps_.emplace(REQUEST_CMD_COMMIT_AND_GET_RELEASE_FENCE, ret); + } + } + + void OnCommitAndGetReleaseFence(std::shared_ptr unpacker, + std::vector& outFds) + { + DISPLAY_TRACE; + + uint32_t devId = 0; + int32_t fence = -1; + bool isSupportSkipValidate = false; + int32_t ret = HDF_SUCCESS; + int32_t skipRet = HDF_FAILURE; + bool needFlush = false; + std::vector compLayers; + std::vector compTypes; +#ifdef DISPLAY_COMSPOER_DEBUG_DUMP + const std::string SWITCH_ON = "on"; + const uint32_t DUMP_CACHE_SWITCH_LEN = 4; + char dumpSwitch[DUMP_CACHE_SWITCH_LEN] = {0}; + GetParameter("hdi.composer.dumpcache", "off", dumpSwitch, DUMP_CACHE_SWITCH_LEN); + + if (SWITCH_ON.compare(dumpSwitch) == 0) { + cacheMgr_->Dump(); + } +#endif + if (!unpacker->ReadUint32(devId)) { + HDF_LOGE("%{public}s, read devId error", __func__); + ret = HDF_FAILURE; + goto REPLY; + } + if (!unpacker->ReadBool(isSupportSkipValidate)) { + HDF_LOGE("%{public}s, read isSupportSkipValidate error", __func__); + ret = HDF_FAILURE; + goto REPLY; + } + + if (isSupportSkipValidate) { + skipRet = impl_->Commit(devId, fence); + } + if (skipRet != HDF_SUCCESS) { + ret = impl_->PrepareDisplayLayers(devId, needFlush); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto REPLY); + + ret = impl_->GetDisplayCompChange(devId, compLayers, compTypes); + DISPLAY_CHECK(ret != HDF_SUCCESS, goto REPLY); + + HDF_LOGD("%{public}s, first commit with skipRet = %{public}d, fence = %{public}d, needFlush = %{public}d", + __func__, skipRet, fence, needFlush); + } + +REPLY: + ReplyCommitAndGetReleaseFence(outFds, devId, fence, skipRet, compLayers, compTypes, needFlush); + return; + } + + int32_t CmdRequest(uint32_t inEleCnt, const std::vector& inFds, uint32_t& outEleCnt, + std::vector& outFds) + { + std::shared_ptr requestData(new char[inEleCnt * CmdUtils::ELEMENT_SIZE], std::default_delete()); + int32_t ret = request_->Read(reinterpret_cast(requestData.get()), inEleCnt, + CmdUtils::TRANSFER_WAIT_TIME); + + std::shared_ptr unpacker = std::make_shared(); + DISPLAY_CHK_RETURN(unpacker == nullptr, HDF_FAILURE, + HDF_LOGE("%{public}s: unpacker construct failed", __func__)); + + unpacker->Init(requestData.get(), inEleCnt * CmdUtils::ELEMENT_SIZE); +#ifdef DEBUG_DISPLAY_CMD_RAW_DATA + unpacker->Dump(); +#endif // DEBUG_DISPLAY_CMD_RAW_DATA + + int32_t unpackCmd = -1; + bool retBool = unpacker->PackBegin(unpackCmd); + DISPLAY_CHK_RETURN(retBool == false, HDF_FAILURE, + HDF_LOGE("%{public}s: error: Check RequestBegin failed", __func__)); + DISPLAY_CHK_RETURN(unpackCmd != CONTROL_CMD_REQUEST_BEGIN, HDF_FAILURE, + HDF_LOGI("error: unpacker PackBegin cmd not match, cmd(%{public}d)=%{public}s.", unpackCmd, + CmdUtils::CommandToString(unpackCmd))); + + while (ret == HDF_SUCCESS && unpacker->NextSection()) { + if (!unpacker->BeginSection(unpackCmd)) { + HDF_LOGE("error: PackSection failed, unpackCmd=%{public}s.", + CmdUtils::CommandToString(unpackCmd)); + ret = HDF_FAILURE; + } + ret = ProcessRequestCmd(unpacker, unpackCmd, inFds, outFds); + } + + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, + HDF_LOGE("%{public}s: ProcessRequestCmd failed", __func__)); + /* pack request end commands */ + replyPacker_->PackEnd(CONTROL_CMD_REPLY_END); + +#ifdef DEBUG_DISPLAY_CMD_RAW_DATA + /* just for debug */ + replyPacker_->Dump(); + HDF_LOGI("CmdReply command cnt=%{public}d", replyCommandCnt_); +#endif // DEBUG_DISPLAY_CMD_RAW_DATA + + /* Write reply pack */ + outEleCnt = replyPacker_->ValidSize() / CmdUtils::ELEMENT_SIZE; + ret = reply_->Write(reinterpret_cast(replyPacker_->GetDataPtr()), outEleCnt, + CmdUtils::TRANSFER_WAIT_TIME); + if (ret != HDF_SUCCESS) { + HDF_LOGE("Reply write failure, ret=%{public}d", ret); + outEleCnt = 0; + } + int32_t ec = PeriodDataReset(); + return (ret == HDF_SUCCESS ? ec : ret); + } + private: using BaseType1_1 = V1_1::DisplayCmdResponser; + using BaseType1_1::replyPacker_; + using BaseType1_1::cacheMgr_; + using BaseType1_1::impl_; + using BaseType1_1::replyCommandCnt_; + using BaseType1_1::errMaps_; + using BaseType1_1::request_; + using BaseType1_1::reply_; + using BaseType1_1::PeriodDataReset; + using BaseType1_1::OnPrepareDisplayLayers; + using BaseType1_1::OnSetDisplayClientBuffer; + using BaseType1_1::OnSetDisplayClientDamage; + using BaseType1_1::OnCommit; + using BaseType1_1::OnSetLayerAlpha; + using BaseType1_1::OnSetLayerRegion; + using BaseType1_1::OnSetLayerCrop; + using BaseType1_1::OnSetLayerZorder; + using BaseType1_1::OnSetLayerPreMulti; + using BaseType1_1::OnSetLayerTransformMode; + using BaseType1_1::OnSetLayerDirtyRegion; + using BaseType1_1::OnSetLayerVisibleRegion; + using BaseType1_1::OnSetLayerBuffer; + using BaseType1_1::OnSetLayerCompositionType; + using BaseType1_1::OnSetLayerBlendType; + using BaseType1_1::OnSetLayerMaskInfo; + using BaseType1_1::OnRequestEnd; + using BaseType1_1::OnSetLayerColor; }; using HdiDisplayCmdResponser = DisplayCmdResponser, IDisplayComposerVdi>; } // namespace V1_2 diff --git a/display/composer/v1_2/display_command/display_cmd_utils.h b/display/composer/v1_2/display_command/display_cmd_utils.h index cd28d018..38087a63 100644 --- a/display/composer/v1_2/display_command/display_cmd_utils.h +++ b/display/composer/v1_2/display_command/display_cmd_utils.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_UTILS_H -#define OHOS_HDI_DISPLAY_V1_1_DISPLAY_CMD_UTILS_H +#ifndef OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_UTILS_H +#define OHOS_HDI_DISPLAY_V1_2_DISPLAY_CMD_UTILS_H #include "v1_1/display_command/display_cmd_utils.h" #include "v1_2/display_composer_type.h" @@ -31,6 +31,8 @@ namespace Composer { namespace V1_2 { class DisplayCmdUtils : public V1_1::DisplayCmdUtils { +public: + #define SWITCHCASE(x) case (x): {return #x;} static const char *CommandToString(int32_t cmdId) { switch (cmdId) { diff --git a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h index 65562ff6..8b6a300d 100644 --- a/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h +++ b/display/composer/v1_2/hdi_impl/display_composer_hdi_impl.h @@ -60,16 +60,39 @@ public: DisplayComposerHdiImpl(sptr hdi, std::shared_ptr req) : BaseType1_1(hdi, req), req_v1_2_(req), - hdi_v1_2_(hdi) {} + hdi_v1_2_(hdi), + isSupportSkipValidate_(0) {} virtual ~DisplayComposerHdiImpl() {} + virtual int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t& fence, int32_t& skipState, + bool& needFlush) override + { + COMPOSER_CHECK_NULLPTR(req_v1_2_); + bool isSupportSkipValidate = (isSupportSkipValidate_ == 1) ? 1 : 0; + return ToDispErrCode(req_v1_2_->CommitAndGetReleaseFence(devId, fence, isSupportSkipValidate, skipState, + needFlush)); + } + + virtual int32_t GetDisplayProperty(uint32_t devId, uint32_t id, uint64_t& value) override + { + COMPOSER_CHECK_NULLPTR(hdi_v1_2_); + value = 0; + int32_t ret = ToDispErrCode(hdi_v1_2_->GetDisplayProperty(devId, id, value)); + if (ret == DISPLAY_SUCCESS) { + isSupportSkipValidate_ = value; + } + + return ret; + } + protected: using BaseType1_1 = V1_1::DisplayComposerHdiImpl; using BaseType1_1::WAIT_TIME_INTERVAL; using BaseType1_1::ToDispErrCode; std::shared_ptr req_v1_2_; sptr hdi_v1_2_; + uint64_t isSupportSkipValidate_; }; using HdiDisplayComposer = DisplayComposerHdiImpl; } // namespace V1_2 diff --git a/display/composer/v1_2/include/idisplay_composer_interface.h b/display/composer/v1_2/include/idisplay_composer_interface.h index 6203a9a1..24e33701 100644 --- a/display/composer/v1_2/include/idisplay_composer_interface.h +++ b/display/composer/v1_2/include/idisplay_composer_interface.h @@ -36,6 +36,27 @@ public: * @version 1.2 */ static IDisplayComposerInterface* Get(bool needSMQ = true); + + /** + * @brief Commits the request for composition and display. + * Obtains the fences of the display layers after the commit operation. + * If there is a hardware composition layer, the composition is performed and the composition result is sent to + * the hardware for display. + * + * @param devId Indicates the ID of the display device. + * @param fence Indicates the pointer to the start address of the fence. + * @param skipState Indicates the state of the skip validate feature. + * @param needFlush Indicates the pointer that specifies whether the graphics service needs to reset the display + * framebuffer by using SetDisplayClientBuffer before the commit operation. + * The value true means that the framebuffer needs to be reset, and false means the opposite. + * + * @return Returns 0 if the operation is successful; returns an error code defined + * in {@link DispErrCode} otherwise. + * @since 5.0 + * @version 1.2 + */ + virtual int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t& fence, + int32_t& skipState, bool& needFlush) = 0; }; } // V1_2 } // Composer -- Gitee From 844832536c48316118b15db5f0b69691daa06233 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:20:21 +0000 Subject: [PATCH 188/210] update audio/v3_0/AudioTypes.idl. Signed-off-by: yangkan --- audio/v3_0/AudioTypes.idl | 2 -- 1 file changed, 2 deletions(-) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index 4c5c8a92..8b0edef1 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -87,8 +87,6 @@ enum AudioCategory { AUDIO_OFFLOAD = 5, /**< Offload */ AUDIO_MULTI_CHANNEL = 6, /**< Multi channel */ AUDIO_DP = 7, /**< Audio dp */ - AUDIO_MMAP_VOIP = 8, /**< Audio voip */ - AUDIO_IN_NAVIGATION = 9, /**< Audio navigation */ }; /** -- Gitee From 27ca605ee2d417125f1acc842def4685a5342514 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:30:34 +0000 Subject: [PATCH 189/210] update audio/v3_0/AudioTypes.idl. Signed-off-by: yangkan --- audio/v3_0/AudioTypes.idl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/audio/v3_0/AudioTypes.idl b/audio/v3_0/AudioTypes.idl index 8b0edef1..4c5c8a92 100644 --- a/audio/v3_0/AudioTypes.idl +++ b/audio/v3_0/AudioTypes.idl @@ -87,6 +87,8 @@ enum AudioCategory { AUDIO_OFFLOAD = 5, /**< Offload */ AUDIO_MULTI_CHANNEL = 6, /**< Multi channel */ AUDIO_DP = 7, /**< Audio dp */ + AUDIO_MMAP_VOIP = 8, /**< Audio voip */ + AUDIO_IN_NAVIGATION = 9, /**< Audio navigation */ }; /** -- Gitee From 64925d9387ddb1b0e67bd902a46222a67a4f07cb Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:31:44 +0000 Subject: [PATCH 190/210] update display/composer/v1_2/display_command/display_cmd_requester.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_requester.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index 43a196b2..aab5e46c 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -181,7 +181,8 @@ EXIT: std::unordered_map errMaps; switch (unpackCmd) { case REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE: - ret = OnReplyCommitAndGetReleaseFence(replyUnpacker, replyFds, fenceData.fence_, fenceData.skipValidateState_, fenceData.needFlush_, fenceData.layers, fenceData.fences); + ret = OnReplyCommitAndGetReleaseFence(replyUnpacker, replyFds, fenceData.fence_, fenceData.skipValidateState_, + fenceData.needFlush_, fenceData.layers, fenceData.fences); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, HDF_LOGE("%{public}s: OnReplyCommit failed unpackCmd=%{public}s", __func__, CmdUtils::CommandToString(unpackCmd))); -- Gitee From aaf9233207a5321591829418b8207a2179767167 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:33:40 +0000 Subject: [PATCH 191/210] update display/composer/v1_2/display_command/display_cmd_responser.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_responser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index 04405e05..4b95f355 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -243,7 +243,7 @@ public: DISPLAY_CHECK(ret != HDF_SUCCESS, goto REPLY); } - HDF_LOGD("%{public}s, first commit with skipRet = %{public}d, fence = %{public}d, needFlush = %{public}d", + HDF_LOGD("%{public}s, first commit with skipRet = %{public}d, fence = %{public}d, needFlush = %{public}d", __func__, skipRet, fence, needFlush); ret = impl_->GetDisplayReleaseFence(devId, layers, fences); -- Gitee From 6f41a5734972af1f3a69bbd76a33043801f27b51 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:34:46 +0000 Subject: [PATCH 192/210] update display/composer/v1_2/display_command/display_cmd_requester.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_requester.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index aab5e46c..1f7f706d 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -75,7 +75,7 @@ public: ret = DoReplyResults(replyEleCnt, outFds, replyData, [&](void *data) -> int32_t { // fence = *(reinterpret_cast(data)); FenceData *fenceData = (reinterpret_cast(data)); - if(fenceData == nullptr){ + if (fenceData == nullptr) { fence = -1; skipState = -1; needFlush = false; -- Gitee From ba3782dbc7ec8c301c1a35514e90a158d33cf7a6 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 07:37:52 +0000 Subject: [PATCH 193/210] update display/composer/v1_2/display_command/display_cmd_requester.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_requester.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index 1f7f706d..ba3477cf 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -99,7 +99,8 @@ EXIT: } int32_t OnReplyCommitAndGetReleaseFence(std::shared_ptr replyUnpacker, - std::vector replyFds, int32_t &fenceFd, int32_t &skipState, bool &needFlush, std::vector& layers, std::vector& fences) + std::vector replyFds, int32_t &fenceFd, int32_t &skipState, + bool &needFlush, std::vector& layers, std::vector& fences) { uint32_t devId = 0; int32_t ret = CmdUtils::FileDescriptorUnpack(replyUnpacker, replyFds, fenceFd); -- Gitee From f17935b45e2d7df9d044af70f6b75491cbdcea49 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 08:18:36 +0000 Subject: [PATCH 194/210] update display/composer/v1_2/display_command/display_cmd_responser.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_responser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index 4b95f355..fb50dd73 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -244,7 +244,7 @@ public: } HDF_LOGD("%{public}s, first commit with skipRet = %{public}d, fence = %{public}d, needFlush = %{public}d", - __func__, skipRet, fence, needFlush); + __func__, skipRet, fence, needFlush); ret = impl_->GetDisplayReleaseFence(devId, layers, fences); if (ret != HDF_SUCCESS) { -- Gitee From 040e3cdf34668c44e9de0cf83d42cc8417f8515e Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 08:21:16 +0000 Subject: [PATCH 195/210] update display/composer/v1_2/display_command/display_cmd_requester.h. Signed-off-by: yangkan --- .../composer/v1_2/display_command/display_cmd_requester.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index ba3477cf..8b3670ac 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -73,7 +73,6 @@ public: DISPLAY_CHECK(ret != HDF_SUCCESS, goto EXIT); ret = DoReplyResults(replyEleCnt, outFds, replyData, [&](void *data) -> int32_t { - // fence = *(reinterpret_cast(data)); FenceData *fenceData = (reinterpret_cast(data)); if (fenceData == nullptr) { fence = -1; @@ -140,7 +139,6 @@ EXIT: DISPLAY_CHK_RETURN(replyUnpacker->ReadInt32(compChangeTypes_[devId][i]) == false, HDF_FAILURE, HDF_LOGE("%{public}s: HDI 1.2 read composition type vector failed", __func__)); } - } // unpack layers vector @@ -182,8 +180,8 @@ EXIT: std::unordered_map errMaps; switch (unpackCmd) { case REPLY_CMD_COMMIT_AND_GET_RELEASE_FENCE: - ret = OnReplyCommitAndGetReleaseFence(replyUnpacker, replyFds, fenceData.fence_, fenceData.skipValidateState_, - fenceData.needFlush_, fenceData.layers, fenceData.fences); + ret = OnReplyCommitAndGetReleaseFence(replyUnpacker, replyFds, fenceData.fence_, + fenceData.skipValidateState_, fenceData.needFlush_, fenceData.layers, fenceData.fences); DISPLAY_CHK_RETURN(ret != HDF_SUCCESS, ret, HDF_LOGE("%{public}s: OnReplyCommit failed unpackCmd=%{public}s", __func__, CmdUtils::CommandToString(unpackCmd))); -- Gitee From a41ee7348a877652190103c7c31b3d0dbb99d1e3 Mon Sep 17 00:00:00 2001 From: yangkan Date: Mon, 15 Apr 2024 08:25:28 +0000 Subject: [PATCH 196/210] update display/composer/v1_2/display_command/display_cmd_requester.h. Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_requester.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_requester.h b/display/composer/v1_2/display_command/display_cmd_requester.h index 8b3670ac..4ec0b9e2 100644 --- a/display/composer/v1_2/display_command/display_cmd_requester.h +++ b/display/composer/v1_2/display_command/display_cmd_requester.h @@ -48,7 +48,7 @@ public: } int32_t CommitAndGetReleaseFence(uint32_t devId, int32_t &fence, bool isSupportSkipValidate, - int32_t &skipState, bool &needFlush) + int32_t &skipState, bool &needFlush, std::vector& layers, std::vector& fences) { uint32_t replyEleCnt = 0; std::vector outFds; -- Gitee From df6c143dd125c6786db40846bc461f14b0347e47 Mon Sep 17 00:00:00 2001 From: fan-jingle Date: Mon, 8 Apr 2024 16:52:41 +0800 Subject: [PATCH 197/210] fix: RegisterBuffer Signed-off-by: fan-jingle --- .../display_command/display_cmd_responser.h | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/display/composer/v1_0/display_command/display_cmd_responser.h b/display/composer/v1_0/display_command/display_cmd_responser.h index ac06c53b..a37a3ed3 100755 --- a/display/composer/v1_0/display_command/display_cmd_responser.h +++ b/display/composer/v1_0/display_command/display_cmd_responser.h @@ -39,6 +39,8 @@ #include "parameter.h" #include "v1_0/display_composer_type.h" #include "v1_0/mapper_stub.h" +#include "v1_1/imetadata.h" + #define DISPLAY_TRACE HdfTrace trace(__func__, "HDI:DISP:") @@ -378,7 +380,11 @@ EXIT: HDF_LOGE("%{public}s, FileDescriptorUnpack error", __func__); return HDF_FAILURE; } - + if (data.buffer != nullptr) { + int32_t ret = RegisterBuffer(data.buffer); + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != DISPLAY_NOT_SUPPORT, HDF_FAILURE, + HDF_LOGE("%{public}s, RegisterBuffer error", __func__)); + } return HDF_SUCCESS; } @@ -757,7 +763,7 @@ EXIT: BufferHandle *buffer; } LayerBufferData; - int32_t UnPackLayerBufferInfo(std::shared_ptr unpacker, const std::vector& inFds, + int32_t UnPackLayerBufferInfo(std::shared_ptr unpacker, const std::vector& inFds, struct LayerBufferData *data, std::vector &deletingList) { DISPLAY_CHK_RETURN(HDF_SUCCESS != CmdUtils::SetupDeviceUnpack(unpacker, data->devId, data->layerId), @@ -773,7 +779,11 @@ EXIT: DISPLAY_CHK_RETURN(HDF_SUCCESS != CmdUtils::FileDescriptorUnpack(unpacker, inFds, data->fence), HDF_FAILURE, HDF_LOGE("%{public}s, FileDescriptorUnpack error", __func__)); - + if (data->buffer != nullptr) { + int32_t ret = RegisterBuffer(data->buffer); + DISPLAY_CHK_RETURN(ret != HDF_SUCCESS && ret != DISPLAY_NOT_SUPPORT, HDF_FAILURE, + HDF_LOGE("%{public}s, RegisterBuffer error", __func__)); + } // unpack deletingList uint32_t vectSize = 0; DISPLAY_CHK_RETURN(true != unpacker->ReadUint32(vectSize), HDF_FAILURE, @@ -1060,6 +1070,33 @@ EXIT: } protected: + static sptr GetMetaService() + { + static sptr metaService_; + if (metaService_ == nullptr) { + metaService_ = Buffer::V1_1::IMetadata::Get(true); + } + return metaService_; + } + + static int32_t RegisterBuffer(BufferHandle* buffer) + { + auto metaService = GetMetaService(); + if (metaService == nullptr) { + return HDF_FAILURE; + } + + sptr hdiBuffer = new NativeBuffer(); + if (hdiBuffer == nullptr) { + HDF_LOGE("new NativeBuffer() failed"); + return HDF_FAILURE; + } + hdiBuffer->SetBufferHandle(buffer, false); + int32_t ret = metaService->RegisterBuffer(hdiBuffer); + HDF_LOGI("RegisterBuffer return %{public}d", ret); + return ret; + } + VdiImpl* impl_ = nullptr; std::shared_ptr cacheMgr_; std::shared_ptr request_; -- Gitee From bc527bc30c5231ac5217db542aa3e84aef1468d6 Mon Sep 17 00:00:00 2001 From: zhanghang133 Date: Sat, 13 Apr 2024 15:40:04 +0800 Subject: [PATCH 198/210] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9TAG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanghang133 --- camera/metadata/include/camera_device_ability_items.h | 10 +++++++++- camera/metadata/include/camera_metadata_item_info.h | 3 +++ camera/metadata/src/camera_metadata_info.cpp | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 7b25b949..0399f7e7 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -116,6 +116,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_FLASH_SUGGESTION_SUPPORTED, OHOS_CONTROL_FLASH_SUGGESTION_SWITCH, OHOS_STATUS_FLASH_SUGGESTION, + OHOS_ABILITY_HIGH_QUALITY_SUPPORT, OHOS_CAMERA_PROPERTIES_END, OHOS_SENSOR_EXPOSURE_TIME = OHOS_CAMERA_SENSOR_START, @@ -186,6 +187,7 @@ typedef enum camera_device_metadata_tag { OHOS_CONTROL_MOVING_PHOTO, OHOS_ABILITY_SENSOR_WB_VALUES, OHOS_CONTROL_SENSOR_WB_VALUE, + OHOS_CONTROL_HIGH_QUALITY_MODE, OHOS_DEVICE_CONTROL_END, // Camera device image acquisition related @@ -677,10 +679,16 @@ typedef enum camera_flash_suggestion_surported_enum { OHOS_CAMERA_FLASH_SUGGESTION_SUPPORTED_OPEN, } camera_flash_suggestion_surported_enum_t; -// ABILITY_SUPPORTED_TAGS enumeration values enumeration values +// ABILITY_SUPPORTED_TAGS enumeration values typedef enum camera_supported_enum { OHOS_CAMERA_NOT_SUPPORTED = 0, OHOS_CAMERA_SUPPORTED, } camera_supported_enum_t; +// OHOS_CONTROL_HIGH_QUALITY_MODE +typedef enum ControlHighQualityModeEnum { + OHOS_CONTROL_HIGH_QUALITY_MODE_OFF = 0, + OHOS_CONTROL_HIGH_QUALITY_MODE_ON, +} ControlHighQualityModeEnumT; + #endif diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index 56599cf6..fe6dda5b 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -94,6 +94,8 @@ static item_info_t g_ohosCameraProperties[OHOS_CAMERA_PROPERTIES_END - OHOS_CAME OHOS_CAMERA_PROPERTIES_START] = {"cameraControlFlashSuggestionSwitch", META_TYPE_BYTE, 1}, [OHOS_STATUS_FLASH_SUGGESTION - OHOS_CAMERA_PROPERTIES_START] = {"cameraStatusFlashSuggestion", META_TYPE_UINT32, 1}, + [OHOS_ABILITY_HIGH_QUALITY_SUPPORT - + OHOS_CAMERA_PROPERTIES_START] = {"cameraAbilityHighQualitySupport", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosCameraSensor[OHOS_CAMERA_SENSOR_END - OHOS_CAMERA_SENSOR_START] = { @@ -188,6 +190,7 @@ static item_info_t g_ohosCameraControl[OHOS_DEVICE_CONTROL_END - OHOS_DEVICE_CON [OHOS_ABILITY_SENSOR_WB_VALUES - OHOS_DEVICE_CONTROL_START] = {"supportedSensorWbValues", META_TYPE_INT32, -1}, [OHOS_CONTROL_SENSOR_WB_VALUE - OHOS_DEVICE_CONTROL_START] = {"sensorWbValue", META_TYPE_INT32, 1}, + [OHOS_CONTROL_HIGH_QUALITY_MODE - OHOS_DEVICE_CONTROL_START] = {"highQualityMode", META_TYPE_BYTE, 1}, }; static item_info_t g_ohosDeviceExposure[OHOS_DEVICE_EXPOSURE_END - OHOS_DEVICE_EXPOSURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 9d0c432d..2afa5720 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -48,6 +48,7 @@ const std::vector g_metadataTags = { OHOS_ABILITY_FLASH_SUGGESTION_SUPPORTED, OHOS_CONTROL_FLASH_SUGGESTION_SWITCH, OHOS_STATUS_FLASH_SUGGESTION, + OHOS_ABILITY_HIGH_QUALITY_SUPPORT, OHOS_SENSOR_EXPOSURE_TIME, OHOS_SENSOR_COLOR_CORRECTION_GAINS, @@ -110,6 +111,7 @@ const std::vector g_metadataTags = { OHOS_CONTROL_MOVING_PHOTO, OHOS_ABILITY_SENSOR_WB_VALUES, OHOS_CONTROL_SENSOR_WB_VALUE, + OHOS_CONTROL_HIGH_QUALITY_MODE, // Camera device image acquisition related OHOS_ABILITY_DEVICE_AVAILABLE_EXPOSUREMODES, -- Gitee From 392784d07d6ad35c6fde542a7b1d05329d460f3e Mon Sep 17 00:00:00 2001 From: maoyong Date: Tue, 16 Apr 2024 10:49:07 +0800 Subject: [PATCH 199/210] fix gn format Signed-off-by: maoyong --- nnrt/v2_1/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nnrt/v2_1/BUILD.gn b/nnrt/v2_1/BUILD.gn index ffd6d042..1cfe5f26 100644 --- a/nnrt/v2_1/BUILD.gn +++ b/nnrt/v2_1/BUILD.gn @@ -25,7 +25,7 @@ hdi("nnrt") { cflags = [ "-fstack-protector-all" ] cflags_cc = [ "-fexceptions", - "-fstack-protector-all" + "-fstack-protector-all", ] language = "cpp" -- Gitee From a2be58176818915427acdc5ccb36492d6f66ab22 Mon Sep 17 00:00:00 2001 From: Bobie Date: Tue, 16 Apr 2024 17:35:57 +0800 Subject: [PATCH 200/210] Maintain the same interface as local audio Signed-off-by: Bobie --- distributed_audio/audio/v1_0/AudioTypes.idl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/distributed_audio/audio/v1_0/AudioTypes.idl b/distributed_audio/audio/v1_0/AudioTypes.idl index e6e4231e..64ff19f4 100644 --- a/distributed_audio/audio/v1_0/AudioTypes.idl +++ b/distributed_audio/audio/v1_0/AudioTypes.idl @@ -73,6 +73,11 @@ enum AudioCategory { AUDIO_IN_RINGTONE = 2, /**< Ringtone */ AUDIO_IN_CALL = 3, /**< Call */ AUDIO_MMAP_NOIRQ = 4, /**< Mmap mode */ + AUDIO_OFFLOAD = 5, /**< Offload */ + AUDIO_MULTI_CHANNEL = 6, /**< Multi channel */ + AUDIO_DP = 7, /**< Audio dp */ + AUDIO_MMAP_VOIP = 8, /**< Audio voip */ + AUDIO_IN_NAVIGATION = 9, /**< Audio navigation */ }; /** -- Gitee From 9bd9eb38bc0e63677a18df0eff1d3729827ea2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=98=E4=B8=98?= Date: Wed, 17 Apr 2024 02:14:51 +0000 Subject: [PATCH 201/210] update drm/v1_0/IMediaKeySystemFactory.idl. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王丘丘 --- drm/v1_0/IMediaKeySystemFactory.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drm/v1_0/IMediaKeySystemFactory.idl b/drm/v1_0/IMediaKeySystemFactory.idl index 20cbe3d9..84824a5c 100644 --- a/drm/v1_0/IMediaKeySystemFactory.idl +++ b/drm/v1_0/IMediaKeySystemFactory.idl @@ -46,5 +46,5 @@ interface IMediaKeySystemFactory { * @since 5.0 * @version 1.0 */ - GetMediaKeySystemName([out] String name, [out] String uuid); + GetMediaKeySystemDescription([out] String name, [out] String uuid); }; -- Gitee From d9e48a8c8c500fdb891c49b8343bbd00278a18bf Mon Sep 17 00:00:00 2001 From: zhouge Date: Wed, 17 Apr 2024 21:43:53 +0800 Subject: [PATCH 202/210] add secure camera mode Signed-off-by: zhouge --- camera/v1_3/ICameraDevice.idl | 13 +++++++++++++ camera/v1_3/ICameraHost.idl | 18 ++++++++++++++++++ camera/v1_3/Types.idl | 7 +++++++ 3 files changed, 38 insertions(+) diff --git a/camera/v1_3/ICameraDevice.idl b/camera/v1_3/ICameraDevice.idl index d7f5da91..fe92417d 100644 --- a/camera/v1_3/ICameraDevice.idl +++ b/camera/v1_3/ICameraDevice.idl @@ -45,4 +45,17 @@ interface ICameraDevice extends ohos.hdi.camera.v1_2.ICameraDevice { * @version 1.3 */ GetStreamOperator_V1_3([in] IStreamOperatorCallback callbackObj, [out] IStreamOperator streamOperator); + + /** + * @brief Obtains the SeqId of the Secure camera. + * + * @param SeqId Indicates the SeqId of the secure camera. If the SeqId equals 0, means not a secure camera. + * + * @return Returns NO_ERROR if the operation is successful; returns an error code defined + * in {@link CamRetCode} otherwise. + * + * @since 5.0 + * @version 1.0 + */ + GetSecureCameraSeq([out] unsigned long SeqId); } diff --git a/camera/v1_3/ICameraHost.idl b/camera/v1_3/ICameraHost.idl index 334eadea..e99b2f45 100644 --- a/camera/v1_3/ICameraHost.idl +++ b/camera/v1_3/ICameraHost.idl @@ -46,4 +46,22 @@ interface ICameraHost extends ohos.hdi.camera.v1_2.ICameraHost { * @version 1.3 */ OpenCamera_V1_3([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); + + /** + * @brief Opens a camera device in secure mode. + * + * By calling this function, you can obtain the ICameraDevice instance and operate the + * specific camera device mapping to the instance. + * + * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}. + * @param callback Indicates the callback related to the camera. For details, see {@link ICameraDeviceCallback}. + * @param device Indicates the ICameraDevice instance corresponding to the ID of the camera device. + * + * @return Returns NO_ERROR if the operation is successful; returns an error code defined + * in {@link CamRetCode} otherwise. + * + * @since 5.0 + * @version 1.0 + */ + OpenSecureCamera([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); } diff --git a/camera/v1_3/Types.idl b/camera/v1_3/Types.idl index bb87df60..1bc9096a 100644 --- a/camera/v1_3/Types.idl +++ b/camera/v1_3/Types.idl @@ -78,6 +78,13 @@ enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { */ HIGH_RESOLUTION_PHOTO = 14, + /** + * Secure mode, which dedicated to secure mode + * @since 5.0 + * @version 1.0 + */ + SECURE = 15, + }; /** -- Gitee From 4fc3f57c30596ab067e8ade41cac1b6073ed0f7c Mon Sep 17 00:00:00 2001 From: liufeng Date: Fri, 19 Apr 2024 14:53:58 +0800 Subject: [PATCH 203/210] =?UTF-8?q?=E4=BF=AE=E6=94=B9camera=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E8=A7=84=E8=8C=83=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufeng --- camera/metadata/src/metadata_utils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index 79ed72df..ea62e3e4 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -633,6 +633,10 @@ static void ReadMetadataRational(camera_metadata_item_t &entry, MessageParcel &d std::vector buffers; data.ReadInt32Vector(&buffers); entry.data.r = new(std::nothrow) camera_rational_t[entry.count]; + if (buffers.size() < 1) { + METADATA_ERR_LOG("ReadMetadataRational the buffers size is 0"); + return; + } if (entry.data.r != nullptr) { for (size_t i = 0, j = 0; i < entry.count && j < static_cast(buffers.size() - 1); -- Gitee From e548d86409f8584645acd36aebcd025c3ffa3507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Fri, 19 Apr 2024 06:58:00 +0000 Subject: [PATCH 204/210] update camera/metadata/src/metadata_utils.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/src/metadata_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index ea62e3e4..4918de4b 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -633,7 +633,7 @@ static void ReadMetadataRational(camera_metadata_item_t &entry, MessageParcel &d std::vector buffers; data.ReadInt32Vector(&buffers); entry.data.r = new(std::nothrow) camera_rational_t[entry.count]; - if (buffers.size() < 1) { + if (buffers.size() == 1) { METADATA_ERR_LOG("ReadMetadataRational the buffers size is 0"); return; } -- Gitee From efad478ac29891f9468364a4e2b3747fb7ac27e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Fri, 19 Apr 2024 06:59:00 +0000 Subject: [PATCH 205/210] update camera/metadata/src/metadata_utils.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- camera/metadata/src/metadata_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/metadata/src/metadata_utils.cpp b/camera/metadata/src/metadata_utils.cpp index 4918de4b..6fe23d2d 100644 --- a/camera/metadata/src/metadata_utils.cpp +++ b/camera/metadata/src/metadata_utils.cpp @@ -633,7 +633,7 @@ static void ReadMetadataRational(camera_metadata_item_t &entry, MessageParcel &d std::vector buffers; data.ReadInt32Vector(&buffers); entry.data.r = new(std::nothrow) camera_rational_t[entry.count]; - if (buffers.size() == 1) { + if (buffers.size() == 0) { METADATA_ERR_LOG("ReadMetadataRational the buffers size is 0"); return; } -- Gitee From ceda93324d8efd6bb48c4cf220470b36ff2a1db7 Mon Sep 17 00:00:00 2001 From: luzhiye Date: Fri, 19 Apr 2024 15:23:34 +0800 Subject: [PATCH 206/210] =?UTF-8?q?=E5=BE=AE=E8=B7=9D=E5=AF=B9=E7=84=A6?= =?UTF-8?q?=E8=B7=9D=E7=A6=BB=E7=BB=9F=E4=B8=80=E5=91=BD=E5=90=8D=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: luzhiye --- camera/metadata/include/camera_device_ability_items.h | 2 +- camera/metadata/include/camera_metadata_item_info.h | 4 ++-- camera/metadata/src/camera_metadata_info.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/camera/metadata/include/camera_device_ability_items.h b/camera/metadata/include/camera_device_ability_items.h index 6c8ffccb..13ef635a 100644 --- a/camera/metadata/include/camera_device_ability_items.h +++ b/camera/metadata/include/camera_device_ability_items.h @@ -212,6 +212,7 @@ typedef enum camera_device_metadata_tag { OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, OHOS_CONTROL_LENS_FOCUS_DISTANCE, OHOS_ABILITY_EQUIVALENT_FOCUS, + OHOS_CONTROL_FOCUS_DISTANCE, OHOS_DEVICE_FOCUS_END, OHOS_ABILITY_DEVICE_AVAILABLE_AWBMODES = OHOS_DEVICE_WHITE_BLANCE_START, @@ -299,7 +300,6 @@ typedef enum camera_device_metadata_tag { OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_ABILITY_CAPTURE_EXPECT_TIME, - OHOS_CONTROL_FOCUS_DISTANCE, OHOS_CAMERA_EFFECT_END, // camera secure related diff --git a/camera/metadata/include/camera_metadata_item_info.h b/camera/metadata/include/camera_metadata_item_info.h index fe6dda5b..9f934364 100644 --- a/camera/metadata/include/camera_metadata_item_info.h +++ b/camera/metadata/include/camera_metadata_item_info.h @@ -222,6 +222,8 @@ static item_info_t g_ohosDeviceFocus[OHOS_DEVICE_FOCUS_END - OHOS_DEVICE_FOCUS_S OHOS_DEVICE_FOCUS_START] = {"lensInfoMinimumFocusDistance", META_TYPE_FLOAT, 1}, [OHOS_CONTROL_LENS_FOCUS_DISTANCE - OHOS_DEVICE_FOCUS_START] = {"lensFocusDistance", META_TYPE_FLOAT, 1}, [OHOS_ABILITY_EQUIVALENT_FOCUS - OHOS_DEVICE_FOCUS_START] = {"equivalentFocus", META_TYPE_INT32, -1}, + [OHOS_CONTROL_FOCUS_DISTANCE - + OHOS_DEVICE_FOCUS_START] = {"controlFocusDistance", META_TYPE_FLOAT, 1}, }; static item_info_t g_ohosDeviceWhite[OHOS_DEVICE_WHITE_BLANCE_END - OHOS_DEVICE_WHITE_BLANCE_START] = { @@ -354,8 +356,6 @@ static item_info_t g_ohosPostProcess[OHOS_CAMERA_EFFECT_END - OHOS_CAMERA_EFFECT OHOS_CAMERA_EFFECT_START] = {"previewPhysicalCameraId", META_TYPE_BYTE, 1}, [OHOS_ABILITY_CAPTURE_EXPECT_TIME - OHOS_CAMERA_EFFECT_START] = {"captureExpectTime", META_TYPE_UINT32, -1}, - [OHOS_CONTROL_FOCUS_DISTANCE - - OHOS_CAMERA_EFFECT_START] = {"macroFocusDistance", META_TYPE_FLOAT, 1}, }; static item_info_t g_ohosCameraSecure[OHOS_CAMERA_SECURE_END - OHOS_CAMERA_SECURE_START] = { diff --git a/camera/metadata/src/camera_metadata_info.cpp b/camera/metadata/src/camera_metadata_info.cpp index 2afa5720..3176e4e8 100644 --- a/camera/metadata/src/camera_metadata_info.cpp +++ b/camera/metadata/src/camera_metadata_info.cpp @@ -130,6 +130,7 @@ const std::vector g_metadataTags = { OHOS_ABILITY_LENS_INFO_MINIMUM_FOCUS_DISTANCE, OHOS_CONTROL_LENS_FOCUS_DISTANCE, OHOS_ABILITY_EQUIVALENT_FOCUS, + OHOS_CONTROL_FOCUS_DISTANCE, OHOS_ABILITY_DEVICE_AVAILABLE_FLASHMODES, OHOS_CONTROL_FLASHMODE, @@ -200,7 +201,6 @@ const std::vector g_metadataTags = { OHOS_STATUS_ALGO_MEAN_Y, OHOS_STATUS_PREVIEW_PHYSICAL_CAMERA_ID, OHOS_ABILITY_CAPTURE_EXPECT_TIME, - OHOS_CONTROL_FOCUS_DISTANCE, // camera secure related OHOS_CONTROL_SECURE_FACE_MODE, -- Gitee From 94b149f46b6dde1583313287682d62e74754396d Mon Sep 17 00:00:00 2001 From: yangkan Date: Sat, 20 Apr 2024 15:22:37 +0800 Subject: [PATCH 207/210] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E5=B1=82?= =?UTF-8?q?=E4=BC=A0=E9=80=92=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangkan --- display/composer/v1_2/display_command/display_cmd_responser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/v1_2/display_command/display_cmd_responser.h b/display/composer/v1_2/display_command/display_cmd_responser.h index fb50dd73..df976381 100644 --- a/display/composer/v1_2/display_command/display_cmd_responser.h +++ b/display/composer/v1_2/display_command/display_cmd_responser.h @@ -169,7 +169,7 @@ public: HDF_LOGE("%{public}s, write layers.size error", __func__)); for (uint32_t i = 0; i < vectSize; i++) { - DISPLAY_CHECK(replyPacker_->WriteUint32(compLayers[i]) == false, + DISPLAY_CHECK(replyPacker_->WriteUint32(layers[i]) == false, HDF_LOGE("%{public}s, write layers error", __func__)); } -- Gitee From 06921da96ad4a794833139ea7fa8e5f5cca5105e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=96=87=E9=BE=99?= Date: Mon, 22 Apr 2024 16:36:03 +0800 Subject: [PATCH 208/210] =?UTF-8?q?fix=EF=BC=9A=E5=88=A0=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李文龙 --- location/geofence/v2_0/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/location/geofence/v2_0/BUILD.gn b/location/geofence/v2_0/BUILD.gn index 0b4f3273..dece9c13 100644 --- a/location/geofence/v2_0/BUILD.gn +++ b/location/geofence/v2_0/BUILD.gn @@ -20,7 +20,6 @@ hdi("location_geofence") { "IGeofenceInterface.idl", ] sequenceable_ext_deps = [ - "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0", "drivers_interface_location_gnss:liblocation_gnss_stub_2.0", "drivers_interface_location_gnss:location_gnss_idl_headers", ] -- Gitee From 0299b82d4ede12d7c345978f1f822a1d628ba139 Mon Sep 17 00:00:00 2001 From: yangkan Date: Tue, 23 Apr 2024 11:40:54 +0800 Subject: [PATCH 209/210] cleancode fix Signed-off-by: yangkan --- display/composer/cache_manager/device_cache_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/display/composer/cache_manager/device_cache_manager.cpp b/display/composer/cache_manager/device_cache_manager.cpp index a9bd3a90..28d94f4b 100644 --- a/display/composer/cache_manager/device_cache_manager.cpp +++ b/display/composer/cache_manager/device_cache_manager.cpp @@ -133,7 +133,7 @@ void DeviceCacheManager::Dump() const HDF_LOGE("********************************"); } -int32_t DeviceCacheManager::AddCacheInternal(uint32_t deviceId, const DeviceCache::DeviceType type) +int32_t DeviceCacheManager::AddCacheInternal(uint32_t deviceId, DeviceCache::DeviceType type) { DeviceCache* device = DeviceCache::Create(deviceId, type); DISPLAY_CHK_RETURN(device == nullptr, HDF_FAILURE, HDF_LOGE("%{public}s: Create cache failed", __func__)); -- Gitee From 398bff9ff8c72ef422d705c1b3fb9fe1826765aa Mon Sep 17 00:00:00 2001 From: yangkan Date: Thu, 25 Apr 2024 16:38:46 +0800 Subject: [PATCH 210/210] fix mem leak Signed-off-by: yangkan --- display/composer/cache_manager/cache_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/display/composer/cache_manager/cache_manager.h b/display/composer/cache_manager/cache_manager.h index 1532299f..d725be49 100644 --- a/display/composer/cache_manager/cache_manager.h +++ b/display/composer/cache_manager/cache_manager.h @@ -80,8 +80,8 @@ public: } } std::lock_guard lock(mutex_); - caches_[id] = std::move(*(new std::unique_ptr(cache))); - + std::unique_ptr ptr(cache); + caches_[id] = std::move(ptr); return true; } -- Gitee