diff --git a/5x/testfive_one.h b/5x/testfive_one.h new file mode 100644 index 0000000000000000000000000000000000000000..7cd225c7a8521d649b66516e9933767f8a747b99 --- /dev/null +++ b/5x/testfive_one.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 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 ArkUI_TestModule + * @{ + * + * @brief this is example. + * @since 1 + */ + +/** + * @file testfive_one.h + * + * @brief this is kit example. + * + * @library example.so + * @kit BetaTest + * @syscap example + * @since 1 + */ +#ifndef EXAMPLE_H +#define EXAMPLE_H +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief the method example Test_Func1742453909616. + * + * @since 1 + */ +void Test_Func1742453909616(); +#ifdef __cplusplus +} +#endif +#endif // EXAMPLE_H + +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/ffrt.h b/6x/testsix_one.h similarity index 56% rename from resourceschedule/ffrt/ffrt.h rename to 6x/testsix_one.h index 32a4ccf54238998d93b9a02de53230f29151a4a0..b6a124c28a82f34f85e028c5db36aea26e50acc5 100644 --- a/resourceschedule/ffrt/ffrt.h +++ b/6x/testsix_one.h @@ -1,32 +1,50 @@ -/* - * 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. - */ -#ifndef FFRT_API_FFRT_H -#define FFRT_API_FFRT_H -#ifdef __cplusplus -#include "cpp/task.h" -#include "cpp/mutex.h" -#include "cpp/condition_variable.h" -#include "cpp/sleep.h" -#include "cpp/queue.h" -#include "c/timer.h" -#else -#include "c/task.h" -#include "c/mutex.h" -#include "c/condition_variable.h" -#include "c/sleep.h" -#include "c/queue.h" -#include "c/timer.h" -#endif -#endif +/* + * Copyright (c) 2025 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 ArkUI_TestModule + * @{ + * + * @brief this is example. + * @since 1 + */ + +/** + * @file testsix_one.h + * + * @brief this is kit example. + * + * @library example.so + * @kit Test6x + * @syscap example + * @since 1 + */ +#ifndef EXAMPLE_H +#define EXAMPLE_H +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief the method updated. + * + * @since 1 + */ +void Test_Func6x_01(); +#ifdef __cplusplus +} +#endif +#endif // EXAMPLE_H + +/** @} */ \ No newline at end of file diff --git a/tee/BUILD.gn b/AbilityKit/ability_base/BUILD.gn similarity index 31% rename from tee/BUILD.gn rename to AbilityKit/ability_base/BUILD.gn index a04ca0b3a023bf1ae7cfd22ce4e93d2aff99148c..7965528f8de4dbac3e4ef81d9574a772d9461055 100644 --- a/tee/BUILD.gn +++ b/AbilityKit/ability_base/BUILD.gn @@ -12,63 +12,23 @@ # limitations under the License. import("//build/ohos.gni") - -ohos_ndk_library("libteec") { - output_name = "teec" - output_extension = "so" - ndk_description_file = "./libteec.ndk.json" - min_compact_version = "12" - system_capability = "SystemCapability.Tee.TeeClient" - system_capability_headers = [ - "./include/tee_client_api.h", - "./include/tee_client_constants.h", - "./include/tee_client_type.h", - ] -} - -ohos_ndk_headers("libtee_header") { - dest_dir = "$ndk_headers_out_dir/tee" +import("//build/ohos/ndk/ndk.gni") +ohos_ndk_headers("ability_base_want_ndk_header") { + dest_dir = "$ndk_headers_out_dir/AbilityKit/ability_base" sources = [ - "./include/oemkey.h", - "./include/rpmb_driver_rw_api.h", - "./include/rpmb_fcntl.h", - "./include/tee_arith_api.h", - "./include/tee_core_api.h", - "./include/tee_crypto_api.h", - "./include/tee_crypto_hal.h", - "./include/tee_defines.h", - "./include/tee_drv_client.h", - "./include/tee_dynamic_srv.h", - "./include/tee_ext_api.h", - "./include/tee_hw_ext_api.h", - "./include/tee_hw_ext_api_legacy.h", - "./include/tee_internal_se_api.h", - "./include/tee_log.h", - "./include/tee_mem_mgmt_api.h", - "./include/tee_mem_monitoring_api.h", - "./include/tee_object_api.h", - "./include/tee_property_api.h", - "./include/tee_rtc_time_api.h", - "./include/tee_service_public.h", - "./include/tee_sharemem_ops.h", - "./include/tee_time_api.h", - "./include/tee_trusted_storage_api.h", - "./include/tee_tui_gp_api.h", + "./ability_base_common.h", + "./want.h", ] } -ohos_ndk_headers("libteec_header") { - dest_dir = "$ndk_headers_out_dir/tee_client" - sources = [ - "./include/tee_client_api.h", - "./include/tee_client_constants.h", - "./include/tee_client_type.h", - ] -} - -group("tee_ndk_header") { - deps = [ - ":libtee_header", - ":libteec_header", +ohos_ndk_library("libability_base_want") { + output_name = "ability_base_want" + output_extension = "so" + system_capability = "SystemCapability.Ability.AbilityBase" + ndk_description_file = "./libability_base_want.json" + min_compact_version = "15" + system_capability_headers = [ + "AbilityKit/ability_base/ability_base_common.h", + "AbilityKit/ability_base/want.h", ] } diff --git a/tee/include/pthread_attr.h b/AbilityKit/ability_base/ability_base_common.h similarity index 42% rename from tee/include/pthread_attr.h rename to AbilityKit/ability_base/ability_base_common.h index d7753593dc218049d192a82b3582e91b02f84471..382f72910a8e1e0dba43f6f4224cf9c5ea6e3970 100644 --- a/tee/include/pthread_attr.h +++ b/AbilityKit/ability_base/ability_base_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 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 @@ -13,40 +13,49 @@ * limitations under the License. */ -#ifndef PTHREAD_ATTR_H -#define PTHREAD_ATTR_H /** - * @addtogroup TeeTrusted + * @addtogroup AbilityBase * @{ * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. + * @brief Provide the definition of the C interface for the native AbilityBase * - * @since 12 + * @syscap SystemCapability.Ability.AbilityBase + * @since 15 */ /** - * @file pthread_attr.h + * @file ability_base_common.h * - * @brief Provides the attr about TA multi-thread. + * @brief Declare the common types for the native AbilityBase. * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 + * @library libability_base_want.so + * @kit AbilityKit + * @syscap SystemCapability.Ability.AbilityBase + * @since 15 */ -#define TEESMP_THREAD_ATTR_CA_WILDCARD 0 +#ifndef ABILITY_BASE_COMMON_H +#define ABILITY_BASE_COMMON_H -#define TEESMP_THREAD_ATTR_CA_INHERIT (-1U) +#ifdef __cplusplus +extern "C" { +#endif -#define TEESMP_THREAD_ATTR_TASK_ID_INHERIT (-1U) - -#define TEESMP_THREAD_ATTR_HAS_SHADOW 0x1 +/** + * @brief Enumerates the error codes. + * + * @since 15 + */ +typedef enum { + /** @error No error. */ + ABILITY_BASE_ERROR_CODE_NO_ERROR = 0, + /** @error Invalid parameters. */ + ABILITY_BASE_ERROR_CODE_PARAM_INVALID = 401, +} AbilityBase_ErrorCode; -#define TEESMP_THREAD_ATTR_NO_SHADOW 0x0 +#ifdef __cplusplus +} +#endif /** @} */ -#endif \ No newline at end of file +#endif // ABILITY_BASE_COMMON_H diff --git a/AbilityKit/ability_base/libability_base_want.json b/AbilityKit/ability_base/libability_base_want.json new file mode 100644 index 0000000000000000000000000000000000000000..03133ce9184f429df9ec3fc7b412b27df94ab10f --- /dev/null +++ b/AbilityKit/ability_base/libability_base_want.json @@ -0,0 +1,66 @@ +[ + { + "first_introduced": "15", + "name": "OH_AbilityBase_CreateWant" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_DestroyWant" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_SetWantElement" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_GetWantElement" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_SetWantCharParam" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_GetWantCharParam" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_AddWantFd" + }, + { + "first_introduced": "15", + "name": "OH_AbilityBase_GetWantFd" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_SetWantUri" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_GetWantUri" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_SetWantInt32Param" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_GetWantInt32Param" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_SetWantBoolParam" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_GetWantBoolParam" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_SetWantDoubleParam" + }, + { + "first_introduced": "18", + "name": "OH_AbilityBase_GetWantDoubleParam" + } +] \ No newline at end of file diff --git a/AbilityKit/ability_base/want.h b/AbilityKit/ability_base/want.h new file mode 100644 index 0000000000000000000000000000000000000000..e688836ec681e9ca2d66da0424513bf1d458a135 --- /dev/null +++ b/AbilityKit/ability_base/want.h @@ -0,0 +1,272 @@ +/* + * 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 AbilityBase + * @{ + * + * @brief Describe the functions of want. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 15 + */ + +/** + * @file want.h + * + * @brief Defines the want APIs. + * + * @library libability_base_want.so + * @kit AbilityKit + * @syscap SystemCapability.Ability.AbilityBase + * @since 15 + */ + +#ifndef ABILITY_BASE_WANT_H +#define ABILITY_BASE_WANT_H + +#include +#include +#include "ability_base_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Indicates information of element. + * + * @since 15 + */ +typedef struct AbilityBase_Element { + /** Indicates the name of application. */ + char* bundleName; + /** Indicates the name of module. */ + char* moduleName; + /** Indicates the name of ability. */ + char* abilityName; +} AbilityBase_Element; + +struct AbilityBase_Want; +typedef struct AbilityBase_Want AbilityBase_Want; + +/** + * @brief Create want. + * + * @param element Information of element. + * @return Returns the newly created AbilityBase_Want object. + * + * @since 15 + */ +AbilityBase_Want* OH_AbilityBase_CreateWant(AbilityBase_Element element); + +/** + * @brief Destroy input want. + * + * @param want The want to be deleted. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the want is invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_DestroyWant(AbilityBase_Want* want); + +/** + * @brief Set want element. + * + * @param want The want that needs to be set element. + * @param element Information of element. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the want is invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantElement(AbilityBase_Want* want, AbilityBase_Element element); + +/** + * @brief Get want element. + * + * @param want The want for the element that has been obtained. + * @param element The element obtained from want. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the want or element is invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantElement(AbilityBase_Want* want, AbilityBase_Element* element); + +/** + * @brief Set want char param. + * + * @param want The want needs to be set char param. + * @param key The key of char param. + * @param value The value of char param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantCharParam(AbilityBase_Want* want, const char* key, const char* value); + +/** + * @brief Get want char param. + * + * @param want The want for the char param that has been obtained. + * @param key The key of char param. + * @param value The value of char param. + * @param valueSize Size of the value. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantCharParam(AbilityBase_Want* want, const char* key, + char* value, size_t valueSize); + +/** + * @brief Add fd to want. + * + * @param want The want needs to be add fd. + * @param key The key of the fd. + * @param fd File Descriptor. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_AddWantFd(AbilityBase_Want* want, const char* key, int32_t fd); + +/** + * @brief Get fd from want. + * + * @param want The want that includes fd. + * @param key The key of the fd. + * @param fd File Descriptor. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 15 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantFd(AbilityBase_Want* want, const char* key, int32_t* fd); + +/** + * @brief Set uri to want. + * + * @param want The want needs to set uri. + * @param uri The uri of the want. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantUri(AbilityBase_Want* want, const char* uri); + +/** + * @brief Get uri from want. + * + * @param want The want that includes uri. + * @param uri The uri of the want. + * @param uriSize Size of the uri. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantUri(AbilityBase_Want* want, char* uri, size_t uriSize); + +/** + * @brief Set int32_t to want. + * + * @param want The want needs to set int32_t value. + * @param key The key of int32_t param. + * @param value The value of int32_t param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantInt32Param(AbilityBase_Want* want, const char* key, int32_t value); + +/** + * @brief Get int32_t from want. + * + * @param want The want includes int32_t value. + * @param key The key of int32_t param. + * @param value The value of int32_t param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantInt32Param(AbilityBase_Want* want, const char* key, int32_t* value); + +/** + * @brief Set bool to want. + * + * @param want The want needs to set bool value. + * @param key The key of bool param. + * @param value The value of bool param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantBoolParam(AbilityBase_Want* want, const char* key, bool value); + +/** + * @brief Get bool from want. + * + * @param want The want needs to set bool value. + * @param key The key of bool param. + * @param value The value of bool param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantBoolParam(AbilityBase_Want* want, const char* key, bool* value); + +/** + * @brief Set double to want. + * + * @param want The want needs to set double value. + * @param key The key of double param. + * @param value The value of double param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_SetWantDoubleParam(AbilityBase_Want* want, const char* key, double value); + +/** + * @brief Get double from want. + * + * @param want The want needs to set double value. + * @param key The key of double param. + * @param value The value of double param. + * @return The error code. + * {@link ABILITY_BASE_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_BASE_ERROR_CODE_PARAM_INVALID} if the input parameters are invalid. + * @since 18 + */ +AbilityBase_ErrorCode OH_AbilityBase_GetWantDoubleParam(AbilityBase_Want* want, const char* key, double* value); + +#ifdef __cplusplus +} // extern "C" +#endif + +/** @} */ +#endif // ABILITY_BASE_WANT_H diff --git a/AbilityKit/ability_runtime/ability_runtime_common.h b/AbilityKit/ability_runtime/ability_runtime_common.h index e4cf556e420be527795b10ebbf0e6ec30bad72da..8870470f7d857101d573ec74fa9b7575e8bc60e5 100644 --- a/AbilityKit/ability_runtime/ability_runtime_common.h +++ b/AbilityKit/ability_runtime/ability_runtime_common.h @@ -49,10 +49,65 @@ extern "C" { typedef enum { /** @error No error. */ ABILITY_RUNTIME_ERROR_CODE_NO_ERROR = 0, + /** + * @error permission denied. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED = 201, /** @error Invalid parameters. */ ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID = 401, + /** + * @error StartSelfUIAbility is not supported. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED = 801, + /** + * @error No such ability. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY = 16000001, + /** + * @error Incorrect ability type. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE = 16000002, + /** + * @error The crowdtesting application expires. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED = 16000008, + /** + * @error The ability cannot be started in Wukong Mode. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE = 16000009, /** @error The context does not exist. */ ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST = 16000011, + /** + * @error The app is controlled. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_CONTROLLED = 16000012, + /** + * @error The app is controlled by EDM. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED = 16000013, + /** + * @error Cross-app start is not allowed. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_CROSS_APP = 16000018, + /** + * @error Internal error. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_INTERNAL = 16000050, + /** + * @error Not top ability. + * @since 15 + */ + ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY = 16000053, } AbilityRuntime_ErrorCode; #ifdef __cplusplus diff --git a/AbilityKit/ability_runtime/application_context.h b/AbilityKit/ability_runtime/application_context.h index 1ba53503d9f1b6ace7fece3f3d6e004221835186..7751647d3629ae04ca904c34d8f2497fea6719ce 100644 --- a/AbilityKit/ability_runtime/application_context.h +++ b/AbilityKit/ability_runtime/application_context.h @@ -39,6 +39,7 @@ #include #include +#include #include "ability_runtime_common.h" #include "context_constant.h" @@ -92,6 +93,149 @@ AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetAreaMode(Ability AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleName( char* buffer, int32_t bufferSize, int32_t* writeLength); +/** + * @brief Obtain the temp directory of the application. + * + * @param buffer A pointer to a buffer that receives the temp directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetTempDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the files directory of the application. + * + * @param buffer A pointer to a buffer that receives the files directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the database directory of the application. + * + * @param buffer A pointer to a buffer that receives the database directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDatabaseDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the preferences directory of the application. + * + * @param buffer A pointer to a buffer that receives the preferences directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetPreferencesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the bundle code directory of the application. + * + * @param buffer A pointer to a buffer that receives the bundle code directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetBundleCodeDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the distributed files directory of the application. + * + * @param buffer A pointer to a buffer that receives the distributed files directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Obtain the cloud file directory of the application. + * + * @param buffer A pointer to a buffer that receives the cloud file directory of the application. + * @param bufferSize The length of the buffer. + * @param writeLength The string length actually written to the buffer, + * when returning {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR}. + * @return The error code. + * {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the buffer or writeLength is null, + * or the buffer size is less than the minimum buffer size. + * {@link ABILITY_RUNTIME_ERROR_CODE_CONTEXT_NOT_EXIST} if the application context does not exist. + * @since 18 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_ApplicationContextGetCloudFileDir( + char* buffer, const int32_t bufferSize, int32_t* writeLength); + +/** + * @brief Starts self UIAbility. + * + * @permission {@code ohos.permission.NDK_START_SELF_UI_ABILITY} + * @param want The arguments passed to start self UIAbility. + * For details, see {@link AbilityBase_Want}. + * @return Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_ERROR} if the call is successful. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_PERMISSION_DENIED} if the caller has no correct permission. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_PARAM_INVALID} if the arguments provided is invalid. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_SUPPORTED} if the device does not support starting self uiability. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NO_SUCH_ABILITY} if the target ability does not exist. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INCORRECT_ABILITY_TYPE} if the ability type is incorrect. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROWDTEST_EXPIRED} if the crowdtesting application expires. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_WUKONG_MODE} if the ability cannot be started in Wukong mode. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CONTROLLED} if the app is controlled. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_EDM_CONTROLLED} if the app is controlled by EDM. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_CROSS_APP} if the caller tries to start a different application. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_INTERNAL} if internal error occurs. + * Returns {@link ABILITY_RUNTIME_ERROR_CODE_NOT_TOP_ABILITY} if the caller is not top ability. + * For details, see {@link AbilityRuntime_ErrorCode}. + * @since 15 + */ +AbilityRuntime_ErrorCode OH_AbilityRuntime_StartSelfUIAbility(AbilityBase_Want *want); + #ifdef __cplusplus } // extern "C" #endif diff --git a/AbilityKit/ability_runtime/libability_runtime.ndk.json b/AbilityKit/ability_runtime/libability_runtime.ndk.json index 239f84f6151aab58f4d1fd3177870b80af428f59..90182407ae99b3e1c07334820c56d68584d9fd30 100644 --- a/AbilityKit/ability_runtime/libability_runtime.ndk.json +++ b/AbilityKit/ability_runtime/libability_runtime.ndk.json @@ -10,5 +10,37 @@ { "first_introduced": "13", "name": "OH_AbilityRuntime_ApplicationContextGetBundleName" + }, + { + "first_introduced": "15", + "name": "OH_AbilityRuntime_StartSelfUIAbility" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetTempDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetFilesDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetDatabaseDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetPreferencesDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetBundleCodeDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetDistributedFilesDir" + }, + { + "first_introduced": "18", + "name": "OH_AbilityRuntime_ApplicationContextGetCloudFileDir" } ] \ No newline at end of file diff --git a/BasicServicesKit/commonevent/libcommonevent.ndk.json b/BasicServicesKit/commonevent/libcommonevent.ndk.json index 40ddccdfe88e4c25f5c538caef903e240f963f44..e2becf3e42a28b118a2ace662d8670d394a874a3 100644 --- a/BasicServicesKit/commonevent/libcommonevent.ndk.json +++ b/BasicServicesKit/commonevent/libcommonevent.ndk.json @@ -94,5 +94,125 @@ { "first_introduced": "12", "name":"OH_CommonEvent_GetDoubleArrayFromParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_CreatePublishInfo" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_DestroyPublishInfo" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetPublishInfoBundleName" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetPublishInfoPermissions" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetPublishInfoCode" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetPublishInfoData" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetPublishInfoParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_CreateParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_DestroyParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetIntToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetIntArrayToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetLongToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetLongArrayToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetBoolToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetBoolArrayToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetCharToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetCharArrayToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetDoubleToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetDoubleArrayToParameters" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_Publish" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_PublishWithInfo" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_IsOrderedCommonEvent" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_FinishCommonEvent" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_GetAbortCommonEvent" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_AbortCommonEvent" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_ClearAbortCommonEvent" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_GetCodeFromSubscriber" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetCodeToSubscriber" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_GetDataFromSubscriber" + }, + { + "first_introduced": "18", + "name":"OH_CommonEvent_SetDataToSubscriber" } ] diff --git a/BasicServicesKit/commonevent/oh_commonevent.h b/BasicServicesKit/commonevent/oh_commonevent.h index 695328b66caaab89d6d9c6ef1a757f410f15c737..a5b93c49881419da14aceea3f13abb2552f8721e 100644 --- a/BasicServicesKit/commonevent/oh_commonevent.h +++ b/BasicServicesKit/commonevent/oh_commonevent.h @@ -36,6 +36,7 @@ #ifndef OH_COMMONEVENT_H #define OH_COMMONEVENT_H +#include #include #ifdef __cplusplus @@ -58,12 +59,18 @@ typedef enum CommonEvent_ErrCode { /** @error invalid input parameter. */ COMMONEVENT_ERR_INVALID_PARAMETER = 401, + /** @error the application cannot send system common events. */ + COMMONEVENT_ERR_NOT_SYSTEM_SERVICE = 1500004, + /** @error IPC request failed to send. */ COMMONEVENT_ERR_SENDING_REQUEST_FAILED = 1500007, /** @error Common event service not init. */ COMMONEVENT_ERR_INIT_UNDONE = 1500008, + /** @error Failed to obtain system parameters. */ + COMMONEVENT_ERR_OBTAIN_SYSTEM_PARAMS = 1500009, + /** @error The subscriber number exceed system specification */ COMMONEVENT_ERR_SUBSCRIBER_NUM_EXCEEDED = 1500010, @@ -85,6 +92,13 @@ typedef struct CommonEvent_SubscribeInfo CommonEvent_SubscribeInfo; */ typedef void CommonEvent_Subscriber; +/** + * @brief the common event publish information containing content and attributes of the common event + * + * @since 18 + */ +typedef struct CommonEvent_PublishInfo CommonEvent_PublishInfo; + /** * @brief the data of the commonEvent callback * @@ -118,10 +132,10 @@ typedef void (*CommonEvent_ReceiveCallback)(const CommonEvent_RcvData *data); CommonEvent_SubscribeInfo* OH_CommonEvent_CreateSubscribeInfo(const char* events[], int32_t eventsNum); /** - * @brief Set the subscribe information of permission. + * @brief Set the permission of the subscribe information. * - * @param info Indicates the subscribed events. - * @param permission Indicates the subscribed events of number. + * @param info Indicates the subscribe information. + * @param permission Indicates the permission. * @return Returns the error code. * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. @@ -130,10 +144,10 @@ CommonEvent_SubscribeInfo* OH_CommonEvent_CreateSubscribeInfo(const char* events CommonEvent_ErrCode OH_CommonEvent_SetPublisherPermission(CommonEvent_SubscribeInfo* info, const char* permission); /** - * @brief Set the subscribe information of bundleName. + * @brief Set the bundleName of the subscribe information. * * @param info Indicates the subscribed events. - * @param bundleName Indicates the subscribed events of number. + * @param bundleName Indicates the bundleName. * @return Returns the error code. * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. @@ -199,7 +213,7 @@ CommonEvent_ErrCode OH_CommonEvent_UnSubscribe(const CommonEvent_Subscriber* sub /** * @brief Get event name from callback data. * - * @param rcvData Indicates the event of callback data. + * @param rcvData Indicates the callback data. * @return Returns the event name. * @since 12 */ @@ -208,7 +222,7 @@ const char* OH_CommonEvent_GetEventFromRcvData(const CommonEvent_RcvData* rcvDat /** * @brief Get event result code from callback data. * - * @param rcvData Indicates the event of callback data. + * @param rcvData Indicates the callback data. * @return Returns the event of result code, default is 0. * @since 12 */ @@ -217,7 +231,7 @@ int32_t OH_CommonEvent_GetCodeFromRcvData(const CommonEvent_RcvData* rcvData); /** * @brief Get event result data from callback data. * - * @param rcvData Indicates the event of callback data. + * @param rcvData Indicates the callback data. * @return Returns the event of result data, default is null. * @since 12 */ @@ -226,7 +240,7 @@ const char* OH_CommonEvent_GetDataStrFromRcvData(const CommonEvent_RcvData* rcvD /** * @brief Get event bundlename from callback data. * - * @param rcvData Indicates the event of callback data. + * @param rcvData Indicates the callback data. * @return Returns the event of bundlename, default is null. * @since 12 */ @@ -235,17 +249,115 @@ const char* OH_CommonEvent_GetBundleNameFromRcvData(const CommonEvent_RcvData* r /** * @brief Get event parameters data from callback data. * - * @param rcvData Indicates the event of callback data. - * @return Returns the event of parameters data, default is null. + * @param rcvData Indicates the callback data. + * @return Returns the event parameters data, default is null. * @since 12 */ const CommonEvent_Parameters* OH_CommonEvent_GetParametersFromRcvData(const CommonEvent_RcvData* rcvData); /** - * @brief Check whether the parameters contains a key. + * @brief Create a common event publish information. + * + * @param ordered Indicates whether the common event is ordered. + * @return Returns the CommonEvent_PublishInfo, if create failed, returns null. + * @since 18 + */ +CommonEvent_PublishInfo* OH_CommonEvent_CreatePublishInfo(bool ordered); + +/** + * @brief Destroy the common event publish information. + * + * @param info Indicates the publish information. + * @since 18 + */ +void OH_CommonEvent_DestroyPublishInfo(CommonEvent_PublishInfo* info); + +/** + * @brief Set the bundleName of publish information. + * + * @param info Indicates the publish information. + * @param bundleName Indicates the bundleName. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetPublishInfoBundleName(CommonEvent_PublishInfo* info, const char* bundleName); + +/** + * @brief Set the permissions of publish information. + * + * @param info Indicates the publish information. + * @param permissions Indicates the array of permissions. + * @param num Indicates the count of permissions. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetPublishInfoPermissions(CommonEvent_PublishInfo* info, + const char* permissions[], int32_t num); + +/** + * @brief Set the code of publish information. + * + * @param info Indicates the publish information. + * @param code Indicates the code. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetPublishInfoCode(CommonEvent_PublishInfo* info, int32_t code); + +/** + * @brief Set the data of publish information. * - * @param rcvData Indicates the event of callback data. - * @param key Indicates the key of parameter. + * @param info Indicates the publish information. + * @param data Indicates the data. + * @param length Indicates the length of data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetPublishInfoData(CommonEvent_PublishInfo* info, + const char* data, size_t length); + +/** + * @brief Set the parameters of publish information. + * + * @param info Indicates the publish information. + * @param param Indicates the parameters. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetPublishInfoParameters(CommonEvent_PublishInfo* info, + CommonEvent_Parameters* param); + +/** + * @brief Create a common event publish information. + * + * @return Returns the CommonEvent_PublishInfo, if create failed, returns null. + * @since 18 + */ +CommonEvent_Parameters* OH_CommonEvent_CreateParameters(); + +/** + * @brief Destroy the common event publish information. + * + * @param param Indicates the publish information. + * @since 18 + */ +void OH_CommonEvent_DestroyParameters(CommonEvent_Parameters* param); + +/** + * @brief Check whether the parameters data contains a key. + * + * @param para Indicates the parameters data. + * @param key Indicates the key. * @return Returns the result of check, true means it contains. * @since 12 */ @@ -254,96 +366,211 @@ bool OH_CommonEvent_HasKeyInParameters(const CommonEvent_Parameters* para, const /** * @brief Get int data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param defaultValue Indicates default return value. * @return Returns the int data of the key in the parameters. * @since 12 */ int OH_CommonEvent_GetIntFromParameters(const CommonEvent_Parameters* para, const char* key, const int defaultValue); +/** + * @brief Set int data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the int data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetIntToParameters(CommonEvent_Parameters* param, const char* key, int value); + /** * @brief Get int array data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param array Indicates the int array. * @return Returns the length of the array. * @since 12 */ int32_t OH_CommonEvent_GetIntArrayFromParameters(const CommonEvent_Parameters* para, const char* key, int** array); +/** + * @brief Set int array data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the int array data. + * @param num Indicates the length of the array. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_ALLOC_MEMORY_FAILED} if a memory allocation error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetIntArrayToParameters(CommonEvent_Parameters* param, const char* key, + const int* value, size_t num); + /** * @brief Get long data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param defaultValue Indicates default return value. * @return Returns the long data of the key in the parameters. * @since 12 */ long OH_CommonEvent_GetLongFromParameters(const CommonEvent_Parameters* para, const char* key, const long defaultValue); +/** + * @brief Set long data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the long data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetLongToParameters(CommonEvent_Parameters* param, const char* key, long value); + /** * @brief Get long array data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param array Indicates the long array. * @return Returns the length of the array. * @since 12 */ int32_t OH_CommonEvent_GetLongArrayFromParameters(const CommonEvent_Parameters* para, const char* key, long** array); +/** + * @brief Set long array data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the long array data. + * @param num Indicates the length of the array. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_ALLOC_MEMORY_FAILED} if a memory allocation error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetLongArrayToParameters(CommonEvent_Parameters* param, const char* key, + const long* value, size_t num); + /** * @brief Get bool data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param defaultValue Indicates default return value. * @return Returns the bool data of the key in the parameters. * @since 12 */ bool OH_CommonEvent_GetBoolFromParameters(const CommonEvent_Parameters* para, const char* key, const bool defaultValue); +/** + * @brief Set bool data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the bool data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetBoolToParameters(CommonEvent_Parameters* param, const char* key, bool value); + /** * @brief Get bool array data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param array Indicates the bool array. * @return Returns the length of the array. * @since 12 */ int32_t OH_CommonEvent_GetBoolArrayFromParameters(const CommonEvent_Parameters* para, const char* key, bool** array); +/** + * @brief Set bool array data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the bool array data. + * @param num Indicates the length of the array. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_ALLOC_MEMORY_FAILED} if a memory allocation error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetBoolArrayToParameters(CommonEvent_Parameters* param, const char* key, + const bool* value, size_t num); + /** * @brief Get char data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param defaultValue Indicates default return value. * @return Returns the char data of the key in the parameters. * @since 12 */ char OH_CommonEvent_GetCharFromParameters(const CommonEvent_Parameters* para, const char* key, const char defaultValue); +/** + * @brief Set char data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the char data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetCharToParameters(CommonEvent_Parameters* param, const char* key, char value); + /** * @brief Get char array data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param array Indicates the char array. * @return Returns the length of the array. * @since 12 */ int32_t OH_CommonEvent_GetCharArrayFromParameters(const CommonEvent_Parameters* para, const char* key, char** array); +/** + * @brief Set char array data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the char array data. + * @param num Indicates the length of the array. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetCharArrayToParameters(CommonEvent_Parameters* param, const char* key, + const char* value, size_t num); + /** * @brief Get double data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param defaultValue Indicates default return value. * @return Returns the double data of the key in the parameters. * @since 12 @@ -351,11 +578,25 @@ int32_t OH_CommonEvent_GetCharArrayFromParameters(const CommonEvent_Parameters* double OH_CommonEvent_GetDoubleFromParameters(const CommonEvent_Parameters* para, const char* key, const double defaultValue); +/** + * @brief Set double data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the double data. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetDoubleToParameters(CommonEvent_Parameters* param, const char* key, + double value); + /** * @brief Get double array data from parameters data by key. * - * @param rcvData Indicates the event of parameters data. - * @param key Indicates the key of parameters data. + * @param para Indicates the parameters data. + * @param key Indicates the key. * @param array Indicates the double array. * @return Returns the length of the array, default is 0. * @since 12 @@ -363,6 +604,133 @@ double OH_CommonEvent_GetDoubleFromParameters(const CommonEvent_Parameters* para int32_t OH_CommonEvent_GetDoubleArrayFromParameters(const CommonEvent_Parameters* para, const char* key, double** array); +/** + * @brief Set double array data to parameters data by key. + * + * @param param Indicates the parameters data. + * @param key Indicates the key. + * @param value Indicates the double array data. + * @param num Indicates the length of the array. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_ALLOC_MEMORY_FAILED} if a memory allocation error occurs. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_SetDoubleArrayToParameters(CommonEvent_Parameters* param, const char* key, + const double* value, size_t num); + +/** + * @brief Publish a standard commen event. + * + * @param event Indicates the name of the common event. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_FAIL_SEND_REQUEST } if IPC request failed to send. + * Returns {@link COMMONEVENT_ERR_INIT_UNDONE } if ces not init done. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_Publish(const char* event); + +/** + * @brief Publish a commen event with specified publish information. + * + * @param event Indicates the name of the common event. + * @param info Indicates the publish information. + * @return Returns the error code. + * Returns {@link COMMONEVENT_ERR_OK} if the operation is successful. + * Returns {@link COMMONEVENT_ERR_INVALID_PARAMETER} if a parameter error occurs. + * Returns {@link COMMONEVENT_ERR_FAIL_SEND_REQUEST } if IPC request failed to send. + * Returns {@link COMMONEVENT_ERR_INIT_UNDONE } if ces not init done. + * @since 18 + */ +CommonEvent_ErrCode OH_CommonEvent_PublishWithInfo(const char* event, const CommonEvent_PublishInfo* info); + +/** + * @brief Check an event by a subscriber whether it is ordered. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result of check, true means ordered. + * @since 18 + */ +bool OH_CommonEvent_IsOrderedCommonEvent(const CommonEvent_Subscriber* subscriber); + +/** + * @brief Finish an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result of operation, true means succeeded. + * @since 18 + */ +bool OH_CommonEvent_FinishCommonEvent(CommonEvent_Subscriber* subscriber); + +/** + * @brief Check an event by a subscriber whether it is aborted. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result of check, true means aborted. + * @since 18 + */ +bool OH_CommonEvent_GetAbortCommonEvent(const CommonEvent_Subscriber* subscriber); + +/** + * @brief Abort an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result of operation, true means succeeded. + * @since 18 + */ +bool OH_CommonEvent_AbortCommonEvent(CommonEvent_Subscriber* subscriber); + +/** + * @brief Clear the aborted flag of an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result of operation, true means succeeded. + * @since 18 + */ +bool OH_CommonEvent_ClearAbortCommonEvent(CommonEvent_Subscriber* subscriber); + +/** + * @brief Get result code from an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result code, default is 0. + * @since 18 + */ +int32_t OH_CommonEvent_GetCodeFromSubscriber(const CommonEvent_Subscriber* subscriber); + +/** + * @brief Set result code to an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @param code Indicates the result code. + * @return Returns the result of operation, true means succeeded. + * @since 18 + */ +bool OH_CommonEvent_SetCodeToSubscriber(CommonEvent_Subscriber* subscriber, int32_t code); + +/** + * @brief Get result data from an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @return Returns the result data, default is null. + * @since 18 + */ +const char* OH_CommonEvent_GetDataFromSubscriber(const CommonEvent_Subscriber* subscriber); + +/** + * @brief Set result data to an ordered event by a subscriber. + * + * @param subscriber Indicates the subscriber. + * @param data Indicates the result data. + * @param length Indicates the length of result data. + * @return Returns the result of operation, true means succeeded. + * @since 18 + */ +bool OH_CommonEvent_SetDataToSubscriber(CommonEvent_Subscriber* subscriber, const char* data, size_t length); + #ifdef __cplusplus } #endif diff --git a/BasicServicesKit/commonevent/oh_commonevent_support.h b/BasicServicesKit/commonevent/oh_commonevent_support.h index 67f77687be755140a620cb6dd9dd50135f2192de..622e86aeb6c7a810c78af3c6a8c7f2359f48c878 100644 --- a/BasicServicesKit/commonevent/oh_commonevent_support.h +++ b/BasicServicesKit/commonevent/oh_commonevent_support.h @@ -57,7 +57,7 @@ static const char* const COMMON_EVENT_SHUTDOWN = "usual.event.SHUTDOWN"; static const char* const COMMON_EVENT_BATTERY_CHANGED = "usual.event.BATTERY_CHANGED"; /** - * @brief This commonEvent means when the device in low battery state.. + * @brief This commonEvent means when the device in low battery state. * * @since 12 */ @@ -98,6 +98,20 @@ static const char* const COMMON_EVENT_SCREEN_OFF = "usual.event.SCREEN_OFF"; */ static const char* const COMMON_EVENT_SCREEN_ON = "usual.event.SCREEN_ON"; +/** + * @brief This commonEvent means when the device is is about to enter the hibernate mode. + * + * @since 15 + */ +static const char* const COMMON_EVENT_ENTER_HIBERNATE = "usual.event.ENTER_HIBERNATE"; + +/** + * @brief This commonEvent means when the device is exits the hibernate mode. + * + * @since 15 + */ +static const char* const COMMON_EVENT_EXIT_HIBERNATE = "usual.event.EXIT_HIBERNATE"; + /** * @brief This commonEvent means when the thermal state level change * @@ -141,7 +155,7 @@ static const char* const COMMON_EVENT_PACKAGE_ADDED = "usual.event.PACKAGE_ADDED static const char* const COMMON_EVENT_PACKAGE_REMOVED = "usual.event.PACKAGE_REMOVED"; /** - * @brief This commonEvent means when an existing application package is removed from the device. + * @brief This commonEvent means when an installed application's add-on package is removed from the device. * * @since 12 */ @@ -555,6 +569,14 @@ static const char* const COMMON_EVENT_MINORSMODE_ON = "usual.event.MINORSMODE_ON * @since 12 */ static const char* const COMMON_EVENT_MINORSMODE_OFF = "usual.event.MINORSMODE_OFF"; + +/** + * @brief This common event means that the managed browser policy is changed. + * This is a protected common event that can only be sent by system. + * + * @since 15 + */ +static const char* const COMMON_EVENT_MANAGED_BROWSER_POLICY_CHANGED = "usual.event.MANAGED_BROWSER_POLICY_CHANGED"; #ifdef __cplusplus } #endif diff --git a/BasicServicesKit/os_account.h b/BasicServicesKit/os_account.h index a93a32b4b579bef078ab04be747b520d86aef457..2a90d0cfdf64e8cfcc99f4c3d8e3d53cc42237fd 100644 --- a/BasicServicesKit/os_account.h +++ b/BasicServicesKit/os_account.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OS_ACCOUNT_H -#define OS_ACCOUNT_H - /** * @addtogroup OsAccount * @{ @@ -23,6 +20,7 @@ * @brief Provide the definition of the C interface for the native OsAccount. * @since 12 */ + /** * @file os_account.h * @@ -33,6 +31,9 @@ * @since 12 */ +#ifndef OS_ACCOUNT_H +#define OS_ACCOUNT_H + #include #include "os_account_common.h" diff --git a/BasicServicesKit/os_account_common.h b/BasicServicesKit/os_account_common.h index 932b398c58b04102846ef7661762fe775d5c0a20..334ad730b2103c8d77fa38be57153b612a516c0c 100644 --- a/BasicServicesKit/os_account_common.h +++ b/BasicServicesKit/os_account_common.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OS_ACCOUNT_COMMON_H -#define OS_ACCOUNT_COMMON_H - /** * @addtogroup OsAccount * @{ @@ -23,6 +20,7 @@ * @brief Provide the definition of the C interface for the native OsAccount. * @since 12 */ + /** * @file os_account_common.h * @@ -33,6 +31,9 @@ * @since 12 */ +#ifndef OS_ACCOUNT_COMMON_H +#define OS_ACCOUNT_COMMON_H + #ifdef __cplusplus extern "C" { #endif diff --git a/BasicServicesKit/time_service.h b/BasicServicesKit/time_service.h index c7194a406b54be95aec2f1185b49512622e1f08b..29f45020d8d622217cae2a55364a3c711f19c109 100644 --- a/BasicServicesKit/time_service.h +++ b/BasicServicesKit/time_service.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef TIME_SERVICE_H -#define TIME_SERVICE_H - /** * @addtogroup TimeService * @{ @@ -28,10 +25,14 @@ * * @brief Declares the APIs for obtaining the time zone information. * @library libtime_service_ndk.so + * @kit BasicServicesKit * @syscap SystemCapability.MiscServices.Time * @since 12 */ +#ifndef TIME_SERVICE_H +#define TIME_SERVICE_H + #include #ifdef __cplusplus diff --git a/ConnectivityKit/wifi/BUILD.gn b/ConnectivityKit/wifi/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..19812ca5c9565344db3df28a9e3c23397fd714ac --- /dev/null +++ b/ConnectivityKit/wifi/BUILD.gn @@ -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. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("wifi_ndk_header") { + dest_dir = "$ndk_headers_out_dir/ConnectivityKit/wifi" + sources = [ "./oh_wifi.h" ] +} + +ohos_ndk_library("libwifi_ndk") { + ndk_description_file = "./libwifi.ndk.json" + output_name = "wifi_ndk" + output_extension = "so" + min_compact_version = "13" + system_capability = "SystemCapability.Communication.WiFi.STA" + system_capability_headers = [ "./oh_wifi.h" ] +} diff --git a/ConnectivityKit/wifi/libwifi.ndk.json b/ConnectivityKit/wifi/libwifi.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..178e649260616fe8ca02afd2db7b40c7ac210ef2 --- /dev/null +++ b/ConnectivityKit/wifi/libwifi.ndk.json @@ -0,0 +1,6 @@ +[ + { + "first_introduced": "13", + "name": "OH_Wifi_IsWifiEnabled" + } +] \ No newline at end of file diff --git a/ConnectivityKit/wifi/oh_wifi.h b/ConnectivityKit/wifi/oh_wifi.h new file mode 100644 index 0000000000000000000000000000000000000000..1d8e1d64516cd22c4f20fbacbc4c2a502905bfa0 --- /dev/null +++ b/ConnectivityKit/wifi/oh_wifi.h @@ -0,0 +1,90 @@ +/* + * 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 Wifi + * @{ + * + * @brief Provide functions for querying the status of wifi switch. + * @since 13 + */ +/** + * @file oh_wifi.h + * @kit ConnectivityKit + * @brief Define interfaces for querying wifi switch status. + * @library libwifi.so + * @syscap SystemCapability.Communication.WiFi.STA + * @since 13 + */ + +#ifndef OH_WIFI_H +#define OH_WIFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the wifi result codes. + * + * @since 13 + */ +typedef enum Wifi_ResultCode { + /** + * @error The operation is successful. + */ + WIFI_SUCCESS = 0, + /** + * @error Permission verification failed. The application does not have the + * permission required to call the API. + */ + WIFI_PERMISSION_DENIED = 201, + /** + * @error Parameter error. Possible reasons: 1. The input parameter is a null pointer;\n + * 2. Parameter values exceed the defined range.\n + */ + WIFI_INVALID_PARAM = 401, + /** + * @error Capability not supported. Failed to call function due to limited device capabilities. + */ + WIFI_NOT_SUPPORTED = 801, + /** + * @error Operation failed. + * Possible reasons: Internal execution failed. + */ + WIFI_OPERATION_FAILED = 2501000 +} Wifi_ResultCode; + +/** + * @brief Check whether the wifi switch is enabled. + * + * @param enabled - It is a boolean pointer used to receive wifi switch status values.\n + * Equal to true indicates that the wifi switch is turned on, false indicates that\n + * the wifi switch is turned off.\n + * The caller needs to pass in a non empty boolean pointer, otherwise an error will be returned.\n + * @return wifi functions result code.\n + * For a detailed definition, please refer to {@link Wifi_ResultCode}.\n + * {@link WIFI_SUCCESS} Successfully obtained the wifi switch status.\n + * {@link WIFI_INVALID_PARAM} The input parameter enabled is a null pointer.\n + * {@link WIFI_OPERATION_FAILED} Internal execution failed.\n + * @since 13 + */ +Wifi_ResultCode OH_Wifi_IsWifiEnabled(bool *enabled); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // OH_WIFI_H \ No newline at end of file diff --git a/CryptoArchitectureKit/crypto_signature.h b/CryptoArchitectureKit/crypto_signature.h index 63d46299a3a09700e617201c925f850399072b2e..321b3f83311d14013dfd841a65c9c4cba8b6458a 100644 --- a/CryptoArchitectureKit/crypto_signature.h +++ b/CryptoArchitectureKit/crypto_signature.h @@ -75,7 +75,7 @@ typedef struct OH_CryptoVerify OH_CryptoVerify; * @brief Create a verify context according to the given algorithm name. * * @param algoName Indicates the algorithm name for generating the verify context. Example RSA1024|PKCS1|SHA256. - * @param ctx Indicates the pointer to the verify context. + * @param verify Indicates the pointer to the verify context. * @return {@link OH_Crypto_ErrCode#CRYPTO_SUCCESS} 0 - If the operation is successful. * {@link OH_Crypto_ErrCode#CRYPTO_INVALID_PARAMS} 401 - If parameter is invalid. * {@link OH_Crypto_ErrCode#CRYPTO_NOT_SUPPORTED} 801 - If the operation is not supported. diff --git a/DataProtectionKit/dlp_permission_api.h b/DataProtectionKit/dlp_permission_api.h index 057c0fd32b66b8912288bb61cb207074dc34c49d..40ec9c34700fa3271e90b6a107621c8769ec0c25 100644 --- a/DataProtectionKit/dlp_permission_api.h +++ b/DataProtectionKit/dlp_permission_api.h @@ -19,7 +19,7 @@ * * @brief Provides the capability to access the data loss prevention (DLP) files. * - * @since 13 + * @since 14 */ /** @@ -30,7 +30,7 @@ * @library libohdlp_permission.so * @kit DataProtectionKit * @syscap SystemCapability.Security.DataLossPrevention - * @since 13 + * @since 14 */ #ifndef DLP_PERMISSION_API_H @@ -46,7 +46,7 @@ extern "C" { /** * @brief Enumerates the error codes. * - * @since 13 + * @since 14 */ typedef enum { /** @error The operation is successful. */ @@ -68,7 +68,7 @@ typedef enum { /** * @brief Enumerates the access permissions for a DLP file. * - * @since 13 + * @since 14 */ typedef enum { /** No permission. */ @@ -93,7 +93,7 @@ typedef enum { * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t *flags); @@ -106,7 +106,7 @@ DLP_ErrCode OH_DLP_GetDlpPermissionInfo(DLP_FileAccess *dlpFileAccess, uint32_t * @return {@link DLP_ErrCode#ERR_OH_SUCCESS} 0 - If the operation is successful. * {@link DLP_ErrCode#ERR_OH_INVALID_PARAMS} 19100001 - If the parameter value is invalid. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFileName); @@ -119,7 +119,7 @@ DLP_ErrCode OH_DLP_GetOriginalFileName(const char *fileName, char **originalFile * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); @@ -134,7 +134,7 @@ DLP_ErrCode OH_DLP_IsInSandbox(bool *isInSandbox); * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); @@ -147,7 +147,7 @@ DLP_ErrCode OH_DLP_SetSandboxAppConfig(const char *configInfo); * works abnormally. * {@link DLP_ErrCode#ERR_OH_OUT_OF_MEMORY} 19100012 - If the memory error. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo); @@ -160,7 +160,7 @@ DLP_ErrCode OH_DLP_GetSandboxAppConfig(char **configInfo); * {@link DLP_ErrCode#ERR_OH_SYSTEM_SERVICE_EXCEPTION} 19100011 - If the system ability * works abnormally. * {@link DLP_ErrCode#ERR_OH_APPLICATION_NOT_AUTHORIZED} 19100018 - If not authorized application. - * @since 13 + * @since 14 */ DLP_ErrCode OH_DLP_CleanSandboxAppConfig(); diff --git a/DataProtectionKit/libdlppermission.ndk.json b/DataProtectionKit/libdlppermission.ndk.json index 6de2fcd8759e825e7c5c99d784ad3d4fb296fa73..613734f7d5375e412fe8e247233383356fc8ca91 100644 --- a/DataProtectionKit/libdlppermission.ndk.json +++ b/DataProtectionKit/libdlppermission.ndk.json @@ -1,26 +1,26 @@ [ { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_GetDlpPermissionInfo" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_GetOriginalFileName" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_IsInSandbox" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_SetSandboxAppConfig" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_GetSandboxAppConfig" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_DLP_CleanSandboxAppConfig" } ] \ No newline at end of file diff --git a/IPCKit/ipc_cparcel.h b/IPCKit/ipc_cparcel.h index bade20ba939defbe54ad4bfbe76344ea70cc5670..6903bb6214c825872da586926a7ef65fc8a582a1 100644 --- a/IPCKit/ipc_cparcel.h +++ b/IPCKit/ipc_cparcel.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef CAPI_INCLUDE_IPC_CPARCEL_H -#define CAPI_INCLUDE_IPC_CPARCEL_H - /** * @addtogroup OHIPCParcel * @{ @@ -37,6 +34,9 @@ * @since 12 */ +#ifndef CAPI_INCLUDE_IPC_CPARCEL_H +#define CAPI_INCLUDE_IPC_CPARCEL_H + #include #ifdef __cplusplus diff --git a/IPCKit/ipc_cremote_object.h b/IPCKit/ipc_cremote_object.h index b8f82db7c24d4f6260fd479bf03b9b3a004fd31f..1f04f78dd54ab44a5c9cd888fb699602b8e17eeb 100644 --- a/IPCKit/ipc_cremote_object.h +++ b/IPCKit/ipc_cremote_object.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef CAPI_INCLUDE_IPC_CREMOTE_OBJECT_H -#define CAPI_INCLUDE_IPC_CREMOTE_OBJECT_H - /** * @addtogroup OHIPCRemoteObject * @{ @@ -39,6 +36,9 @@ * @since 12 */ +#ifndef CAPI_INCLUDE_IPC_CREMOTE_OBJECT_H +#define CAPI_INCLUDE_IPC_CREMOTE_OBJECT_H + #include #include "ipc_cparcel.h" diff --git a/IPCKit/ipc_cskeleton.h b/IPCKit/ipc_cskeleton.h index 68364cbec3f58ded458062606c62c64119ff8e85..e6a8530139c843a5652c02da0805961bdebd22a6 100644 --- a/IPCKit/ipc_cskeleton.h +++ b/IPCKit/ipc_cskeleton.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef CAPI_INCLUDE_IPC_CSKELETON_H -#define CAPI_INCLUDE_IPC_CSKELETON_H - /** * @addtogroup OHIPCSkeleton * @{ @@ -39,6 +36,9 @@ * @since 12 */ +#ifndef CAPI_INCLUDE_IPC_CSKELETON_H +#define CAPI_INCLUDE_IPC_CSKELETON_H + #include #include "ipc_cparcel.h" diff --git a/IPCKit/ipc_error_code.h b/IPCKit/ipc_error_code.h index 5f7a1451494b6492bd9c9b9fe0add56f8fe79497..5fa109e5b0336476872c6c8aea8ca7dfed840165 100644 --- a/IPCKit/ipc_error_code.h +++ b/IPCKit/ipc_error_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef CAPI_INCLUDE_IPC_ERROR_CODE_H -#define CAPI_INCLUDE_IPC_ERROR_CODE_H - /** * @addtogroup OHIPCErrorCode * @{ @@ -37,6 +34,9 @@ * @since 12 */ +#ifndef CAPI_INCLUDE_IPC_ERROR_CODE_H +#define CAPI_INCLUDE_IPC_ERROR_CODE_H + /** * @brief Enumerates IPC error codes. * diff --git a/IPCKit/ipc_kit.h b/IPCKit/ipc_kit.h index e30d81aac1f6247a2d94b2bc7d07825add909498..9786bd1f25622ba4751fd8fd7aa0e915c801babb 100644 --- a/IPCKit/ipc_kit.h +++ b/IPCKit/ipc_kit.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef CAPI_INCLUDE_IPC_KIT_H -#define CAPI_INCLUDE_IPC_KIT_H - /** * @addtogroup IPCKit * @{ @@ -36,6 +33,9 @@ * @since 12 */ +#ifndef CAPI_INCLUDE_IPC_KIT_H +#define CAPI_INCLUDE_IPC_KIT_H + #include "ipc_error_code.h" #include "ipc_cparcel.h" #include "ipc_cremote_object.h" diff --git a/LocationKit/oh_location.h b/LocationKit/oh_location.h index b4d3bbc5c66cf51eaeeea3bc20cd07de97f763ff..62eac6710d5c696f7e92687ae8867ef92cf51b92 100644 --- a/LocationKit/oh_location.h +++ b/LocationKit/oh_location.h @@ -24,7 +24,7 @@ * @file oh_location.h * @kit LocationKit * @brief Define interfaces for querying location switch status, starting locating, and stopping locating. - * @library libohlocation.so + * @library liblocation_ndk.so * @syscap SystemCapability.Location.Location.Core * @since 13 */ diff --git a/LocationKit/oh_location_type.h b/LocationKit/oh_location_type.h index 235c436ff841f37bf660c59ab1eaa0422b033d8e..48e117740addb879d7029634fce15cb859c05339 100644 --- a/LocationKit/oh_location_type.h +++ b/LocationKit/oh_location_type.h @@ -26,7 +26,7 @@ * @file oh_location_type.h * @kit LocationKit * @brief Declares the common location attributes. - * @library libohlocation.so + * @library liblocation_ndk.so * @syscap SystemCapability.Location.Location.Core * @since 13 */ @@ -34,7 +34,11 @@ #ifndef OH_LOCATION_TYPE_H #define OH_LOCATION_TYPE_H +#ifdef __cplusplus #include +#else +#include +#endif #ifdef __cplusplus extern "C" { diff --git a/NotificationKit/BUILD.gn b/NotificationKit/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..eff7eea6e08463b4c96eb12e3c44da7da587fbff --- /dev/null +++ b/NotificationKit/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("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +ohos_ndk_headers("ohnotification_header") { + dest_dir = "$ndk_headers_out_dir/NotificationKit/" + sources = [ "./notification.h" ] +} + +ohos_ndk_library("libnotification_ndk") { + output_name = "ohnotification" + output_extension = "so" + ndk_description_file = "./libohnotification.ndk.json" + min_compact_version = "13" + system_capability = "SystemCapability.Notification.Notification" + system_capability_headers = [ "NotificationKit/notification.h" ] +} diff --git a/NotificationKit/libohnotification.ndk.json b/NotificationKit/libohnotification.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..24b56b30a00063e07790c859328c2a8420f99f74 --- /dev/null +++ b/NotificationKit/libohnotification.ndk.json @@ -0,0 +1,6 @@ +[ + { + "first_introduced": "13", + "name": "OH_Notification_IsNotificationEnabled" + } +] diff --git a/tee/include/tee_mem_monitoring_api.h b/NotificationKit/notification.h similarity index 47% rename from tee/include/tee_mem_monitoring_api.h rename to NotificationKit/notification.h index a95a78efe0d0880f882121b08255c11523aaf573..d7a31be18c4125e1a1326dc294847d20ca24cc33 100644 --- a/tee/include/tee_mem_monitoring_api.h +++ b/NotificationKit/notification.h @@ -4,7 +4,7 @@ * 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 + * 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, @@ -13,52 +13,46 @@ * limitations under the License. */ -#ifndef TEE_MEM_MONITORING_API_H -#define TEE_MEM_MONITORING_API_H - /** - * @addtogroup TeeTrusted + * @addtogroup NOTIFICATION * @{ * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. + * @brief Provides the definition of the C interface for the notification service. * - * @since 12 + * @since 13 */ - /** - * @file tee_mem_monitoring_api.h + * @file notification.h * - * @brief Provides APIs for memory monitoring. + * @brief Declares the APIs of notification service. * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 + * @library libohnotification.so + * @kit NotificationKit + * @syscap SystemCapability.Notification.Notification + * @since 13 */ +#ifndef OH_NOTIFICATION_H +#define OH_NOTIFICATION_H + #include +#include #ifdef __cplusplus extern "C" { #endif /** - * @brief Obtains the heap usage of this trusted application (TA). + * @brief Checks whether this application is allowed to publish notifications. * - * @param show Indicates whether to print the result in the log file. - * - * @return Returns the heap usage in percentage. - * - * @since 12 - * @version 1.0 + * @return true - This application is allowed to publish notifications. + * false - This application is not allowed to publish notifications. + * @since 13 */ -uint32_t get_heap_usage(bool show); +bool OH_Notification_IsNotificationEnabled(void); #ifdef __cplusplus } #endif +#endif // OH_NOTIFICATION_H /** @} */ -#endif diff --git a/README.OpenSource b/README.OpenSource deleted file mode 100644 index 0b04b76a88869e4a5b3be5d926cdbd07b444710d..0000000000000000000000000000000000000000 --- a/README.OpenSource +++ /dev/null @@ -1,83 +0,0 @@ -[ - { - "Name" : "zlib", - "License" : "zlib/libpng License", - "License File" : "LICENSE", - "Version Number" : "v1.2.12", - "Owner" : "gongjunsong@huawei.com", - "Upstream URL" : "https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz", - "Description" : "zlib 1.2.12 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files" - }, - { - "Name": "libuv", - "License": "MIT License", - "License File": "LICENSE", - "Version Number": "v1.44.1", - "Owner": "sunbingxin@huawei.com", - "Upstream URL": "https://github.com/libuv/libuv", - "Description": "libuv is a multi-platform support library with a focus on asynchronous I/O." - }, - { - "Name": "MindSpore", - "License": "Apache License 2.0", - "License File": "LICENSE.txt", - "Version Number": "1.8.1", - "Owner": "zhuguodong0001@163.com", - "Upstream URL": "https://gitee.com/mindspore/mindspore/repository/archive/v1.8.1", - "Description": "MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios." - }, - { - "Name" : "musl", - "License" : "MIT License", - "License File" : "COPYRIGHT", - "Version Number" : "1.2.5", - "Owner" : "zhaoxinyuan9@huawei.com", - "Upstream URL" : "https://musl.libc.org", - "Description" : "musl is an MIT-licensed implementation of the standard C library" - }, - { - "Name": "node", - "License": "ISC License,Public Domain,MIT License,Free Software Foundation - MIT License,Apache License V2.0,ICU License,zlib/libpng License,BSD 2-Clause License,BSD 3-Clause License", - "License File": "LICENSE", - "Version Number": "14.21.2", - "Owner": "sunbingxin@huawei.com", - "Upstream URL": "http://www.nodejs.org/", - "Description": "Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser." - }, - { - "Name": "Khronos Group - OpenSL ES", - "License": "null", - "License File": "NOTICE", - "Version Number": "1.0.1", - "Owner": "yangshuai67@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/OpenSL-ES-Registry.git", - "Description": "OpenSL ES™ is a royalty-free, cross-platform, hardware-accelerated audio API tuned for embedded systems." - }, - { - "Name": "EGL", - "License": "MIT License", - "License File": "LICENSE", - "Version Number": "1.5", - "Owner": "lizheng2@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/EGL-Registry.git", - "Description": "EGL is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system." - }, - { - "Name": "openGLES", - "License": "Apache-2.0", - "License File": "NOTICE", - "Version Number": "a301c9b4600e4074008b93fba17744a859fb763b", - "Owner": "lizheng2@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/OpenGL-Registry.git", - "Description": "The OpenGL ES registry contains specifications of the core API and shading language; specifications of Khronos- and vendor-approved OpenGL ES extensions; header files corresponding to the specificatio" - }, - { - "Name": "Vulkan", - "License": "Apache-2.0", - "License File": "LICENSE", - "Version Number": "v1.3.231", - "Owner": "mengzhaobing@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/Vulkan-Headers.git", - "Description": "Vulkan header files and API registry" - } -] diff --git a/ability/ability_runtime/child_process/libchild_process.ndk.json b/ability/ability_runtime/child_process/libchild_process.ndk.json index b00d0d189533554ddc571ce9c2940cb8c929f08d..d812f5a08bc7ac6471ed7a2a96290acdc0faec5e 100644 --- a/ability/ability_runtime/child_process/libchild_process.ndk.json +++ b/ability/ability_runtime/child_process/libchild_process.ndk.json @@ -6,5 +6,9 @@ { "first_introduced": "13", "name": "OH_Ability_StartNativeChildProcess" + }, + { + "first_introduced": "16", + "name": "OH_Ability_GetCurrentChildProcessArgs" } ] \ No newline at end of file diff --git a/ability/ability_runtime/child_process/native_child_process.h b/ability/ability_runtime/child_process/native_child_process.h index af736450b2c2321a4fd628c67dc2627129c49d21..2837104000d588409635bf594b085559ed1da42c 100644 --- a/ability/ability_runtime/child_process/native_child_process.h +++ b/ability/ability_runtime/child_process/native_child_process.h @@ -13,11 +13,6 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H -#define OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H - -#include "IPCKit/ipc_cparcel.h" - /** * @addtogroup ChildProcess * @{ @@ -40,6 +35,11 @@ * @since 12 */ +#ifndef OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H +#define OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H + +#include "IPCKit/ipc_cparcel.h" + #ifdef __cplusplus extern "C" { #endif @@ -279,6 +279,15 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess( const char* entry, NativeChildProcess_Args args, NativeChildProcess_Options options, int32_t *pid); +/** + * @brief Child process get self NativeChildProcess_Args. + * + * @return Returns a pointer to the arguments passed to current child process.\n + * For details, see {@link NativeChildProcess_Args}. + * @since 16 + */ +NativeChildProcess_Args* OH_Ability_GetCurrentChildProcessArgs(); + #ifdef __cplusplus } // extern "C" #endif diff --git a/ai/neural_network_runtime/neural_network_core.h b/ai/neural_network_runtime/neural_network_core.h index f4c156a990e09da143872709676a96ce33e822d3..c3485d5c59c119bc6da15af8cb2c79f3e26d4dfe 100644 --- a/ai/neural_network_runtime/neural_network_core.h +++ b/ai/neural_network_runtime/neural_network_core.h @@ -14,7 +14,7 @@ */ /** - * @addtogroup NeuralNeworkRuntime + * @addtogroup NeuralNetworkRuntime * @{ * * @brief Provides APIs of Neural Network Runtime for accelerating the model inference. @@ -918,7 +918,7 @@ OH_NN_ReturnCode OH_NNExecutor_GetInputCount(const OH_NNExecutor *executor, size * {@link OH_NNExecutor_CreateOutputTensorDesc}. \n * * @param executor Pointer to the {@link OH_NNExecutor} instance. - * @param OutputCount Output tensor count returned. + * @param outputCount Output tensor count returned. * @return Execution result of the function. * {@link OH_NN_SUCCESS} get output count successfully. The return value is saved in outputCount.\n * {@link OH_NN_INVALID_PARAMETER} fail to get output count. The possible reason for failure is that diff --git a/ai/neural_network_runtime/neural_network_runtime.h b/ai/neural_network_runtime/neural_network_runtime.h index 294b362f5c7580769a1a01f6cea2f136221ebfae..a92a27d830ea5e6bcdc7f35aa8843cd040300fd9 100644 --- a/ai/neural_network_runtime/neural_network_runtime.h +++ b/ai/neural_network_runtime/neural_network_runtime.h @@ -14,7 +14,7 @@ */ /** - * @addtogroup NeuralNeworkRuntime + * @addtogroup NeuralNetworkRuntime * @{ * * @brief Provides APIs of Neural Network Runtime for accelerating the model inference. diff --git a/ai/neural_network_runtime/neural_network_runtime_type.h b/ai/neural_network_runtime/neural_network_runtime_type.h index 414fa872c3da1a55247a0ec1591e9d7b74eac97e..5c003b0a850080af5cc11974cac90ed914028b64 100644 --- a/ai/neural_network_runtime/neural_network_runtime_type.h +++ b/ai/neural_network_runtime/neural_network_runtime_type.h @@ -14,7 +14,7 @@ */ /** - * @addtogroup NeuralNeworkRuntime + * @addtogroup NeuralNetworkRuntime * @{ * * @brief Provides APIs for accelerating the Neural Network Runtime model inference. diff --git a/ark_runtime/jsvm/jsvm.h b/ark_runtime/jsvm/jsvm.h index 3f47366b4e021dcd9f8861a3fb9d136619b31d81..06f4ce767cee3e901a6101e9491a48d11a278d97 100644 --- a/ark_runtime/jsvm/jsvm.h +++ b/ark_runtime/jsvm/jsvm.h @@ -12,10 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#ifndef ARK_RUNTIME_JSVM_JSVM_H -#define ARK_RUNTIME_JSVM_JSVM_H - /** * @addtogroup JSVM * @{ @@ -43,9 +39,15 @@ * @since 11 */ + +#ifndef ARK_RUNTIME_JSVM_JSVM_H +#define ARK_RUNTIME_JSVM_JSVM_H + + // This file needs to be compatible with C compilers. #include // NOLINT(modernize-deprecated-headers) #include // NOLINT(modernize-deprecated-headers) +#include "jsvm_types.h" // Use INT_MAX, this should only be consumed by the pre-processor anyway. #define JSVM_VERSION_EXPERIMENTAL 2147483647 @@ -63,8 +65,6 @@ #endif #endif -#include "jsvm_types.h" - #ifndef JSVM_EXTERN #ifdef _WIN32 /** @@ -102,7 +102,7 @@ EXTERN_C_START /** * @brief Init a JavaScript vm. * - * @param options: The options for initialize the JavaScript VM. + * @param options The options for initialize the JavaScript VM. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 11 @@ -112,8 +112,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Init(const JSVM_InitOptions* options); /** * @brief This API create a new VM instance. * - * @param options: The options for create the VM instance. - * @param result: The new VM instance. + * @param options The options for create the VM instance. + * @param result The new VM instance. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -121,21 +121,88 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Init(const JSVM_InitOptions* options); JSVM_EXTERN JSVM_Status OH_JSVM_CreateVM(const JSVM_CreateVMOptions* options, JSVM_VM* result); +/** + * @brief This function controls how Microtasks are invoked of the vm. If the method is not + * called, the default microtask policy of vm is JSVM_MicrotaskPolicy::JSVM_MICROTASK_AUTO. + * + * @param vm The VM instance to set mircrotasks policy. + * @param policy Policy for running microtasks. + * @return Returns JSVM_OK if the API succeeded. + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetMicrotaskPolicy(JSVM_VM vm, + JSVM_MicrotaskPolicy policy); + /** * @brief Destroys VM instance. * - * @param vm: The VM instance to be Destroyed. + * @param vm The VM instance to be Destroyed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 */ JSVM_EXTERN JSVM_Status OH_JSVM_DestroyVM(JSVM_VM vm); +/** + * @brief This API allocates a default JavaScript Proxy. It is the equivalent of + * doing new Proxy(target, handler) in JavaScript. + * + * @param env The environment that the API is invoked under. + * @param target A JSVM_Value representing the JavaScript Object which you want to proxy. + * @param handler A JSVM_Value representing the JavaScript Object that defines which + * operations will be intercepted and how to redefine intercepted operations. + * @param result A JSVM_Value representing a JavaScript Proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * {@link JSVM_OBJECT_EXPECTED} if target or handler is not Javascript Object. \n + * {@link JSVM_PENDING_EXCEPTION} if an exception occurs. \n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateProxy(JSVM_Env env, + JSVM_Value target, + JSVM_Value handler, + JSVM_Value* result); + +/** + * @brief This API checks if the value passed in is a Proxy. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isProxy Whether the given value is Proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsProxy(JSVM_Env env, + JSVM_Value value, + bool* isProxy); + +/** + * @brief This API gets target from proxy. + * + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript Proxy whose target to return. + * @param result Target of the given proxy. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the any of the input arguments is NULL. \n + * {@link JSVM_INVALID_TYPE} if value is not a Javascript Proxy. \n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_ProxyGetTarget(JSVM_Env env, + JSVM_Value value, + JSVM_Value* result); + /** * @brief This API open a new VM scope for the VM instance. * - * @param vm: The VM instance to open scope for. - * @param result: The new VM scope. + * @param vm The VM instance to open scope for. + * @param result The new VM scope. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -146,8 +213,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenVMScope(JSVM_VM vm, /** * @brief This function close the VM scope for the VM instance. * - * @param vm: The VM instance to close scope for. - * @param scope: The VM scope to be closed. + * @param vm The VM instance to close scope for. + * @param scope The VM scope to be closed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -158,10 +225,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CloseVMScope(JSVM_VM vm, /** * @brief This function create a new environment with optional properties for the context of the new environment. * - * @param vm: The VM instance that the env will be created in. - * @param propertyCount: The number of elements in the properties array. - * @param properties: The array of property descriptor. - * @param result: The new environment created. + * @param vm The VM instance that the env will be created in. + * @param propertyCount The number of elements in the properties array. + * @param properties The array of property descriptor. + * @param result The new environment created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -174,9 +241,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateEnv(JSVM_VM vm, /** * @brief This function create a new environment from the start snapshot of the vm. * - * @param vm: The VM instance that the env will be created in. - * @param index: The index of the environment in the snapshot. - * @param result: The new environment created. + * @param vm The VM instance that the env will be created in. + * @param index The index of the environment in the snapshot. + * @param result The new environment created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -188,7 +255,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateEnvFromSnapshot(JSVM_VM vm, /** * @brief This function destroys the environment. * - * @param env: The environment to be destroyed. + * @param env The environment to be destroyed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -198,8 +265,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DestroyEnv(JSVM_Env env); /** * @brief This function open a new environment scope. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param result: The new environment scope. + * @param env The environment that the JSVM-API call is invoked under. + * @param result The new environment scope. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -210,8 +277,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenEnvScope(JSVM_Env env, /** * @brief This function closes the environment scope of the environment. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param scope: The environment scope to be closed. + * @param env The environment that the JSVM-API call is invoked under. + * @param scope The environment scope to be closed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -222,8 +289,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CloseEnvScope(JSVM_Env env, /** * @brief This function retrieves the VM instance of the given environment. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param result: The VM instance of the environment. + * @param env The environment that the JSVM-API call is invoked under. + * @param result The VM instance of the environment. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 12 @@ -234,13 +301,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetVM(JSVM_Env env, /** * @brief This function compiles a string of JavaScript code and returns the compiled script. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param script: A JavaScript string containing the script yo be compiled. - * @param cachedData: Optional code cache data for the script. - * @param cacheDataLength: The length of cachedData array. - * @param eagerCompile: Whether to compile the script eagerly. - * @param cacheRejected: Whether the code cache rejected by compilation. - * @param result: The compiled script. + * @param env The environment that the JSVM-API call is invoked under. + * @param script A JavaScript string containing the script yo be compiled. + * @param cachedData Optional code cache data for the script. + * @param cacheDataLength The length of cachedData array. + * @param eagerCompile Whether to compile the script eagerly. + * @param cacheRejected Whether the code cache rejected by compilation. + * @param result The compiled script. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -257,14 +324,14 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CompileScript(JSVM_Env env, * @brief This function compiles a string of JavaScript code with the source code information * and returns the compiled script. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param script: A JavaScript string containing the script to be compiled. - * @param cachedData: Optional code cache data for the script. - * @param cacheDataLength: The length of cachedData array. - * @param eagerCompile: Whether to compile the script eagerly. - * @param cacheRejected: Whether the code cache rejected by compilation. - * @param origin: The information of source code. - * @param result: The compiled script. + * @param env The environment that the JSVM-API call is invoked under. + * @param script A JavaScript string containing the script to be compiled. + * @param cachedData Optional code cache data for the script. + * @param cacheDataLength The length of cachedData array. + * @param eagerCompile Whether to compile the script eagerly. + * @param cacheRejected Whether the code cache rejected by compilation. + * @param origin The information of source code. + * @param result The compiled script. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -281,10 +348,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CompileScriptWithOrigin(JSVM_Env env, /** * @brief This function creates code cache for the compiled script. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param script: A compiled script to create code cache for. - * @param data: The data of the code cache. - * @param length: The length of the code cache data. + * @param env The environment that the JSVM-API call is invoked under. + * @param script A compiled script to create code cache for. + * @param data The data of the code cache. + * @param length The length of the code cache data. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -302,9 +369,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateCodeCache(JSVM_Env env, * global object. Variable declarations made using let and const will be visible globally, but will not be added * to the global object.The value of this is global within the script. * - * @param env: The environment that the API is invoked under. - * @param script: A JavaScript string containing the script to execute. - * @param result: The value resulting from having executed the script. + * @param env The environment that the API is invoked under. + * @param script A JavaScript string containing the script to execute. + * @param result The value resulting from having executed the script. * @since 11 */ JSVM_EXTERN JSVM_Status OH_JSVM_RunScript(JSVM_Env env, @@ -315,11 +382,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RunScript(JSVM_Env env, * @brief This API associates data with the currently running JSVM environment. data can later be retrieved * using OH_JSVM_GetInstanceData(). * - * @param env: The environment that the JSVM-API call is invoked under. - * @param data: The data item to make available to bindings of this instance. - * @param finalizeCb: The function to call when the environment is being torn down. The function receives + * @param env The environment that the JSVM-API call is invoked under. + * @param data The data item to make available to bindings of this instance. + * @param finalizeCb The function to call when the environment is being torn down. The function receives * data so that it might free it. JSVM_Finalize provides more details. - * @param finalizeHint: Optional hint to pass to the finalize callback during collection. + * @param finalizeHint Optional hint to pass to the finalize callback during collection. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -333,8 +400,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_SetInstanceData(JSVM_Env env, * @brief This API retrieves data that was previously associated with the currently running JSVM environment * via OH_JSVM_SetInstanceData(). If no data is set, the call will succeed and data will be set to NULL. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param data: The data item that was previously associated with the currently running JSVM environment by + * @param env The environment that the JSVM-API call is invoked under. + * @param data The data item that was previously associated with the currently running JSVM environment by * a call to OH_JSVM_SetInstanceData(). * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -347,8 +414,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetInstanceData(JSVM_Env env, * @brief This API retrieves a JSVM_ExtendedErrorInfo structure with information about the last error that * occurred. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param result: The JSVM_ExtendedErrorInfo structure with more information about the error. + * @param env The environment that the JSVM-API call is invoked under. + * @param result The JSVM_ExtendedErrorInfo structure with more information about the error. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -359,8 +426,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetLastErrorInfo(JSVM_Env env, /** * @brief This API throws the JavaScript value provided. * - * @param env: The environment that the API is invoked under. - * @param error: The JavaScript value to be thrown. + * @param env The environment that the API is invoked under. + * @param error The JavaScript value to be thrown. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -371,9 +438,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Throw(JSVM_Env env, /** * @brief This API throws a JavaScript Error with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional error code to be set on the error. - * @param msg: C string representing the text to be associated with the error. + * @param env The environment that the API is invoked under. + * @param code Optional error code to be set on the error. + * @param msg C string representing the text to be associated with the error. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -385,9 +452,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ThrowError(JSVM_Env env, /** * @brief This API throws a JavaScript TypeError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional error code to be set on the error. - * @param msg: C string representing the text to be associated with the error. + * @param env The environment that the API is invoked under. + * @param code Optional error code to be set on the error. + * @param msg C string representing the text to be associated with the error. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -399,9 +466,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ThrowTypeError(JSVM_Env env, /** * @brief This API throws a JavaScript RangeError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional error code to be set on the error. - * @param msg: C string representing the text to be associated with the error. + * @param env The environment that the API is invoked under. + * @param code Optional error code to be set on the error. + * @param msg C string representing the text to be associated with the error. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -413,9 +480,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ThrowRangeError(JSVM_Env env, /** * @brief This API throws a JavaScript SyntaxError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional error code to be set on the error. - * @param msg: C string representing the text to be associated with the error. + * @param env The environment that the API is invoked under. + * @param code Optional error code to be set on the error. + * @param msg C string representing the text to be associated with the error. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -427,9 +494,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ThrowSyntaxError(JSVM_Env env, /** * @brief This API queries a JSVM_Value to check if it represents an error object. * - * @param env: The environment that the API is invoked under. - * @param value: The JSVM_Value to be checked. - * @param result: Boolean value that is set to true if JSVM_Value represents an error, + * @param env The environment that the API is invoked under. + * @param value The JSVM_Value to be checked. + * @param result Boolean value that is set to true if JSVM_Value represents an error, * false otherwise. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -442,10 +509,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsError(JSVM_Env env, /** * @brief This API returns a JavaScript Error with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional JSVM_Value with the string for the error code to be associated with the error. - * @param msg: JSVM_Value that references a JavaScript string to be used as the message for the Error. - * @param result: JSVM_Value representing the error created. + * @param env The environment that the API is invoked under. + * @param code Optional JSVM_Value with the string for the error code to be associated with the error. + * @param msg JSVM_Value that references a JavaScript string to be used as the message for the Error. + * @param result JSVM_Value representing the error created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -458,10 +525,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateError(JSVM_Env env, /** * @brief This API returns a JavaScript TypeError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional JSVM_Value with the string for the error code to be associated with the error. - * @param msg: JSVM_Value that references a JavaScript string to be used as the message for the Error. - * @param result: JSVM_Value representing the error created. + * @param env The environment that the API is invoked under. + * @param code Optional JSVM_Value with the string for the error code to be associated with the error. + * @param msg JSVM_Value that references a JavaScript string to be used as the message for the Error. + * @param result JSVM_Value representing the error created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -474,10 +541,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateTypeError(JSVM_Env env, /** * @brief This API returns a JavaScript RangeError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional JSVM_Value with the string for the error code to be associated with the error. - * @param msg: JSVM_Value that references a JavaScript string to be used as the message for the Error. - * @param result: JSVM_Value representing the error created. + * @param env The environment that the API is invoked under. + * @param code Optional JSVM_Value with the string for the error code to be associated with the error. + * @param msg JSVM_Value that references a JavaScript string to be used as the message for the Error. + * @param result JSVM_Value representing the error created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -490,10 +557,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateRangeError(JSVM_Env env, /** * @brief This API returns a JavaScript SyntaxError with the text provided. * - * @param env: The environment that the API is invoked under. - * @param code: Optional JSVM_Value with the string for the error code to be associated with the error. - * @param msg: JSVM_Value that references a JavaScript string to be used as the message for the Error. - * @param result: JSVM_Value representing the error created. + * @param env The environment that the API is invoked under. + * @param code Optional JSVM_Value with the string for the error code to be associated with the error. + * @param msg JSVM_Value that references a JavaScript string to be used as the message for the Error. + * @param result JSVM_Value representing the error created. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -506,8 +573,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateSyntaxError(JSVM_Env env, /** * @brief This API returns a JavaScript exception if one is pending, NULL otherwise. * - * @param env: The environment that the API is invoked under. - * @param result: The exception if one is pending, NULL otherwise. + * @param env The environment that the API is invoked under. + * @param result The exception if one is pending, NULL otherwise. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -518,8 +585,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetAndClearLastException(JSVM_Env env, /** * @brief This API returns true if an exception is pending, false otherwise. * - * @param env: The environment that the API is invoked under. - * @param result: Boolean value that is set to true if an exception is pending. + * @param env The environment that the API is invoked under. + * @param result Boolean value that is set to true if an exception is pending. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -530,8 +597,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsExceptionPending(JSVM_Env env, /** * @brief This API opens a new scope. * - * @param env: The environment that the API is invoked under. - * @param result: JSVM_Value representing the new scope. + * @param env The environment that the API is invoked under. + * @param result JSVM_Value representing the new scope. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -543,8 +610,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenHandleScope(JSVM_Env env, * @brief This API closes the scope passed in. Scopes must be closed in the reverse * order from which they were created. * - * @param env: The environment that the API is invoked under. - * @param scope: JSVM_Value representing the scope to be closed. + * @param env The environment that the API is invoked under. + * @param scope JSVM_Value representing the scope to be closed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -555,8 +622,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CloseHandleScope(JSVM_Env env, /** * @brief This API opens a new scope from which one object can be promoted to the outer scope. * - * @param env: The environment that the API is invoked under. - * @param result: JSVM_Value representing the new scope. + * @param env The environment that the API is invoked under. + * @param result JSVM_Value representing the new scope. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -568,8 +635,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenEscapableHandleScope(JSVM_Env env, * @brief This API closes the scope passed in. Scopes must be closed in the reverse order * from which they were created. * - * @param env: The environment that the API is invoked under. - * @param scope: JSVM_Value representing the scope to be closed. + * @param env The environment that the API is invoked under. + * @param scope JSVM_Value representing the scope to be closed. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -582,10 +649,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CloseEscapableHandleScope(JSVM_Env env, * of the outer scope. It can only be called once per scope. If it is called more than once an error * will be returned. * - * @param env: The environment that the API is invoked under. - * @param scope: JSVM_Value representing the current scope. - * @param escapee: JSVM_Value representing the JavaScript Object to be escaped. - * @param result: JSVM_Value representing the handle to the escaped Object in the outer scope. + * @param env The environment that the API is invoked under. + * @param scope JSVM_Value representing the current scope. + * @param escapee JSVM_Value representing the JavaScript Object to be escaped. + * @param result JSVM_Value representing the handle to the escaped Object in the outer scope. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -598,10 +665,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_EscapeHandle(JSVM_Env env, /** * @brief This API creates a new reference with the specified reference count to the value passed in. * - * @param env: The environment that the API is invoked under. - * @param value: The JSVM_Value for which a reference is being created. - * @param initialRefcount: Initial reference count for the new reference. - * @param result: JSVM_Ref pointing to the new reference. + * @param env The environment that the API is invoked under. + * @param value The JSVM_Value for which a reference is being created. + * @param initialRefcount Initial reference count for the new reference. + * @param result JSVM_Ref pointing to the new reference. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -614,8 +681,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateReference(JSVM_Env env, /** * @brief his API deletes the reference passed in. * - * @param env: The environment that the API is invoked under. - * @param ref: JSVM_Ref to be deleted. + * @param env The environment that the API is invoked under. + * @param ref JSVM_Ref to be deleted. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -627,9 +694,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DeleteReference(JSVM_Env env, * @brief his API increments the reference count for the reference passed in and * returns the resulting reference count. * - * @param env: The environment that the API is invoked under. - * @param ref: JSVM_Ref for which the reference count will be incremented. - * @param result: The new reference count. + * @param env The environment that the API is invoked under. + * @param ref JSVM_Ref for which the reference count will be incremented. + * @param result The new reference count. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -642,9 +709,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ReferenceRef(JSVM_Env env, * @brief This API decrements the reference count for the reference passed in and * returns the resulting reference count. * - * @param env: The environment that the API is invoked under. - * @param ref: JSVM_Ref for which the reference count will be decremented. - * @param result: The new reference count. + * @param env The environment that the API is invoked under. + * @param ref JSVM_Ref for which the reference count will be decremented. + * @param result The new reference count. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -657,9 +724,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ReferenceUnref(JSVM_Env env, * @brief If still valid, this API returns the JSVM_Value representing the * JavaScript value associated with the JSVM_Ref. Otherwise, result will be NULL. * - * @param env: The environment that the API is invoked under. - * @param ref: The JSVM_Ref for which the corresponding value is being requested. - * @param result: The JSVM_Value referenced by the JSVM_Ref. + * @param env The environment that the API is invoked under. + * @param ref The JSVM_Ref for which the corresponding value is being requested. + * @param result The JSVM_Value referenced by the JSVM_Ref. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -671,8 +738,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetReferenceValue(JSVM_Env env, /** * @brief This API returns a JSVM-API value corresponding to a JavaScript Array type. * - * @param env: The environment that the API is invoked under. - * @param result: A JSVM_Value representing a JavaScript Array. + * @param env The environment that the API is invoked under. + * @param result A JSVM_Value representing a JavaScript Array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -686,9 +753,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateArray(JSVM_Env env, * is set to the passed-in length parameter. However, the underlying buffer is not guaranteed to be pre-allocated * by the VM when the array is created. That behavior is left to the underlying VM implementation. * - * @param env: The environment that the API is invoked under. - * @param length: The initial length of the Array. - * @param result: A JSVM_Value representing a JavaScript Array. + * @param env The environment that the API is invoked under. + * @param length The initial length of the Array. + * @param result A JSVM_Value representing a JavaScript Array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -705,10 +772,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateArrayWithLength(JSVM_Env env, * directly manipulate the buffer. This buffer can only be written to directly from native code. To write to this * buffer from JavaScript, a typed array or DataView object would need to be created. * - * @param env: The environment that the API is invoked under. - * @param byteLength: The length in bytes of the array buffer to create. - * @param data: Pointer to the underlying byte buffer of the ArrayBuffer.data can optionally be ignored by passing NULL. - * @param result: A JSVM_Value representing a JavaScript Array. + * @param env The environment that the API is invoked under. + * @param byteLength The length in bytes of the array buffer to create. + * @param data Pointer to the underlying byte buffer of the ArrayBuffer.data can optionally be ignored by passing NULL. + * @param result A JSVM_Value representing a JavaScript Array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -721,9 +788,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateArraybuffer(JSVM_Env env, /** * @brief This API allocate the memory of array buffer backing store. * - * @param byteLength: size of backing store memory. - * @param initialized: initialization status of the backing store memory. - * @param data: pointer that recieve the backing store memory pointer. + * @param byteLength size of backing store memory. + * @param initialized initialization status of the backing store memory. + * @param data pointer that recieve the backing store memory pointer. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if allocation succeed.\n * Returns {@link JSVM_INVALID_ARG } if data is null pointer.\n @@ -737,7 +804,7 @@ JSVM_Status JSVM_CDECL OH_JSVM_AllocateArrayBufferBackingStoreData(size_t byteLe /** * @brief This API release the memory of an array buffer backing store. * - * @param data: pointer to the backing store memory. + * @param data pointer to the backing store memory. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if run succeed.\n * Returns {@link JSVM_INVALID_ARG } if data is null pointer.\n @@ -748,12 +815,12 @@ JSVM_Status JSVM_CDECL OH_JSVM_FreeArrayBufferBackingStoreData(void *data); /** * @brief This API create an array buffer using the backing store data. * - * @param env: The environment that the API is invoked under. - * @param data: pointer to the backing store memory. - * @param backingStoreSize: size of backing store memory. - * @param offset: start position of the array buffer in the backing store memory. - * @param arrayBufferSize: size of the array buffer. - * @param result: pointer that recieve the array buffer. + * @param env The environment that the API is invoked under. + * @param data pointer to the backing store memory. + * @param backingStoreSize size of backing store memory. + * @param offset start position of the array buffer in the backing store memory. + * @param arrayBufferSize size of the array buffer. + * @param result pointer that recieve the array buffer. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if creation succeed.\n * Returns {@link JSVM_INVALID_ARG } if any of the following condition reached:\n @@ -773,9 +840,9 @@ JSVM_Status JSVM_CDECL OH_JSVM_CreateArrayBufferFromBackingStoreData(JSVM_Env en * @brief This API does not observe leap seconds; they are ignored, as ECMAScript aligns with POSIX time specification. * This API allocates a JavaScript Date object. * - * @param env: The environment that the API is invoked under. - * @param time: ECMAScript time value in milliseconds since 01 January, 1970 UTC. - * @param result: A JSVM_Value representing a JavaScript Date. + * @param env The environment that the API is invoked under. + * @param time ECMAScript time value in milliseconds since 01 January, 1970 UTC. + * @param result A JSVM_Value representing a JavaScript Date. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -789,14 +856,14 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateDate(JSVM_Env env, * data through JavaScript code, so it can be retrieved later by native code using OH_JSVM_GetValueExternal. * The API adds a JSVM_Finalize callback which will be called when the JavaScript object just created has been garbage * collected.The created value is not an object, and therefore does not support additional properties. It is considered - * a distinct value type: calling OH_JSVM_Typeof() with an external value yields JSVM_EXTERNAL. + * a distinct value type calling OH_JSVM_Typeof() with an external value yields JSVM_EXTERNAL. * - * @param env: The environment that the API is invoked under. - * @param data: Raw pointer to the external data. - * @param finalizeCb: Optional callback to call when the external value is being collected. JSVM_Finalize provides + * @param env The environment that the API is invoked under. + * @param data Raw pointer to the external data. + * @param finalizeCb Optional callback to call when the external value is being collected. JSVM_Finalize provides * more details. - * @param finalizeHint: Optional hint to pass to the finalize callback during collection. - * @param result: A JSVM_Value representing an external value. + * @param finalizeHint Optional hint to pass to the finalize callback during collection. + * @param result A JSVM_Value representing an external value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -810,8 +877,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateExternal(JSVM_Env env, /** * @brief This API allocates a default JavaScript Object. It is the equivalent of doing new Object() in JavaScript. * - * @param env: The environment that the API is invoked under. - * @param result: A JSVM_Value representing a JavaScript Object. + * @param env The environment that the API is invoked under. + * @param result A JSVM_Value representing a JavaScript Object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -822,10 +889,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateObject(JSVM_Env env, /** * @brief This API creates a JavaScript symbol value from a UTF8-encoded C string. * - * @param env: The environment that the API is invoked under. - * @param description: Optional JSVM_Value which refers to a JavaScript string to be set as the description + * @param env The environment that the API is invoked under. + * @param description Optional JSVM_Value which refers to a JavaScript string to be set as the description * for the symbol. - * @param result: A JSVM_Value representing a JavaScript symbol. + * @param result A JSVM_Value representing a JavaScript symbol. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -838,10 +905,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateSymbol(JSVM_Env env, * @brief This API searches in the global registry for an existing symbol with the given description. * If the symbol already exists it will be returned, otherwise a new symbol will be created in the registry. * - * @param env: The environment that the API is invoked under. - * @param utf8description: UTF-8 C string representing the text to be used as the description for the symbol. - * @param length: The length of the description string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. - * @param result: A JSVM_Value representing a JavaScript symbol. + * @param env The environment that the API is invoked under. + * @param utf8description UTF-8 C string representing the text to be used as the description for the symbol. + * @param length The length of the description string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. + * @param result A JSVM_Value representing a JavaScript symbol. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -857,12 +924,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_SymbolFor(JSVM_Env env, * same underlying binary scalar datatype.It's required that (length * size_of_element) + byte_offset should * be <= the size in bytes of the array passed in. If not, a RangeError exception is raised. * - * @param env: The environment that the API is invoked under. - * @param type: Scalar datatype of the elements within the TypedArray. - * @param length: Number of elements in the TypedArray. - * @param arraybuffer: ArrayBuffer underlying the typed array. - * @param byteOffset: The byte offset within the ArrayBuffer from which to start projecting the TypedArray. - * @param result: A JSVM_Value representing a JavaScript TypedArray + * @param env The environment that the API is invoked under. + * @param type Scalar datatype of the elements within the TypedArray. + * @param length Number of elements in the TypedArray. + * @param arraybuffer ArrayBuffer underlying the typed array. + * @param byteOffset The byte offset within the ArrayBuffer from which to start projecting the TypedArray. + * @param result A JSVM_Value representing a JavaScript TypedArray * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -881,11 +948,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateTypedarray(JSVM_Env env, * less than or equal to the size in bytes of the array passed in. If not, a RangeError exception * is raised. * - * @param env: The environment that the API is invoked under. - * @param length: Number of elements in the DataView. - * @param arraybuffer: ArrayBuffer underlying the DataView. - * @param byteOffset: The byte offset within the ArrayBuffer from which to start projecting the DataView. - * @param result:A JSVM_Value representing a JavaScript DataView. + * @param env The environment that the API is invoked under. + * @param length Number of elements in the DataView. + * @param arraybuffer ArrayBuffer underlying the DataView. + * @param byteOffset The byte offset within the ArrayBuffer from which to start projecting the DataView. + * @param result A JSVM_Value representing a JavaScript DataView. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -899,9 +966,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateDataview(JSVM_Env env, /** * @brief This API is used to convert from the C int32_t type to the JavaScript number type. * - * @param env: The environment that the API is invoked under. - * @param value: Integer value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript number. + * @param env The environment that the API is invoked under. + * @param value Integer value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -913,9 +980,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateInt32(JSVM_Env env, /** * @brief This API is used to convert from the C uint32_t type to the JavaScript number type. * - * @param env: The environment that the API is invoked under. - * @param value: Unsigned integer value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript number. + * @param env The environment that the API is invoked under. + * @param value Unsigned integer value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -927,9 +994,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateUint32(JSVM_Env env, /** * @brief This API is used to convert from the C int64_t type to the JavaScript number type. * - * @param env: The environment that the API is invoked under. - * @param value: Integer value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript number. + * @param env The environment that the API is invoked under. + * @param value Integer value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -941,9 +1008,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateInt64(JSVM_Env env, /** * @brief This API is used to convert from the C double type to the JavaScript number type. * - * @param env: The environment that the API is invoked under. - * @param value: Double-precision value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript number. + * @param env The environment that the API is invoked under. + * @param value Double-precision value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -955,9 +1022,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateDouble(JSVM_Env env, /** * @brief This API converts the C int64_t type to the JavaScript BigInt type. * - * @param env: The environment that the API is invoked under. - * @param value: Integer value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript BigInt. + * @param env The environment that the API is invoked under. + * @param value Integer value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript BigInt. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -969,9 +1036,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintInt64(JSVM_Env env, /** * @brief This API converts the C uint64_t type to the JavaScript BigInt type. * - * @param env: The environment that the API is invoked under. - * @param value: Unsigned integer value to be represented in JavaScript. - * @param result: A JSVM_Value representing a JavaScript BigInt. + * @param env The environment that the API is invoked under. + * @param value Unsigned integer value to be represented in JavaScript. + * @param result A JSVM_Value representing a JavaScript BigInt. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -982,13 +1049,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintUint64(JSVM_Env env, /** * @brief This API converts an array of unsigned 64-bit words into a single BigInt value. - * The resulting BigInt is calculated as: (–1)sign_bit (words[0] × (264)0 + words[1] × (264)1 + …) + * The resulting BigInt is calculated as (–1)sign_bit (words[0] × (264)0 + words[1] × (264)1 + …) * - * @param env: The environment that the API is invoked under. - * @param signBit: Determines if the resulting BigInt will be positive or negative. - * @param wordCount: The length of the words array. - * @param words: An array of uint64_t little-endian 64-bit words. - * @param result: A JSVM_Value representing a JavaScript BigInt. + * @param env The environment that the API is invoked under. + * @param signBit Determines if the resulting BigInt will be positive or negative. + * @param wordCount The length of the words array. + * @param words An array of uint64_t little-endian 64-bit words. + * @param result A JSVM_Value representing a JavaScript BigInt. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1003,10 +1070,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateBigintWords(JSVM_Env env, * @brief This API creates a JavaScript string value from an ISO-8859-1-encoded C * string. The native string is copied. * - * @param env: The environment that the API is invoked under. - * @param str: Character buffer representing an ISO-8859-1-encoded string. - * @param length: The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. - * @param result: A JSVM_Value representing a JavaScript string. + * @param env The environment that the API is invoked under. + * @param str Character buffer representing an ISO-8859-1-encoded string. + * @param length The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. + * @param result A JSVM_Value representing a JavaScript string. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1020,11 +1087,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringLatin1(JSVM_Env env, * @brief This API creates a JavaScript string value from a UTF16-LE-encoded C * string. The native string is copied. * - * @param env: The environment that the API is invoked under. - * @param str: Character buffer representing a UTF16-LE-encoded string. - * @param length: The length of the string in two-byte code units, or JSVM_AUTO_LENGTH + * @param env The environment that the API is invoked under. + * @param str Character buffer representing a UTF16-LE-encoded string. + * @param length The length of the string in two-byte code units, or JSVM_AUTO_LENGTH * if it is null-terminated. - * @param result: A JSVM_Value representing a JavaScript string. + * @param result A JSVM_Value representing a JavaScript string. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1038,10 +1105,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringUtf16(JSVM_Env env, * @brief This API creates a JavaScript string value from a UTF8-encoded C * string. The native string is copied. * - * @param env: The environment that the API is invoked under. - * @param str: Character buffer representing a UTF8-encoded string. - * @param length: The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. - * @param result: A JSVM_Value representing a JavaScript string. + * @param env The environment that the API is invoked under. + * @param str Character buffer representing a UTF8-encoded string. + * @param length The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. + * @param result A JSVM_Value representing a JavaScript string. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1054,9 +1121,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateStringUtf8(JSVM_Env env, /** * @brief This API returns the length of an array. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing the JavaScript Array whose length is being queried. - * @param result: uint32 representing length of the array. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing the JavaScript Array whose length is being queried. + * @param result uint32 representing length of the array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1068,11 +1135,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetArrayLength(JSVM_Env env, /** * @brief This API is used to retrieve the underlying data buffer of an ArrayBuffer and its length. * - * @param env: The environment that the API is invoked under. - * @param arraybuffer: JSVM_Value representing the ArrayBuffer being queried. - * @param data: The underlying data buffer of the ArrayBuffer. If byte_length is 0, this may be NULL + * @param env The environment that the API is invoked under. + * @param arraybuffer JSVM_Value representing the ArrayBuffer being queried. + * @param data The underlying data buffer of the ArrayBuffer. If byte_length is 0, this may be NULL * or any other pointer value. - * @param byteLength: Length in bytes of the underlying data buffer. + * @param byteLength Length in bytes of the underlying data buffer. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1085,10 +1152,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetArraybufferInfo(JSVM_Env env, /** * @brief This API returns the length of an array. * - * @param env: The environment that the API is invoked under. - * @param object: JSVM_Value representing JavaScript Object whose prototype to return. This returns + * @param env The environment that the API is invoked under. + * @param object JSVM_Value representing JavaScript Object whose prototype to return. This returns * the equivalent of Object.getPrototypeOf (which is not the same as the function's prototype property). - * @param result: JSVM_Value representing prototype of the given object. + * @param result JSVM_Value representing prototype of the given object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1100,15 +1167,15 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetPrototype(JSVM_Env env, /** * @brief This API returns various properties of a typed array. * - * @param env: The environment that the API is invoked under. - * @param typedarray: JSVM_Value representing the TypedArray whose properties to query. - * @param type: Scalar datatype of the elements within the TypedArray. - * @param length: The number of elements in the TypedArray. - * @param data: The data buffer underlying the TypedArray adjusted by the byte_offset value so that it + * @param env The environment that the API is invoked under. + * @param typedarray JSVM_Value representing the TypedArray whose properties to query. + * @param type Scalar datatype of the elements within the TypedArray. + * @param length The number of elements in the TypedArray. + * @param data The data buffer underlying the TypedArray adjusted by the byte_offset value so that it * points to the first element in the TypedArray. If the length of the array is 0, this may be NULL or * any other pointer value. - * @param arraybuffer: The ArrayBuffer underlying the TypedArray. - * @param byteOffset: The byte offset within the underlying native array at which the first element of + * @param arraybuffer The ArrayBuffer underlying the TypedArray. + * @param byteOffset The byte offset within the underlying native array at which the first element of * the arrays is located. The value for the data parameter has already been adjusted so that data points * to the first element in the array. Therefore, the first byte of the native array would be at data - byte_offset. * @return Returns JSVM funtions result code. @@ -1127,13 +1194,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetTypedarrayInfo(JSVM_Env env, * @brief Any of the out parameters may be NULL if that property is unneeded. * This API returns various properties of a DataView. * - * @param env: The environment that the API is invoked under. - * @param dataview: JSVM_Value representing the DataView whose properties to query. - * @param bytelength: Number of bytes in the DataView. - * @param data: The data buffer underlying the DataView. + * @param env The environment that the API is invoked under. + * @param dataview JSVM_Value representing the DataView whose properties to query. + * @param bytelength Number of bytes in the DataView. + * @param data The data buffer underlying the DataView. * If byte_length is 0, this may be NULL or any other pointer value. - * @param arraybuffer: ArrayBuffer underlying the DataView. - * @param byteOffset: The byte offset within the data buffer from which to start projecting the DataView. + * @param arraybuffer ArrayBuffer underlying the DataView. + * @param byteOffset The byte offset within the data buffer from which to start projecting the DataView. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1150,9 +1217,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetDataviewInfo(JSVM_Env env, * passed in it returns JSVM_date_expected.This API returns the C double * primitive of time value for the given JavaScript Date. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing a JavaScript Date. - * @param result: Time value as a double represented as milliseconds + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing a JavaScript Date. + * @param result Time value as a double represented as milliseconds * since midnight at the beginning of 01 January, 1970 UTC. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -1166,9 +1233,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetDateValue(JSVM_Env env, /** * @brief This API returns the C boolean primitive equivalent of the given JavaScript Boolean. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript Boolean. - * @param result: C boolean primitive equivalent of the given JavaScript Boolean. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript Boolean. + * @param result C boolean primitive equivalent of the given JavaScript Boolean. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_BOOLEAN_EXPECTED }If a non-boolean JSVM_Value is passed in it.\n @@ -1181,9 +1248,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBool(JSVM_Env env, /** * @brief This API returns the C double primitive equivalent of the given JavaScript number. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript number. - * @param result: C double primitive equivalent of the given JavaScript number. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript number. + * @param result C double primitive equivalent of the given JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1197,10 +1264,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueDouble(JSVM_Env env, * @brief This API returns the C int64_t primitive equivalent of the given JavaScript BigInt. * If needed it will truncate the value, setting lossless to false. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript BigInt. - * @param result: C int64_t primitive equivalent of the given JavaScript BigInt. - * @param lossless: Indicates whether the BigInt value was converted losslessly. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript BigInt. + * @param result C int64_t primitive equivalent of the given JavaScript BigInt. + * @param lossless Indicates whether the BigInt value was converted losslessly. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_BIGINT_EXPECTED } If a non-BigInt is passed in it.\n @@ -1215,10 +1282,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintInt64(JSVM_Env env, * @brief This API returns the C uint64_t primitive equivalent of the given JavaScript BigInt. * If needed it will truncate the value, setting lossless to false. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript BigInt. - * @param result: C uint64_t primitive equivalent of the given JavaScript BigInt. - * @param lossless: Indicates whether the BigInt value was converted losslessly. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript BigInt. + * @param result C uint64_t primitive equivalent of the given JavaScript BigInt. + * @param lossless Indicates whether the BigInt value was converted losslessly. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_BIGINT_EXPECTED } If a non-BigInt is passed in it.\n @@ -1233,12 +1300,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintUint64(JSVM_Env env, * @brief This API converts a single BigInt value into a sign bit, 64-bit little-endian array, and the number * of elements in the array. signBit and words may be both set to NULL, in order to get only wordCount. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript BigInt. - * @param signBit: Integer representing if the JavaScript BigInt is positive or negative. - * @param wordCount: Must be initialized to the length of the words array. Upon return, it will be set to + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript BigInt. + * @param signBit Integer representing if the JavaScript BigInt is positive or negative. + * @param wordCount Must be initialized to the length of the words array. Upon return, it will be set to * the actual number of words that would be needed to store this BigInt. - * @param words: Pointer to a pre-allocated 64-bit word array. + * @param words Pointer to a pre-allocated 64-bit word array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1252,9 +1319,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueBigintWords(JSVM_Env env, /** * @brief This API retrieves the external data pointer that was previously passed to OH_JSVM_CreateExternal(). * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript external value. - * @param result: Pointer to the data wrapped by the JavaScript external value. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript external value. + * @param result Pointer to the data wrapped by the JavaScript external value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_INVALID_ARG } If a non-external JSVM_Value is passed in it.\n @@ -1267,9 +1334,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueExternal(JSVM_Env env, /** * @brief This API returns the C int32 primitive equivalent of the given JavaScript number. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript number. - * @param result: C int32 primitive equivalent of the given JavaScript number. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript number. + * @param result C int32 primitive equivalent of the given JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1282,9 +1349,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueInt32(JSVM_Env env, /** * @brief This API returns the C int64 primitive equivalent of the given JavaScript number. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript number. - * @param result: C int64 primitive equivalent of the given JavaScript number. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript number. + * @param result C int64 primitive equivalent of the given JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1297,13 +1364,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueInt64(JSVM_Env env, /** * @brief This API returns the ISO-8859-1-encoded string corresponding the value passed in. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript string. - * @param buf: Buffer to write the ISO-8859-1-encoded string into. If NULL is passed in, the + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript string. + * @param buf Buffer to write the ISO-8859-1-encoded string into. If NULL is passed in, the * length of the string in bytes and excluding the null terminator is returned in result. - * @param bufsize: Size of the destination buffer. When this value is insufficient, the returned string + * @param bufsize Size of the destination buffer. When this value is insufficient, the returned string * is truncated and null-terminated. - * @param result: Number of bytes copied into the buffer, excluding the null terminator. + * @param result Number of bytes copied into the buffer, excluding the null terminator. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1318,13 +1385,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringLatin1(JSVM_Env env, /** * @brief This API returns the UTF8-encoded string corresponding the value passed in. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript string. - * @param buf: Buffer to write the UTF8-encoded string into. If NULL is passed in, the length + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript string. + * @param buf Buffer to write the UTF8-encoded string into. If NULL is passed in, the length * of the string in bytes and excluding the null terminator is returned in result. - * @param bufsize: Size of the destination buffer. When this value is insufficient, the returned + * @param bufsize Size of the destination buffer. When this value is insufficient, the returned * string is truncated and null-terminated. - * @param result: Number of bytes copied into the buffer, excluding the null terminator. + * @param result Number of bytes copied into the buffer, excluding the null terminator. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1339,13 +1406,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringUtf8(JSVM_Env env, /** * @brief This API returns the UTF16-encoded string corresponding the value passed in. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript string. - * @param buf: Buffer to write the UTF16-LE-encoded string into. If NULL is passed in, + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript string. + * @param buf Buffer to write the UTF16-LE-encoded string into. If NULL is passed in, * the length of the string in 2-byte code units and excluding the null terminator is returned. - * @param bufsize: Size of the destination buffer. When this value is insufficient, + * @param bufsize Size of the destination buffer. When this value is insufficient, * the returned string is truncated and null-terminated. - * @param result: Number of 2-byte code units copied into the buffer, excluding the null terminator. + * @param result Number of 2-byte code units copied into the buffer, excluding the null terminator. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in.\n @@ -1360,9 +1427,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueStringUtf16(JSVM_Env env, /** * @brief This API returns the C primitive equivalent of the given JSVM_Value as a uint32_t. * - * @param env: The environment that the API is invoked under. - * @param value: JSVM_Value representing JavaScript number. - * @param result: C primitive equivalent of the given JSVM_Value as a uint32_t. + * @param env The environment that the API is invoked under. + * @param value JSVM_Value representing JavaScript number. + * @param result C primitive equivalent of the given JSVM_Value as a uint32_t. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_NUMBER_EXPECTED } If a non-number JSVM_Value is passed in it.\n @@ -1375,9 +1442,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetValueUint32(JSVM_Env env, /** * @brief This API is used to return the JavaScript singleton object that is used to represent the given boolean value. * - * @param env: The environment that the API is invoked under. - * @param value: The value of the boolean to retrieve. - * @param result: JSVM_Value representing JavaScript Boolean singleton to retrieve. + * @param env The environment that the API is invoked under. + * @param value The value of the boolean to retrieve. + * @param result JSVM_Value representing JavaScript Boolean singleton to retrieve. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1389,8 +1456,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetBoolean(JSVM_Env env, /** * @brief This API returns the global object. * - * @param env: The environment that the API is invoked under. - * @param result: JSVM_Value representing JavaScript global object. + * @param env The environment that the API is invoked under. + * @param result JSVM_Value representing JavaScript global object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1401,8 +1468,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetGlobal(JSVM_Env env, /** * @brief This API returns the null object. * - * @param env: The environment that the API is invoked under. - * @param result: JSVM_Value representing JavaScript null object. + * @param env The environment that the API is invoked under. + * @param result JSVM_Value representing JavaScript null object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1413,8 +1480,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetNull(JSVM_Env env, /** * @brief This API returns the Undefined object. * - * @param env: The environment that the API is invoked under. - * @param result: JSVM_Value representing JavaScript Undefined value. + * @param env The environment that the API is invoked under. + * @param result JSVM_Value representing JavaScript Undefined value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1425,9 +1492,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetUndefined(JSVM_Env env, /** * @brief This API implements the abstract operation ToBoolean() * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to coerce. - * @param result: JSVM_Value representing the coerced JavaScript Boolean. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to coerce. + * @param result JSVM_Value representing the coerced JavaScript Boolean. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1440,9 +1507,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToBool(JSVM_Env env, * @brief This API implements the abstract operation ToNumber() as defined. This * function potentially runs JS code if the passed-in value is an object. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to coerce. - * @param result: JSVM_Value representing the coerced JavaScript number. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to coerce. + * @param result JSVM_Value representing the coerced JavaScript number. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1454,9 +1521,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToNumber(JSVM_Env env, /** * @brief This API implements the abstract operation ToObject(). * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to coerce. - * @param result: JSVM_Value representing the coerced JavaScript Object. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to coerce. + * @param result JSVM_Value representing the coerced JavaScript Object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1469,9 +1536,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToObject(JSVM_Env env, * @brief This API implements the abstract operation ToString().This * function potentially runs JS code if the passed-in value is an object. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to coerce. - * @param result: JSVM_Value representing the coerced JavaScript string. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to coerce. + * @param result JSVM_Value representing the coerced JavaScript string. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1487,9 +1554,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToString(JSVM_Env env, * ECMAScript typeof would detect object.If value has a type that is invalid, * an error is returned. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value whose type to query. - * @param result: The type of the JavaScript value. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value whose type to query. + * @param result The type of the JavaScript value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1501,11 +1568,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Typeof(JSVM_Env env, /** * @brief This API represents invoking the instanceof Operator on the object. * - * @param env: The environment that the API is invoked under. - * @param object: The JavaScript value to check. - * @param constructor: The JavaScript function object of the constructor function + * @param env The environment that the API is invoked under. + * @param object The JavaScript value to check. + * @param constructor The JavaScript function object of the constructor function * to check against. - * @param result: Boolean that is set to true if object instanceof constructor is true. + * @param result Boolean that is set to true if object instanceof constructor is true. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1518,9 +1585,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Instanceof(JSVM_Env env, /** * @brief This API represents invoking the IsArray operation on the object * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given object is an array. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given object is an array. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1532,9 +1599,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsArray(JSVM_Env env, /** * @brief This API checks if the Object passed in is an array buffer. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given object is an ArrayBuffer. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given object is an ArrayBuffer. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1546,9 +1613,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsArraybuffer(JSVM_Env env, /** * @brief This API checks if the Object passed in is a date. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given JSVM_Value represents a JavaScript Date object. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isDate Whether the given JSVM_Value represents a JavaScript Date object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1560,9 +1627,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsDate(JSVM_Env env, /** * @brief This API checks if the Object passed in is a typed array. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given JSVM_Value represents a TypedArray. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given JSVM_Value represents a TypedArray. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1574,9 +1641,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsTypedarray(JSVM_Env env, /** * @brief This API checks if the Object passed in is a DataView. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given JSVM_Value represents a DataView. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given JSVM_Value represents a DataView. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1588,10 +1655,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsDataview(JSVM_Env env, /** * @brief This API represents the invocation of the Strict Equality algorithm. * - * @param env: The environment that the API is invoked under. - * @param lhs: The JavaScript value to check. - * @param rhs: The JavaScript value to check against. - * @param result: Whether the two JSVM_Value objects are equal. + * @param env The environment that the API is invoked under. + * @param lhs The JavaScript value to check. + * @param rhs The JavaScript value to check against. + * @param result Whether the two JSVM_Value objects are equal. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1605,10 +1672,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_StrictEquals(JSVM_Env env, * @brief This API represents the invocation of the Relaxed Equality algorithm. * Returns true as long as the values are equal, regardless of type. * - * @param env: The environment that the API is invoked under. - * @param lhs: The JavaScript value to check. - * @param rhs: The JavaScript value to check against. - * @param result: Whether the two JSVM_Value objects are relaxed equal. + * @param env The environment that the API is invoked under. + * @param lhs The JavaScript value to check. + * @param rhs The JavaScript value to check against. + * @param result Whether the two JSVM_Value objects are relaxed equal. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -1621,8 +1688,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Equals(JSVM_Env env, /** * @brief This API represents the invocation of the ArrayBuffer detach operation. * - * @param env: The environment that the API is invoked under. - * @param arraybuffer: The JavaScript ArrayBuffer to be detached. + * @param env The environment that the API is invoked under. + * @param arraybuffer The JavaScript ArrayBuffer to be detached. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_DETACHABLE_ARRAYBUFFER_EXPECTED } If a non-detachable ArrayBuffer is passed in it.\n @@ -1634,9 +1701,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DetachArraybuffer(JSVM_Env env, /** * @brief This API represents the invocation of the ArrayBuffer IsDetachedBuffer operation. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript ArrayBuffer to be checked. - * @param result: Whether the arraybuffer is detached. + * @param env The environment that the API is invoked under. + * @param value The JavaScript ArrayBuffer to be checked. + * @param result Whether the arraybuffer is detached. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1649,9 +1716,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsDetachedArraybuffer(JSVM_Env env, * @brief This API returns the names of the enumerable properties of object as an array of * strings. The properties of object whose key is a symbol will not be included. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the properties. - * @param result: A JSVM_Value representing an array of JavaScript values that represent + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the properties. + * @param result A JSVM_Value representing an array of JavaScript values that represent * the property names of the object. The API can be used to iterate over result using * OH_JSVM_GetArrayLength and OH_JSVM_GetElement. * @return Returns JSVM funtions result code. @@ -1666,12 +1733,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetPropertyNames(JSVM_Env env, * @brief This API returns an array containing the names of the available properties * of this object. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the properties. - * @param keyMode: Whether to retrieve prototype properties as well. - * @param keyFilter: Which properties to retrieve (enumerable/readable/writable). - * @param keyConversion: Whether to convert numbered property keys to strings. - * @param result: result: A JSVM_Value representing an array of JavaScript values + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the properties. + * @param keyMode Whether to retrieve prototype properties as well. + * @param keyFilter Which properties to retrieve (enumerable/readable/writable). + * @param keyConversion Whether to convert numbered property keys to strings. + * @param result A JSVM_Value representing an array of JavaScript values * that represent the property names of the object. OH_JSVM_GetArrayLength and * OH_JSVM_GetElement can be used to iterate over result. * @return Returns JSVM funtions result code. @@ -1688,10 +1755,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetAllPropertyNames(JSVM_Env env, /** * @brief This API set a property on the Object passed in. * - * @param env: The environment that the API is invoked under. - * @param object: The object on which to set the property. - * @param key: The name of the property to set. - * @param value: The property value. + * @param env The environment that the API is invoked under. + * @param object The object on which to set the property. + * @param key The name of the property to set. + * @param value The property value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1704,10 +1771,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_SetProperty(JSVM_Env env, /** * @brief This API gets the requested property from the Object passed in. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the property. - * @param key: The name of the property to retrieve. - * @param result: The value of the property. + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the property. + * @param key The name of the property to retrieve. + * @param result The value of the property. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1720,10 +1787,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetProperty(JSVM_Env env, /** * @brief This API checks if the Object passed in has the named property. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param key: The name of the property whose existence to check. - * @param result: Whether the property exists on the object or not. + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param key The name of the property whose existence to check. + * @param result Whether the property exists on the object or not. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1736,10 +1803,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_HasProperty(JSVM_Env env, /** * @brief This API attempts to delete the key own property from object. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param key: The name of the property to delete. - * @param result: Whether the property deletion succeeded or not. result + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param key The name of the property to delete. + * @param result Whether the property deletion succeeded or not. result * can optionally be ignored by passing NULL. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -1755,10 +1822,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DeleteProperty(JSVM_Env env, * key must be a string or a symbol, or an error will be thrown. JSVM-API will * not perform any conversion between data types. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param key: The name of the own property whose existence to check. - * @param result: Whether the own property exists on the object or not. + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param key The name of the own property whose existence to check. + * @param result Whether the own property exists on the object or not. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1770,12 +1837,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_HasOwnProperty(JSVM_Env env, /** * @brief This method is equivalent to calling OH_JSVM_SetProperty with - * a JSVM_Value created from the string passed in as utf8Name. + * a JSVM_Value created from the string passed in as utf8name. * - * @param env: The environment that the API is invoked under. - * @param object: The object on which to set the property. - * @param utf8Name: The name of the property to set. - * @param value: The property value. + * @param env The environment that the API is invoked under. + * @param object The object on which to set the property. + * @param utf8name The name of the property to set. + * @param value The property value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1787,12 +1854,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_SetNamedProperty(JSVM_Env env, /** * @brief This method is equivalent to calling OH_JSVM_SetProperty with - * a JSVM_Value created from the string passed in as utf8Name. + * a JSVM_Value created from the string passed in as utf8name. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the property. - * @param utf8Name: The name of the property to get. - * @param result: The value of the property. + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the property. + * @param utf8name The name of the property to get. + * @param result The value of the property. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1804,12 +1871,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetNamedProperty(JSVM_Env env, /** * @brief This method is equivalent to calling OH_JSVM_SetProperty with - * a JSVM_Value created from the string passed in as utf8Name. + * a JSVM_Value created from the string passed in as utf8name. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param utf8Name: The name of the property whose existence to check. - * @param result: Whether the property exists on the object or not. + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param utf8name The name of the property whose existence to check. + * @param result Whether the property exists on the object or not. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1822,10 +1889,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_HasNamedProperty(JSVM_Env env, /** * @brief This API sets an element on the Object passed in. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to set the properties. - * @param index: The index of the property to set. - * @param value: The property value. + * @param env The environment that the API is invoked under. + * @param object The object from which to set the properties. + * @param index The index of the property to set. + * @param value The property value. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1838,10 +1905,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_SetElement(JSVM_Env env, /** * @brief This API gets the element at the requested index. * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the property. - * @param index: The index of the property to get. - * @param result: The value of the property. + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the property. + * @param index The index of the property to get. + * @param result The value of the property. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1855,10 +1922,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetElement(JSVM_Env env, * @brief This API returns if the Object passed in has an element * at the requested index. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param index: The index of the property whose existence to check. - * @param result: Whether the property exists on the object or not. + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param index The index of the property whose existence to check. + * @param result Whether the property exists on the object or not. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1871,10 +1938,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_HasElement(JSVM_Env env, /** * @brief This API attempts to delete the specified index from object. * - * @param env: The environment that the API is invoked under. - * @param object: The object to query. - * @param index: The index of the property to delete. - * @param result: Whether the element deletion succeeded or not. result + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param index The index of the property to delete. + * @param result Whether the element deletion succeeded or not. result * can optionally be ignored by passing NULL. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -1891,10 +1958,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DeleteElement(JSVM_Env env, * Given an array of such property descriptors, this API will set the properties * on the object one at a time, as defined by DefineOwnProperty(). * - * @param env: The environment that the API is invoked under. - * @param object: The object from which to retrieve the properties. - * @param propertyCount: The number of elements in the properties array. - * @param properties: The array of property descriptors. + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the properties. + * @param propertyCount The number of elements in the properties array. + * @param properties The array of property descriptors. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1911,8 +1978,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DefineProperties(JSVM_Env env, * properties, and prevents the values of existing properties from being changed. * It also prevents the object's prototype from being changed. * - * @param env: The environment that the API is invoked under. - * @param object: The object to freeze. + * @param env The environment that the API is invoked under. + * @param object The object to freeze. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1924,8 +1991,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ObjectFreeze(JSVM_Env env, * @brief This method seals a given object. This prevents new properties * from being added to it, as well as marking all existing properties as non-configurable. * - * @param env: The environment that the API is invoked under. - * @param object: The object to seal. + * @param env The environment that the API is invoked under. + * @param object The object to seal. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1938,12 +2005,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ObjectSeal(JSVM_Env env, * a native add-on. This is the primary mechanism of calling back from the * add-on's native code into JavaScript. * - * @param env: The environment that the API is invoked under. - * @param recv: The this value passed to the called function. - * @param func: JSVM_Value representing the JavaScript function to be invoked. - * @param argc: The count of elements in the argv array. - * @param argv: Array of JSVM_values representing JavaScript values passed in as arguments to the function. - * @param result: JSVM_Value representing the JavaScript object returned. + * @param env The environment that the API is invoked under. + * @param recv The this value passed to the called function. + * @param func JSVM_Value representing the JavaScript function to be invoked. + * @param argc The count of elements in the argv array. + * @param argv Array of JSVM_values representing JavaScript values passed in as arguments to the function. + * @param result JSVM_Value representing the JavaScript object returned. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -1963,14 +2030,14 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CallFunction(JSVM_Env env, * object that is visible to JavaScript, in order for the function to be accessible * from script. * - * @param env: The environment that the API is invoked under. - * @param utf8Name: Optional name of the function encoded as UTF8. This is visible + * @param env The environment that the API is invoked under. + * @param utf8name Optional name of the function encoded as UTF8. This is visible * within JavaScript as the new function object's name property. - * @param length: The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it + * @param length The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it * is null-terminated. - * @param cb: The native function which should be called when this function + * @param cb The native function which should be called when this function * object is invoked and data. JSVM_Callback provides more details. - * @param result: JSVM_Value representing the JavaScript function object for the newly + * @param result JSVM_Value representing the JavaScript function object for the newly * created function. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -1986,18 +2053,18 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateFunction(JSVM_Env env, * @brief This method is used within a callback function to retrieve details about * the call like the arguments and the this pointer from a given callback info. * - * @param env: The environment that the API is invoked under. - * @param cbinfo: The callback info passed into the callback function. - * @param argc: Specifies the length of the provided argv array and receives the + * @param env The environment that the API is invoked under. + * @param cbinfo The callback info passed into the callback function. + * @param argc Specifies the length of the provided argv array and receives the * actual count of arguments. argc can optionally be ignored by passing NULL. - * @param argv: C array of JSVM_values to which the arguments will be copied. If + * @param argv C array of JSVM_values to which the arguments will be copied. If * there are more arguments than the provided count, only the requested number of * arguments are copied. If there are fewer arguments provided than claimed, the * rest of argv is filled with JSVM_Value values that represent undefined. argv * can optionally be ignored by passing NULL. - * @param thisArg: Receives the JavaScript this argument for the call. thisArg + * @param thisArg Receives the JavaScript this argument for the call. thisArg * can optionally be ignored by passing NULL. - * @param data: Receives the data pointer for the callback. data can optionally + * @param data Receives the data pointer for the callback. data can optionally * be ignored by passing NULL. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -2014,9 +2081,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetCbInfo(JSVM_Env env, * @brief This API returns the new.target of the constructor call. If the * current callback is not a constructor call, the result is NULL. * - * @param env: The environment that the API is invoked under. - * @param cbinfo: The callback info passed into the callback function. - * @param result: The new.target of the constructor call. + * @param env The environment that the API is invoked under. + * @param cbinfo The callback info passed into the callback function. + * @param result The new.target of the constructor call. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2029,12 +2096,12 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetNewTarget(JSVM_Env env, * @brief his method is used to instantiate a new JavaScript value using * a given JSVM_Value that represents the constructor for the object. * - * @param env: The environment that the API is invoked under. - * @param constructor: JSVM_Value representing the JavaScript function to be invoked as a constructor. - * @param argc: The count of elements in the argv array. - * @param argv: Array of JavaScript values as JSVM_Value representing the arguments to + * @param env The environment that the API is invoked under. + * @param constructor JSVM_Value representing the JavaScript function to be invoked as a constructor. + * @param argc The count of elements in the argv array. + * @param argv Array of JavaScript values as JSVM_Value representing the arguments to * the constructor. If argc is zero this parameter may be omitted by passing in NULL. - * @param result: JSVM_Value representing the JavaScript object returned, which + * @param result JSVM_Value representing the JavaScript object returned, which * in this case is the constructed object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -2051,20 +2118,20 @@ JSVM_EXTERN JSVM_Status OH_JSVM_NewInstance(JSVM_Env env, * should be a static method on the class that calls the actual class constructor, then * wraps the new C++ instance in a JavaScript object, and returns the wrapper object. * - * @param env: The environment that the API is invoked under. - * @param utf8name: Name of the JavaScript constructor function. For clarity, it is + * @param env The environment that the API is invoked under. + * @param utf8name Name of the JavaScript constructor function. For clarity, it is * recommended to use the C++ class name when wrapping a C++ class. - * @param length: The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it + * @param length The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it * is null-terminated. - * @param constructor: Struct include callback function that handles constructing instances of the class. + * @param constructor Struct include callback function that handles constructing instances of the class. * When wrapping a C++ class, this method must be a static member with the JSVM_Callback.callback * signature. A C++ class constructor cannot be used. * Include Optional data to be passed to the constructor callback as the data * property of the callback info. JSVM_Callback provides more details. - * @param propertyCount: Number of items in the properties array argument. - * @param properties: Array of property descriptors describing static and instance data + * @param propertyCount Number of items in the properties array argument. + * @param properties Array of property descriptors describing static and instance data * properties, accessors, and methods on the class See JSVM_PropertyDescriptor. - * @param result: A JSVM_Value representing the constructor function for the class. + * @param result A JSVM_Value representing the constructor function for the class. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2081,14 +2148,14 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DefineClass(JSVM_Env env, * @brief Wraps a native instance in a JavaScript object. The native instance can * be retrieved later using OH_JSVM_Unwrap(). * - * @param env: The environment that the API is invoked under. - * @param jsObject: The JavaScript object that will be the wrapper for the native object. - * @param nativeObject: The native instance that will be wrapped in the JavaScript object. - * @param finalizeCb: Optional native callback that can be used to free the native instance + * @param env The environment that the API is invoked under. + * @param jsObject The JavaScript object that will be the wrapper for the native object. + * @param nativeObject The native instance that will be wrapped in the JavaScript object. + * @param finalizeCb Optional native callback that can be used to free the native instance * when the JavaScript object has been garbage-collected. - * @param finalizeHint: Optional contextual hint that is passed to the finalize callback. + * @param finalizeHint Optional contextual hint that is passed to the finalize callback. * properties, accessors, and methods on the class See JSVM_PropertyDescriptor. - * @param result: Optional reference to the wrapped object. + * @param result Optional reference to the wrapped object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2106,9 +2173,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Wrap(JSVM_Env env, * argument to the callback is the wrapper object; the wrapped C++ instance that is the target of * the call can be obtained then by calling OH_JSVM_Unwrap() on the wrapper object. * - * @param env: The environment that the API is invoked under. - * @param jsObject: The object associated with the native instance. - * @param result: Pointer to the wrapped native instance. + * @param env The environment that the API is invoked under. + * @param jsObject The object associated with the native instance. + * @param result Pointer to the wrapped native instance. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2122,9 +2189,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_Unwrap(JSVM_Env env, * using OH_JSVM_Wrap() and removes the wrapping. If a finalize callback was associated with the wrapping, * it will no longer be called when the JavaScript object becomes garbage-collected. * - * @param env: The environment that the API is invoked under. - * @param jsObject: The object associated with the native instance. - * @param result: Pointer to the wrapped native instance. + * @param env The environment that the API is invoked under. + * @param jsObject The object associated with the native instance. + * @param result Pointer to the wrapped native instance. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2139,9 +2206,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RemoveWrap(JSVM_Env env, * object with one owned by the addon to ensure that the object has the right type. * If the object already has an associated type tag, this API will return JSVM_INVALID_ARG. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript object or external to be marked. - * @param typeTag: The tag with which the object is to be marked. + * @param env The environment that the API is invoked under. + * @param value The JavaScript object or external to be marked. + * @param typeTag The tag with which the object is to be marked. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * {@link JSVM_INVALID_ARG } If the object already has an associated type tag.\n @@ -2156,10 +2223,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TypeTagObject(JSVM_Env env, * If no tag is found on js object or, if a tag is found but it does not match typeTag, * then result is set to false. If a tag is found and it matches typeTag, then result is set to true. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript object or external whose type tag to examine. - * @param typeTag: The tag with which to compare any tag found on the object. - * @param result: Whether the type tag given matched the type tag on the object. false is also returned + * @param env The environment that the API is invoked under. + * @param value The JavaScript object or external whose type tag to examine. + * @param typeTag The tag with which to compare any tag found on the object. + * @param result Whether the type tag given matched the type tag on the object. false is also returned * if no type tag was found on the object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n @@ -2173,13 +2240,13 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CheckObjectTypeTag(JSVM_Env env, /** * @brief This API can be called multiple times on a single JavaScript object. * - * @param env: The environment that the API is invoked under. - * @param jsObject: The JavaScript object to which the native data will be attached. - * @param finalizeData: Optional data to be passed to finalizeCb. - * @param finalizeCb: Native callback that will be used to free the native data when the + * @param env The environment that the API is invoked under. + * @param jsObject The JavaScript object to which the native data will be attached. + * @param finalizeData Optional data to be passed to finalizeCb. + * @param finalizeCb Native callback that will be used to free the native data when the * JavaScript object has been garbage-collected. JSVM_Finalize provides more details. - * @param finalizeHint: Optional contextual hint that is passed to the finalize callback. - * @param result: Optional reference to the JavaScript object. + * @param finalizeHint Optional contextual hint that is passed to the finalize callback. + * @param result Optional reference to the JavaScript object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2198,8 +2265,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_AddFinalizer(JSVM_Env env, * API functions. In order to allow an addon to use a newer function when running with versions * of JSVM that support it, while providing fallback behavior when running with JSVM * versions that don't support it. - * @param env: The environment that the API is invoked under. - * @param result: The highest version of JSVM-API supported. + * @param env The environment that the API is invoked under. + * @param result The highest version of JSVM-API supported. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2210,7 +2277,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetVersion(JSVM_Env env, /** * @brief Return information of the VM. * - * @param result: The information of the VM. + * @param result The information of the VM. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2224,10 +2291,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetVMInfo(JSVM_VMInfo* result); * externally allocated memory will trigger global garbage collections more often * than it would otherwise. * - * @param env: The environment that the API is invoked under. - * @param changeInBytes: The change in externally allocated memory that is kept + * @param env The environment that the API is invoked under. + * @param changeInBytes The change in externally allocated memory that is kept * alive by JavaScript objects. - * @param result: The adjusted value + * @param result The adjusted value * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2240,8 +2307,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_AdjustExternalMemory(JSVM_Env env, * @brief This function notifies the VM that the system is running low on memory * and optionally triggers a garbage collection. * - * @param env: The environment that the API is invoked under. - * @param level: The memory pressure level set to the current VM. + * @param env The environment that the API is invoked under. + * @param level The memory pressure level set to the current VM. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2252,11 +2319,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_MemoryPressureNotification(JSVM_Env env, /** * @brief This API creates a deferred object and a JavaScript promise. * - * @param env: The environment that the API is invoked under. - * @param deferred: A newly created deferred object which can later be + * @param env The environment that the API is invoked under. + * @param deferred A newly created deferred object which can later be * passed to OH_JSVM_ResolveDeferred() or OH_JSVM_RejectDeferred() to resolve * resp. reject the associated promise. - * @param promise: The JavaScript promise associated with the deferred object. + * @param promise The JavaScript promise associated with the deferred object. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2272,9 +2339,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreatePromise(JSVM_Env env, * that the promise must have been created using OH_JSVM_CreatePromise() and the deferred * object returned from that call must have been retained in order to be passed to this API. * - * @param env: The environment that the API is invoked under. - * @param deferred: The deferred object whose associated promise to resolve. - * @param resolution: The value with which to resolve the promise. + * @param env The environment that the API is invoked under. + * @param deferred The deferred object whose associated promise to resolve. + * @param resolution The value with which to resolve the promise. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2290,9 +2357,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ResolveDeferred(JSVM_Env env, * that the promise must have been created using OH_JSVM_CreatePromise() and the deferred * object returned from that call must have been retained in order to be passed to this API. * - * @param env: The environment that the API is invoked under. - * @param deferred: The deferred object whose associated promise to resolve. - * @param rejection: The value with which to reject the promise. + * @param env The environment that the API is invoked under. + * @param deferred The deferred object whose associated promise to resolve. + * @param rejection The value with which to reject the promise. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2303,9 +2370,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RejectDeferred(JSVM_Env env, /** * @brief This API return indicating whether promise is a native promise object. - * @param env: The environment that the API is invoked under. - * @param value: The value to examine - * @param isPromise: Flag indicating whether promise is a native promise object + * @param env The environment that the API is invoked under. + * @param value The value to examine + * @param isPromise Flag indicating whether promise is a native promise object * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2314,11 +2381,33 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsPromise(JSVM_Env env, JSVM_Value value, bool* isPromise); +/** + * @brief This API register a resolution/rejection handler with a promise. + * @param env The environment that the API is invoked under. + * @param promise The promise to be handled. + * @param onFulfilled The function to be invoked if promise is resolved. + * @param onRejected The function to be invoked if promise is rejected. + * @param result Another promise returned from promise then/catch method. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the API succeeded. \n + * {@link JSVM_INVALID_ARG } if the arguments are invalid. \n + * {@link JSVM_INVALID_TYPE } if the arguments are invalid Javascript type. \n + * {@link JSVM_PENDING_EXCEPTION} if an exception occurs. \n + * {@link JSVM_GENERIC_FAILURE} if the API failed. \n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_PromiseRegisterHandler(JSVM_Env env, + JSVM_Value promise, + JSVM_Value onFulfilled, + JSVM_Value onRejected, + JSVM_Value* result); + /** * @brief This API parses a JSON string and returns it as value if successful. - * @param env: The environment that the API is invoked under. - * @param jsonString: The string to parse. - * @param result: The parse value if successful. + * @param env The environment that the API is invoked under. + * @param jsonString The string to parse. + * @param result The parse value if successful. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2329,9 +2418,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_JsonParse(JSVM_Env env, /** * @brief This API stringifies the object and returns it as string if successful. - * @param env: The environment that the API is invoked under. - * @param jsonObject: The object to stringify. - * @param result: The string if successfully stringified. + * @param env The environment that the API is invoked under. + * @param jsonObject The object to stringify. + * @param result The string if successfully stringified. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2342,11 +2431,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_JsonStringify(JSVM_Env env, /** * @brief This API create the startup snapshot of the VM. - * @param vm: The environment that the API is invoked under. - * @param contextCount: The object to stringify. - * @param contexts: The array of contexts to add to the snapshot. - * @param blobData: The snapshot data. - * @param blobSize: The size of snapshot data. + * @param vm The environment that the API is invoked under. + * @param contextCount The object to stringify. + * @param contexts The array of contexts to add to the snapshot. + * @param blobData The snapshot data. + * @param blobSize The size of snapshot data. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 11 @@ -2360,8 +2449,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateSnapshot(JSVM_VM vm, /** * @brief This function returns a set of statistics data of the heap of the VM. * - * @param vm: The VM whose heap statistics are returned. - * @param result: The heap statistics data. + * @param vm The VM whose heap statistics are returned. + * @param result The heap statistics data. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 12 @@ -2372,8 +2461,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_GetHeapStatistics(JSVM_VM vm, /** * @brief This function creates and starts a CPU profiler. * - * @param vm: The VM to start CPU profiler for. - * @param result: The pointer to the CPU profiler. + * @param vm The VM to start CPU profiler for. + * @param result The pointer to the CPU profiler. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 12 @@ -2384,10 +2473,10 @@ JSVM_EXTERN JSVM_Status OH_JSVM_StartCpuProfiler(JSVM_VM vm, /** * @brief This function stops the CPU profiler and output to the stream. * - * @param vm: THe VM to start CPU profiler for. - * @param profiler: The CPU profiler to stop. - * @param stream: The output stream callback for receiving the data. - * @param streamData: Optional data to be passed to the stream callback. + * @param vm THe VM to start CPU profiler for. + * @param profiler The CPU profiler to stop. + * @param stream The output stream callback for receiving the data. + * @param streamData Optional data to be passed to the stream callback. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 12 @@ -2400,9 +2489,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_StopCpuProfiler(JSVM_VM vm, /** * @brief This funciton takes the current heap snapshot and output to the stream. * - * @param vm: The VM whose heap snapshot is taken. - * @param stream: The output stream callback for receiving the data. - * @param streamData: Optional data to be passed to the stream callback. + * @param vm The VM whose heap snapshot is taken. + * @param stream The output stream callback for receiving the data. + * @param streamData Optional data to be passed to the stream callback. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } in all cases.\n * @since 12 @@ -2414,9 +2503,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_TakeHeapSnapshot(JSVM_VM vm, /** * @brief This functiong activates insepctor on host and port. * - * @param env: The environment that the API is invoked under. - * @param host: The host to listen to for inspector connections. - * @param port: The port to listen to for inspector connections. + * @param env The environment that the API is invoked under. + * @param host The host to listen to for inspector connections. + * @param port The port to listen to for inspector connections. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_PENDING_EXCEPTION } if an exception occurs.\n @@ -2429,7 +2518,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspector(JSVM_Env env, /** * @brief This function attempts to close all remaining inspector connections. * - * @param env: The environment that the API is invoked under. + * @param env The environment that the API is invoked under. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_PENDING_EXCEPTION } if an exception occurs.\n @@ -2441,8 +2530,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CloseInspector(JSVM_Env env); * @brief This function will block until a client (existing or connected later) * has sent Runtime.runIfWaitingForDebugger command. * - * @param env: The environment that the API is invoked under. - * @param breakNextLine: Whether break on the next line of JavaScript code. + * @param env The environment that the API is invoked under. + * @param breakNextLine Whether break on the next line of JavaScript code. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_PENDING_EXCEPTION } if an exception occurs.\n @@ -2455,22 +2544,22 @@ JSVM_EXTERN JSVM_Status OH_JSVM_WaitForDebugger(JSVM_Env env, * @brief Define a JavaScript class with given class name, constructor, properties, callback handlers for * property operations including get, set, delete, enum etc., and call as function callback. * - * @param env: The environment that the API is invoked under. - * @param utf8name: Name of the JavaScript constructor function. For clarity, it is + * @param env The environment that the API is invoked under. + * @param utf8name Name of the JavaScript constructor function. For clarity, it is * recommended to use the C++ class name when wrapping a C++ class. - * @param length: The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it + * @param length The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it * is null-terminated. - * @param constructor: Struct include callback function that handles constructing instances of the class. + * @param constructor Struct include callback function that handles constructing instances of the class. * When wrapping a C++ class, this method must be a static member with the JSVM_Callback.callback * signature. A C++ class constructor cannot be used. * Include Optional data to be passed to the constructor callback as the data * property of the callback info. JSVM_Callback provides more details. - * @param propertyCount: Number of items in the properties array argument. - * @param properties: Array of property descriptors describing static and instance data + * @param propertyCount Number of items in the properties array argument. + * @param properties Array of property descriptors describing static and instance data * properties, accessors, and methods on the class See JSVM_PropertyDescriptor. - * @param propertyHandlerCfg: The instance object triggers the corresponding callback function. - * @param callAsFunctionCallback: Calling an instance object as a function will trigger this callback. - * @param result: A JSVM_Value representing the constructor function for the class. + * @param propertyHandlerCfg The instance object triggers the corresponding callback function. + * @param callAsFunctionCallback Calling an instance object as a function will trigger this callback. + * @param result A JSVM_Value representing the constructor function for the class. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2489,8 +2578,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_DefineClassWithPropertyHandler(JSVM_Env env, * @brief Determines whether the current thread holds the lock for the specified environment. * Only threads that hold locks can use the environment. * - * @param env: The environment that the API is invoked under. - * @param isLocked: Flag indicating whether the current thread holds the lock for the specified environment. + * @param env The environment that the API is invoked under. + * @param isLocked Flag indicating whether the current thread holds the lock for the specified environment. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2501,7 +2590,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsLocked(JSVM_Env env, /** * @brief Acquire the lock for the specified environment. Only threads that hold locks can use the environment. * - * @param env: The environment that the API is invoked under. + * @param env The environment that the API is invoked under. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2511,7 +2600,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_AcquireLock(JSVM_Env env); /** * @brief Release the lock for the specified environment. Only threads that hold locks can use the environment. * - * @param env: The environment that the API is invoked under. + * @param env The environment that the API is invoked under. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2522,8 +2611,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ReleaseLock(JSVM_Env env); * @brief Starts the running of the task queue inside the VM. * This task queue can be executed by an external event loop. * - * @param env: The VM instance on which to start the task queue. - * @param result: Whether the task queue was successfully started. + * @param vm The VM instance on which to start the task queue. + * @param result Whether the task queue was successfully started. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2534,7 +2623,7 @@ JSVM_EXTERN JSVM_Status OH_JSVM_PumpMessageLoop(JSVM_VM vm, /** * @brief Check to see if there are any microtasks waiting in the queue, and if there are, execute them. * - * @param env: The VM instance on which to check microtasks. + * @param vm The VM instance on which to check microtasks. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2544,9 +2633,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_PerformMicrotaskCheckpoint(JSVM_VM vm); /** * @brief This API checks if the value passed in is callable. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isCallable: Whether the given value is callable. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isCallable Whether the given value is callable. * @return Returns JSVM funtions result code. * {@link JSVM_OK } If the function executed successfully.\n * @since 12 @@ -2559,9 +2648,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsCallable(JSVM_Env env, * @brief This API checks if the value passed in is undefined. * This equals to `value === undefined` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isUndefined: Whether the given value is Undefined. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isUndefined Whether the given value is Undefined. * @return Returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2574,9 +2663,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsUndefined(JSVM_Env env, * @brief This API checks if the value passed in is a null object. * This equals to `value === null` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isNull: Whether the given value is Null. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isNull Whether the given value is Null. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2589,9 +2678,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsNull(JSVM_Env env, * @brief This API checks if the value passed in is either a null or an undefined object. * This is equivalent to `value == null` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isNullOrUndefined: Whether the given value is Null or Undefined. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isNullOrUndefined Whether the given value is Null or Undefined. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2604,9 +2693,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsNullOrUndefined(JSVM_Env env, * @brief This API checks if the value passed in is a boolean. * This equals to `typeof value === 'boolean'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isBoolean: Whether the given value is Boolean. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isBoolean Whether the given value is Boolean. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2619,9 +2708,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsBoolean(JSVM_Env env, * @brief This API checks if the value passed in is a number. * This equals to `typeof value === 'number'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isNumber: Whether the given value is Number. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isNumber Whether the given value is Number. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2634,9 +2723,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsNumber(JSVM_Env env, * @brief This API checks if the value passed in is a string. * This equals to `typeof value === 'string'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isString: Whether the given value is String. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isString Whether the given value is String. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2649,9 +2738,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsString(JSVM_Env env, * @brief This API checks if the value passed in is a symbol. * This equals to `typeof value === 'symbol'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isSymbol: Whether the given value is Symbol. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isSymbol Whether the given value is Symbol. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2664,9 +2753,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsSymbol(JSVM_Env env, * @brief This API checks if the value passed in is a function. * This equals to `typeof value === 'function'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isFunction: Whether the given value is Function. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isFunction Whether the given value is Function. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2678,9 +2767,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsFunction(JSVM_Env env, /** * @brief This API checks if the value passed in is an object. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isObject: Whether the given value is Object. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isObject Whether the given value is Object. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2693,9 +2782,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsObject(JSVM_Env env, * @brief This API checks if the value passed in is a bigInt. * This equals to `typeof value === 'bigint'` in JS. * - * @param env: The VM instance on which to check microtasks. - * @param value: The JavaScript value to check. - * @param isBigInt: Whether the given value is BigInt. + * @param env The VM instance on which to check microtasks. + * @param value The JavaScript value to check. + * @param isBigInt Whether the given value is BigInt. * @return Only returns JSVM funtions result code. * {@link JSVM_OK } This API will not trigger any exception.\n * @since 12 @@ -2707,8 +2796,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsBigInt(JSVM_Env env, /** * @brief This API returns a JSVM-API value corresponding to a JavaScript Map type. * - * @param env: The environment that the API is invoked under. - * @param result: A JSVM_Value representing a JavaScript Map. + * @param env The environment that the API is invoked under. + * @param result A JSVM_Value representing a JavaScript Map. * @return Only returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2719,9 +2808,9 @@ JSVM_Status JSVM_CDECL OH_JSVM_CreateMap(JSVM_Env env, JSVM_Value* result); /** * @brief This API checks if the value passed in is a Map. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param isMap: Whether the given value is Map. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isMap Whether the given value is Map. * @return Only returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2734,8 +2823,8 @@ JSVM_Status JSVM_CDECL OH_JSVM_IsMap(JSVM_Env env, /** * @brief This API returns a JSVM-API value corresponding to a JavaScript Set type. * - * @param env: The environment that the API is invoked under. - * @param result: A JSVM_Value representing a JavaScript Set. + * @param env The environment that the API is invoked under. + * @param result A JSVM_Value representing a JavaScript Set. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2747,9 +2836,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateSet(JSVM_Env env, /** * @brief This API checks if the value passed in is a Set. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param isSet: Whether the given value is Set. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isSet Whether the given value is Set. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2763,11 +2852,11 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsSet(JSVM_Env env, * @brief This function compiles a string of JavaScript code with the compile options * and returns the compiled script. * - * @param env: The environment that the JSVM-API call is invoked under. - * @param script: A JavaScript string containing the script to be compiled. - * @param optionCount: length of option array. - * @param options: Compile options to be passed. - * @param result: The compiled script. + * @param env The environment that the JSVM-API call is invoked under. + * @param script A JavaScript string containing the script to be compiled. + * @param optionCount length of option array. + * @param options Compile options to be passed. + * @param result The compiled script. * @return Returns JSVM functions result code * {@link JSVM_OK } if the API succeeded. \n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2782,9 +2871,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CompileScriptWithOptions(JSVM_Env env, /** * @brief This API implements the abstract operation ToBigInt(). * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to coerce. - * @param result: JSVM_Value representing the coerced JavaScript BigInt. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to coerce. + * @param result JSVM_Value representing the coerced JavaScript BigInt. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded. * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2799,9 +2888,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CoerceToBigInt(JSVM_Env env, * @brief This API checks if the value passed in is a regExp. * This equals to `value instanceof RegExp` in JS. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given value is RegExp. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is RegExp. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2815,9 +2904,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsRegExp(JSVM_Env env, /** * @brief This API checks if the value passed in is a constructor. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param isConstructor: Whether the given value is Constructor. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param isConstructor Whether the given value is Constructor. * @return Only returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2832,10 +2921,10 @@ JSVM_Status JSVM_CDECL OH_JSVM_IsConstructor(JSVM_Env env, * corresponding to the input. * The interface may throw an exception. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript string to convert to a regular expression. - * @param flags: Regular expression flag bits. - * @param result: A JSVM_Value representing a JavaScript RegExp. + * @param env The environment that the API is invoked under. + * @param value The JavaScript string to convert to a regular expression. + * @param flags Regular expression flag bits. + * @param result A JSVM_Value representing a JavaScript RegExp. * @return Only returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2852,10 +2941,10 @@ JSVM_Status JSVM_CDECL OH_JSVM_CreateRegExp(JSVM_Env env, /** * @brief This API returns the Object prototype. * - * @param env: The environment that the API is invoked under. - * @param object: JSVM_Value representing JavaScript Object whose prototype to return. This returns + * @param env The environment that the API is invoked under. + * @param object JSVM_Value representing JavaScript Object whose prototype to return. This returns * the equivalent of Object.getPrototypeOf (which is not the same as the function's prototype property). - * @param result: JSVM_Value representing prototype of the given object. + * @param result JSVM_Value representing prototype of the given object. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2868,9 +2957,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ObjectGetPrototypeOf(JSVM_Env env, /** * @brief This API set the prototype on the Object passed in. * - * @param env: The environment that the API is invoked under. - * @param object: The object on which to set the prototype. - * @param prototype: The prototype value. + * @param env The environment that the API is invoked under. + * @param object The object on which to set the prototype. + * @param prototype The prototype value. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded.\n * {@link JSVM_INVALID_ARG } If the input parameter is invalid.\n @@ -2883,14 +2972,14 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ObjectSetPrototypeOf(JSVM_Env env, /** * @brief Creates a function with a given script as its body. * - * @param env: The environment that the API is invoked under. - * @param funcName: A string containing the function's name. Pass NULL to create an anonymous function. - * @param length: The length of the funcName in bytes, or JSVM_AUTO_LENGTH if it + * @param env The environment that the API is invoked under. + * @param funcName A string containing the function's name. Pass NULL to create an anonymous function. + * @param length The length of the funcName in bytes, or JSVM_AUTO_LENGTH if it * is null-terminated. - * @param argc: The count of elements in the argv array. - * @param argv: Array of JSVM_Values representing JavaScript strings passed in as arguments to the function. - * @param script: A JavaScript string containing the script to use as the function's body. - * @param result: JSVM_Value representing the JavaScript function object for the newly + * @param argc The count of elements in the argv array. + * @param argv Array of JSVM_Values representing JavaScript strings passed in as arguments to the function. + * @param script A JavaScript string containing the script to use as the function's body. + * @param result JSVM_Value representing the JavaScript function object for the newly * created function. * @return Returns JSVM function's result code. * {@link JSVM_OK } If the API succeeded. @@ -2910,8 +2999,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateFunctionWithScript(JSVM_Env env, * @brief This function keep persistently save a JSVM_Script and extend its lifecycle * beyond the current scope. * - * @param env: The environment that the API is invoked under. - * @param script: A JavaScript string containing the script to be retained. + * @param env The environment that the API is invoked under. + * @param script A JavaScript string containing the script to be retained. * @return Returns JSVM functions result code * {@link JSVM_OK } if the API succeeded. \n * {@link JSVM_INVALID_ARG } if the script is empty or already retained. \n @@ -2922,8 +3011,8 @@ JSVM_EXTERN JSVM_Status OH_JSVM_RetainScript(JSVM_Env env, JSVM_Script script); /** * @brief This function release the script retained by OH_JSVM_RetainScript * - * @param env: The environment that the API is invoked under. - * @param script: A JavaScript string containing the script to be retained. + * @param env The environment that the API is invoked under. + * @param script A JavaScript string containing the script to be retained. * @return Returns JSVM functions result code * {@link JSVM_OK } if the API succeeded. \n * {@link JSVM_INVALID_ARG } if the script is empty or not retained. \n @@ -2934,9 +3023,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_ReleaseScript(JSVM_Env env, JSVM_Script script); /** * @brief This function activates insepctor with pid and alias it. * - * @param env: The environment that the API is invoked under. - * @param pid: A process id to identify the inspector connection. - * @param name: An alias for the inspector that under a specific pid. + * @param env The environment that the API is invoked under. + * @param pid A process id to identify the inspector connection. + * @param name An alias for the inspector that under a specific pid. * default name is jsvm if a nullptr is passed in. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n @@ -2951,18 +3040,19 @@ JSVM_EXTERN JSVM_Status OH_JSVM_OpenInspectorWithName(JSVM_Env env, * @brief Compile WebAssembly bytecode into a WebAssembly module. * If WebAssembly cache provided, deserialization will be performed. * - * @param env: The environment that the API is invoked under. - * @param wasmBytecode: WebAssembly bytecode. - * @param wasmBytecodeLength: WebAssembly bytecode length in byte. - * @param cacheData: Optional WebAssembly cache. - * @param cacheDataLength: Optional WebAssembly cache length in byte. - * @param cacheRejected: Output parameter representing whether the provided cacheData is rejected. - * @param wasmModule: Output parameter representing compiled WebAssembly module. + * @param env The environment that the API is invoked under. + * @param wasmBytecode WebAssembly bytecode. + * @param wasmBytecodeLength WebAssembly bytecode length in byte. + * @param cacheData Optional WebAssembly cache. + * @param cacheDataLength Optional WebAssembly cache length in byte. + * @param cacheRejected Output parameter representing whether the provided cacheData is rejected. + * @param wasmModule Output parameter representing compiled WebAssembly module. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_INVALID_ARG } if any of env, wasmBytecode is NULL, or data length is invalid.\n * Returns {@link JSVM_GENERIC_FAILURE } if compile failed.\n * Returns {@link JSVM_PENDING_EXCEPTION } if an exception occurs.\n + * Returns {@link JSVM_JIT_MODE_EXPECTED } if run in jitless mode.\n * * @since 12 */ @@ -2978,15 +3068,16 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CompileWasmModule(JSVM_Env env, * @brief Compile the function with the specified index in the WebAssembly module * into the specified optimization level. * - * @param env: The environment that the API is invoked under. - * @param wasmModule: The WebAssembly module to which the function to compiled belongs. - * @param functionIndex: The index of the function to be compiled, should never be out of range. - * @param optLevel: Optimization level the function will be compiled with. + * @param env The environment that the API is invoked under. + * @param wasmModule The WebAssembly module to which the function to compiled belongs. + * @param functionIndex The index of the function to be compiled, should never be out of range. + * @param optLevel Optimization level the function will be compiled with. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_INVALID_ARG } if env is NULL, or wasmModule is NULL or is not a WebAssembly module.\n * Returns {@link JSVM_GENERIC_FAILURE } if functionIndex out of range or compile failed.\n * Returns {@link JSVM_PENDING_EXCEPTION } if an exception occurs.\n + * Returns {@link JSVM_JIT_MODE_EXPECTED } if run in jitless mode.\n * * @since 12 */ @@ -2998,9 +3089,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CompileWasmFunction(JSVM_Env env, /** * @brief Check whether the given JSVM_Value is a WebAssembly module. * - * @param env: The environment that the API is invoked under. - * @param value: The JavaScript value to check. - * @param result: Whether the given value is a WebAssembly module. + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a WebAssembly module. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_INVALID_ARG } if any of the input arguments is NULL.\n @@ -3014,14 +3105,15 @@ JSVM_EXTERN JSVM_Status OH_JSVM_IsWasmModuleObject(JSVM_Env env, /** * @brief Create cache for compiled WebAssembly module. * - * @param env: The environment that the API is invoked under. - * @param wasmModule: The compiled WebAssembly module. - * @param data: Output parameter representing generated WebAssembly module cache. - * @param length: Output parameter representing byte length of generated WebAssembly module cache. + * @param env The environment that the API is invoked under. + * @param wasmModule The compiled WebAssembly module. + * @param data Output parameter representing generated WebAssembly module cache. + * @param length Output parameter representing byte length of generated WebAssembly module cache. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_INVALID_ARG } if any of the input arguments is NULL.\n * Returns {@link JSVM_GENERIC_FAILURE } if create wasm cache failed.\n + * Returns {@link JSVM_JIT_MODE_EXPECTED } if run in jitless mode.\n * * @since 12 */ @@ -3033,9 +3125,9 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateWasmCache(JSVM_Env env, /** * @brief Release cache data with specified cache type. * - * @param env: The environment that the API is invoked under. - * @param cacheData: The cache data to be released, double free is undefined behaviors. - * @param cacheType: The type of cache data. + * @param env The environment that the API is invoked under. + * @param cacheData The cache data to be released, double free is undefined behaviors. + * @param cacheType The type of cache data. * @return Returns JSVM funtions result code. * Returns {@link JSVM_OK } if the function executed successfully.\n * Returns {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL or cacheType is illegal.\n @@ -3045,6 +3137,545 @@ JSVM_EXTERN JSVM_Status OH_JSVM_CreateWasmCache(JSVM_Env env, JSVM_EXTERN JSVM_Status OH_JSVM_ReleaseCache(JSVM_Env env, const uint8_t* cacheData, JSVM_CacheType cacheType); + +/** + * @brief This API creates an external JavaScript string value from an ISO-8859-1-encoded C + * string. The native string is copied when failed to create external string. + * + * @param env The environment that the API is invoked under. + * @param str Character buffer representing an ISO-8859-1-encoded string. + * @param length The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. + * @param finalizeCallback Optional callback to call when the external value is being collected. + * JSVM_Finalize provides more details. + * @param finalizeHint Optional hint to pass to the finalize callback during collection. + * @param result A JSVM_Value representing a JavaScript external string. + * @param copied flag indicate whether the external string is successfully created, + * true for faild to create external ones and fall back to non-external strings, false for success. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if one of env, str and copied is NULL.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateExternalStringLatin1(JSVM_Env env, + char* str, + size_t length, + JSVM_Finalize finalizeCallback, + void* finalizeHint, + JSVM_Value* result, + bool* copied); + +/** + * @brief This API creates an external JavaScript string value from an UTF16-LE-encoded C + * string. The native string is copied when failed to create external string. + * + * @param env The environment that the API is invoked under. + * @param str Character buffer representing an UTF16-LE-encoded string. + * @param length The length of the string in bytes, or JSVM_AUTO_LENGTH if it is null-terminated. + * @param finalizeCallback Optional callback to call when the external value is being collected. + * JSVM_Finalize provides more details. + * @param finalizeHint Optional hint to pass to the finalize callback during collection. + * @param result A JSVM_Value representing a JavaScript external string. + * @param copied flag indicate whether the external string is successfully created, + * true for faild to create external ones and fall back to non-external strings, false for success. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if one of env, str and copied is NULL.\n + * @since 18 + */ + +JSVM_EXTERN JSVM_Status OH_JSVM_CreateExternalStringUtf16(JSVM_Env env, + char16_t* str, + size_t length, + JSVM_Finalize finalizeCallback, + void* finalizeHint, + JSVM_Value* result, + bool* copied); + +/** + * @brief This API creates a JavaScript private key. + * + * @param env The environment that the API is invoked under. + * @param description Optional JSVM_Value which refers to a JavaScript string to be set as the description + * for the private key. + * @param result A JSVM_Data representing a JavaScript private key. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if env or result is NULL.\n + * {@link JSVM_STRING_EXPECTED } if the description is not a string.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreatePrivate(JSVM_Env env, + JSVM_Value description, + JSVM_Data* result); + +/** + * @brief This API set a private property on the Object passed in. + * + * @param env The environment that the API is invoked under. + * @param object The object on which to set the private property. + * @param key The private key of the property. + * @param value The private property value. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the arguments is NULL or the key is not a private key.\n + * {@link JSVM_OBJECT_EXPECTED } object passed in is not a real object.\n + * {@link JSVM_GENERIC_FAILURE } if failed to set the private key but no exception is pending.\n + * {@link JSVM_PENDING_EXCPTION } if an exception occurs.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetPrivate(JSVM_Env env, + JSVM_Value object, + JSVM_Data key, + JSVM_Value value); + +/** + * @brief This API gets the requested private property from the Object passed in. + * + * @param env The environment that the API is invoked under. + * @param object The object from which to retrieve the private property. + * @param key The private key of the property. + * @param result The value of the private property. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the arguments is NULL or the key is not a private key.\n + * {@link JSVM_OBJECT_EXPECTED } object passed in is not a real object.\n + * {@link JSVM_GENERIC_FAILURE } if failed to get the private key but no exception is pending.\n + * {@link JSVM_PENDING_EXCPTION } if an exception occurs.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetPrivate(JSVM_Env env, + JSVM_Value object, + JSVM_Data key, + JSVM_Value *result); + +/** + * @brief This API attempts to delete the property of the private key from object. + * + * @param env The environment that the API is invoked under. + * @param object The object to query. + * @param key The private key of the property to delete. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the arguments is NULL or the key is not a private key.\n + * {@link JSVM_OBJECT_EXPECTED } object passed in is not a real object.\n + * {@link JSVM_GENERIC_FAILURE } if failed to delete the private key but no exception is pending.\n + * {@link JSVM_PENDING_EXCPTION } if an exception occurs.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DeletePrivate(JSVM_Env env, + JSVM_Value object, + JSVM_Data key); + +/** + * @brief This API creates a new reference with the specified reference count to the data passed in. + * + * @param env The environment that the API is invoked under. + * @param data The JSVM_Data for which a reference is being created. + * @param initialRefcount Initial reference count for the new reference. + * @param result JSVM_Ref pointing to the new reference. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any parameter is null or the value of initialRefcount is 0.\n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_CreateDataReference(JSVM_Env env, + JSVM_Data data, + uint32_t initialRefcount, + JSVM_Ref* result); + +/** + * @brief If still valid, this API returns the JSVM_Data representing the + * JavaScript data associated with the JSVM_Ref. Otherwise, result will be NULL. + * + * @param env The environment that the API is invoked under. + * @param ref The JSVM_Ref for which the corresponding value is being requested. + * @param result The JSVM_Data referenced by the JSVM_Ref. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any parameter is null or the ref is not a reference to JSVM_Data.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetReferenceData(JSVM_Env env, + JSVM_Ref ref, + JSVM_Data* result); + +/** + * @brief Check whether the given JSVM_Value is a BigInt Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a BigInt Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsBigIntObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Boolean Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Boolean Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsBooleanObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a String Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a String Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsStringObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Number Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Number Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsNumberObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief Check whether the given JSVM_Value is a Symbol Object. + * + * @param env The environment that the API is invoked under. + * @param value The JavaScript value to check. + * @param result Whether the given value is a Symbol Object. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_IsSymbolObject(JSVM_Env env, + JSVM_Value value, + bool* result); + +/** + * @brief This API returns the Symbol.asyncIterator of Well-Known Symbols. + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.asyncIterator of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolAsyncIterator(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.hasInstance of Well-Known Symbols. + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.hasInstance of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolHasInstance(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.isConcatSpreadable of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.isConcatSpreadable of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolIsConcatSpreadable(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.match of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.match of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolMatch(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.replace of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.replace of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolReplace(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.search of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.search of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolSearch(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.split of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.split of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolSplit(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.toPrimitive of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.toPrimitive of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolToPrimitive(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.unscopables of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.unscopables of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolUnscopables(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.toStringTag of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.toStringTag of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolToStringTag(JSVM_Env env, JSVM_Value* result); + +/** + * @brief This API returns the Symbol.iterator of Well-Known Symbols + * + * @param env The environment that the API is invoked under. + * @param result The Symbol.iterator of Well-Known Symbols. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_GetSymbolIterator(JSVM_Env env, JSVM_Value* result); + +/** + * @brief Trace start with specified categories for all JSVM VM.(Non-thread-safe) + * + * @param count The count of trace categories. + * @param categories Select internal trace events for tracing by categories. + * @param tag User-defined tag of trace data. + * @param eventsCount Number of trace events. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if categories or count is illegal.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TraceStart(size_t count, const JSVM_TraceCategory* categories, + const char* tag, size_t eventsCount); + +/** + * @brief Trace stop for specified categories for all JSVM VM.(Non-thread-safe) + * + * @param stream The output stream callback for receiving the data. + * @param streamData Data passed to the stream callback. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if stream or streamData is NULL\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_TraceStop(JSVM_OutputStream stream, void* streamData); + +/** + * @brief Set Handler For OOM Error. If this function is invoked repeatedly, + * only the last time takes effect. When handler is null, the previous setting is canceled. + * + * @param vm The environment that the API is invoked under. + * @param handler The handler for OOM Error. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if vm is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForOOMError(JSVM_VM vm, + JSVM_HandlerForOOMError handler); + +/** + * @brief Set Handler For Fatal Error. If this function is invoked repeatedly, + * only the last time takes effect. When handler is null, the previous setting is canceled. + * + * @param vm The environment that the API is invoked under. + * @param handler The handler for Fatal Error. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if vm is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForFatalError(JSVM_VM vm, + JSVM_HandlerForFatalError handler); + +/** + * @brief Set Handler For Promise Reject. If this function is invoked repeatedly, + * only the last time takes effect. When handler is null, the previous setting is canceled. + * + * @param vm The environment that the API is invoked under. + * @param handler The handler for Promise Reject. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if vm is NULL.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_SetHandlerForPromiseReject(JSVM_VM vm, + JSVM_HandlerForPromiseReject handler); + +/** + * @brief When wrapping a C++ class, the C++ constructor callback passed via constructor + * should be a static method on the class that calls the actual class constructor, then + * wraps the new C++ instance in a JavaScript object according to the different Options + * passed in, and returns the wrapper object. + * + * @param env The environment that the API is invoked under. + * @param utf8name Name of the JavaScript constructor function. For clarity, it is + * recommended to use the C++ class name when wrapping a C++ class. + * @param length The length of the utf8name in bytes, or JSVM_AUTO_LENGTH if it + * is null-terminated. + * @param constructor Struct include callback function that handles constructing instances of the class. + * When wrapping a C++ class, this method must be a static member with the JSVM_Callback.callback + * signature. A C++ class constructor cannot be used. + * Include Optional data to be passed to the constructor callback as the data + * property of the callback info. JSVM_Callback provides more details. + * @param propertyCount Number of items in the properties array argument. + * @param properties Array of property descriptors describing static and instance data + * properties, accessors, and methods on the class See JSVM_PropertyDescriptor. + * @param parentClass The parent-class of the currently defined class. + * @param option_count Number of items in an option array argument. + * @param options DefineClass options to be passed. + * @param result A JSVM_Value representing the constructor function for the class. + * @return Returns JSVM functions result code. + * {@link JSVM_OK } if the function executed successfully. \n + * {@link JSVM_INVALID_ARG } if any of the pointer arguments is NULL. \n + * {@link JSVM_GENERIC_FAILURE} if the input utf8name | constructor | properties is invalid. \n + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_DefineClassWithOptions(JSVM_Env env, + const char* utf8name, + size_t length, + JSVM_Callback constructor, + size_t propertyCount, + const JSVM_PropertyDescriptor* properties, + JSVM_Value parentClass, + size_t option_count, + JSVM_DefineClassOptions options[], + JSVM_Value* result); + +/** + * @brief Add VM GC Callback. + * + * @param vm The environment that the API is invoked under. + * @param triggerTime The timing of GC callback trigger. + * @param handler When Trigger gc, the callback function will be called. + * @param gcType The type of gc. + * @param userData The native pointer data. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if the vm or the handler is NULL or the handler has been added before.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_AddHandlerForGC(JSVM_VM vm, + JSVM_CBTriggerTimeForGC triggerTime, + JSVM_HandlerForGC handler, + JSVM_GCType gcType, + void* userData); + +/** + * @brief Remove VM GC Callback. + * + * @param vm The environment that the API is invoked under. + * @param triggerTime The timing of GC callback trigger. + * @param handler When Trigger gc, the callback function will be called. + * @param userData The native pointer data. + * @return Returns JSVM funtions result code. + * {@link JSVM_OK } if the function executed successfully.\n + * {@link JSVM_INVALID_ARG } if the vm or the handler is NULL, or the handler has been removed, + * or the handler has never been added.\n + * + * @since 18 + */ +JSVM_EXTERN JSVM_Status OH_JSVM_RemoveHandlerForGC(JSVM_VM vm, + JSVM_CBTriggerTimeForGC triggerTime, + JSVM_HandlerForGC handler, + void* userData); EXTERN_C_END /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_H */ + diff --git a/ark_runtime/jsvm/jsvm_types.h b/ark_runtime/jsvm/jsvm_types.h index 1141b051f8d71e2590a0ded319cf722d8fef7f0b..999214b1ad1f53a5be04f435ac360ad842bba08d 100644 --- a/ark_runtime/jsvm/jsvm_types.h +++ b/ark_runtime/jsvm/jsvm_types.h @@ -12,10 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#ifndef ARK_RUNTIME_JSVM_JSVM_TYPE_H -#define ARK_RUNTIME_JSVM_JSVM_TYPE_H - /** * @addtogroup JSVM * @{ @@ -43,6 +39,10 @@ * @since 11 */ +#ifndef ARK_RUNTIME_JSVM_JSVM_TYPE_H +#define ARK_RUNTIME_JSVM_JSVM_TYPE_H + + #include // NOLINT(modernize-deprecated-headers) #include // NOLINT(modernize-deprecated-headers) #include // NOLINT(modernize-deprecated-headers) @@ -327,6 +327,14 @@ typedef enum { JSVM_NO_EXTERNAL_BUFFERS_ALLOWED, /** cannot run +js status. */ JSVM_CANNOT_RUN_JS, + /** invalid input type status. + * @since 18 + */ + JSVM_INVALID_TYPE, + /** jit mode expected status. + * @since 15 + */ + JSVM_JIT_MODE_EXPECTED, } JSVM_Status; /** @@ -770,5 +778,243 @@ typedef enum { /** WebAssembly cache, generated by OH_JSVM_CreateWasmCache */ JSVM_CACHE_TYPE_WASM, } JSVM_CacheType; + +/** + * @brief Microtask policies of JSVM. + * + * @since 18 + */ +typedef enum { + /** Microtasks are invoked with the OH_JSVM_PerformMicrotaskCheckpoint() method. */ + JSVM_MICROTASK_EXPLICIT = 0, + /** Microtasks are invoked when the script call depth decrements to zero. + * Default mode. + */ + JSVM_MICROTASK_AUTO, +} JSVM_MicrotaskPolicy; + +/** + * @brief Trace category for jsvm internal trace events. + * + * @since 18 + */ +typedef enum { + /** Tracing main interface invoking of JSVM, such as run scripts. */ + JSVM_TRACE_VM, + /** Tracing interface invoking about compilation, such as CompileCodeBackground. */ + JSVM_TRACE_COMPILE, + /** Tracing interface invoking about execution status, such as Interrupts and Microtasks. */ + JSVM_TRACE_EXECUTE, + /** Tracing external callback */ + JSVM_TRACE_RUNTIME, + /** Tracing stack trace in JSVM. */ + JSVM_TRACE_STACK_TRACE, + /** Tracing Main interface invoking of WASM, such as Compile Wasm Module and Instantiate. */ + JSVM_TRACE_WASM, + /** Tracing more detailed interface invoking of WASM, such as background compilation and wrappers. */ + JSVM_TRACE_WASM_DETAILED +} JSVM_TraceCategory; + +/** + * @brief The promise-reject event. + * + * @since 18 + */ +typedef enum { + /** Promise is rejected for other reasons. */ + JSVM_PROMISE_REJECT_OTHER_REASONS = 0, + /** Promise rejected with no handler. */ + JSVM_PROMISE_REJECT_WITH_NO_HANDLER = 1, + /** Add the handler after Promise has been rejected. */ + JSVM_PROMISE_ADD_HANDLER_AFTER_REJECTED = 2, + /** After the Promise has been resolved, try to reject the Promise again. */ + JSVM_PROMISE_REJECT_AFTER_RESOLVED = 3, + /** After the Promise has been resolved, try resolving the Promise again. */ + JSVM_PROMISE_RESOLVE_AFTER_RESOLVED = 4, +} JSVM_PromiseRejectEvent; + +/** + * @brief The level of message error. + * + * @since 18 + */ +typedef enum { + /** Log level message. */ + JSVM_MESSAGE_LOG = (1 << 0), + /** Debug level message. */ + JSVM_MESSAGE_DEBUG = (1 << 1), + /** Info level message. */ + JSVM_MESSAGE_INFO = (1 << 2), + /** Error level message. */ + JSVM_MESSAGE_ERROR = (1 << 3), + /** Warning level message. */ + JSVM_MESSAGE_WARNING = (1 << 4), + /** All level message. */ + JSVM_MESSAGE_ALL = JSVM_MESSAGE_LOG | JSVM_MESSAGE_DEBUG | JSVM_MESSAGE_INFO | JSVM_MESSAGE_ERROR | + JSVM_MESSAGE_WARNING, +} JSVM_MessageErrorLevel; + +/** + * @brief Function pointer type of OOM-Error callback. + * + * @param location The location information of the OOM error. + * @param detail The detail of the OOM error. + * @param isHeapOOM Determine whether the OOM type is Heap OOM. + * + * @since 18 + */ +typedef void(JSVM_CDECL* JSVM_HandlerForOOMError)(const char* location, + const char* detail, + bool isHeapOOM); + +/** + * @brief Function pointer type of Fatal-Error callback. + * + * @param location The location information of the Fatal error. + * @param message The message of the Fatal error. + * + * @since 18 + */ +typedef void(JSVM_CDECL* JSVM_HandlerForFatalError)(const char* location, + const char* message); + +/** + * @brief Function pointer type of Promise-Reject callback. + * + * @param env The environment that the function is invoked under. + * @param rejectEvent The promise-reject event. + * @param rejectInfo An JS-object containing two properties: 'promise' and 'value'. + * The 'promise' represents a reference to the Promise object that was rejected. + * The 'value' represents the rejection reason associated with that promise. + * + * @since 18 + */ +typedef void(JSVM_CDECL* JSVM_HandlerForPromiseReject)(JSVM_Env env, + JSVM_PromiseRejectEvent rejectEvent, + JSVM_Value rejectInfo); + +/** + * @brief DefineClass options id. + * + * @since 18 + */ +typedef enum { + /** Defining a class in normal mode. */ + JSVM_DEFINE_CLASS_NORMAL, + /** Defining a class with count. */ + JSVM_DEFINE_CLASS_WITH_COUNT, + /** Defining a class with property handler. */ + JSVM_DEFINE_CLASS_WITH_PROPERTY_HANDLER, +} JSVM_DefineClassOptionsId; + +/** + * @brief DefineClass options. + * + * @since 18 + */ +typedef struct { + /** DefineClass option id. */ + JSVM_DefineClassOptionsId id; + /** option content. */ + union { + /** for option value with pointer type. */ + void* ptr; + /** for option value with integer type */ + int num; + /** for option value with bool type */ + bool boolean; + } content; +} JSVM_DefineClassOptions; + +/** + * @brief The property-handler used to define class. + * + * @since 18 + */ +typedef struct { + /** The instance object triggers the corresponding callback function. */ + JSVM_PropertyHandlerCfg propertyHandlerCfg; + /** Calling an instance object as a function will trigger this callback. */ + JSVM_Callback callAsFunctionCallback; +} JSVM_PropertyHandler; + +/** + * @brief The timing of GC callback trigger. + * + * @since 18 + */ +typedef enum { + /** Trigger GC callback before GC. */ + JSVM_CB_TRIGGER_BEFORE_GC, + /** Trigger GC callback after GC. */ + JSVM_CB_TRIGGER_AFTER_GC, +} JSVM_CBTriggerTimeForGC; + +/** + * @brief The GC type. + * + * @since 18 + */ +typedef enum { + /** The GC algorithm is Scavenge. */ + JSVM_GC_TYPE_SCAVENGE = 1 << 0, + /** The GC algorithm is Minor-Mark-Compact. */ + JSVM_GC_TYPE_MINOR_MARK_COMPACT = 1 << 1, + /** The GC algorithm is Mark-Sweep-Compact. */ + JSVM_GC_TYPE_MARK_SWEEP_COMPACT = 1 << 2, + /** The GC algorithm is Incremental-Marking. */ + JSVM_GC_TYPE_INCREMENTAL_MARKING = 1 << 3, + /** The GC algorithm is Weak-Callbacks. */ + JSVM_GC_TYPE_PROCESS_WEAK_CALLBACKS = 1 << 4, + /** All GC algorithm. */ + JSVM_GC_TYPE_ALL = JSVM_GC_TYPE_SCAVENGE | JSVM_GC_TYPE_MINOR_MARK_COMPACT | + JSVM_GC_TYPE_MARK_SWEEP_COMPACT | JSVM_GC_TYPE_INCREMENTAL_MARKING | + JSVM_GC_TYPE_PROCESS_WEAK_CALLBACKS, +} JSVM_GCType; + +/** + * @brief The GC callback flags. + * + * @since 18 + */ +typedef enum { + /** No GC callback falgs. */ + JSVM_NO_GC_CALLBACK_FLAGS, + /** Reserved object information will be built in the garbage collection callback. */ + JSVM_GC_CALLBACK_CONSTRUCT_RETAINED_OBJECT_INFOS, + /** Enforce Garbage Collection Callback. */ + JSVM_GC_CALLBACK_FORCED, + /** Synchronous phantom callback processing. */ + JSVM_GC_CALLBACK_SYNCHRONOUS_PHANTOM_CALLBACK_PROCESSING, + /** All available garbage objects are collected during garbage collection. */ + JSVM_GC_CALLBACK_COLLECT_ALL_AVAILABLE_GARBAGE, + /** Garbage collection collects all external memory. */ + JSVM_GC_CALLBACK_COLLECT_ALL_EXTERNAL_MEMORY, + /** Schedule Garbage Collection at Idle Time. */ + JSVM_GC_CALLBACK_SCHEDULE_IDLE_GARBAGE_COLLECTION, +} JSVM_GCCallbackFlags; + +/** + * @brief Function pointer type of GC callback. + * + * @param vm The VM instance that the JSVM-API call is invoked under. + * @param gcType The gc type. + * @param flags The GC callback flags. + * @param data The native pointer data. + * + * @since 18 + */ +typedef void(JSVM_CDECL* JSVM_HandlerForGC)(JSVM_VM vm, + JSVM_GCType gcType, + JSVM_GCCallbackFlags flags, + void* data); + +/** + * @brief To represent a JavaScript Data type. + * + * @since 18 + */ +typedef struct JSVM_Data__* JSVM_Data; /** @} */ #endif /* ARK_RUNTIME_JSVM_JSVM_TYPE_H */ + diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index e0157b7722ff66f925d17ba0a0367d2a0c5e5fe8..a0fb85dd2564b0881dc506438f51d84394a40c83 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -734,5 +734,153 @@ { "first_introduced": "12", "name": "OH_JSVM_ReleaseCache" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_PromiseRegisterHandler" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_CreateProxy" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsProxy" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_ProxyGetTarget" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsBigIntObject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsBooleanObject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsStringObject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsNumberObject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_IsSymbolObject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolAsyncIterator" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolHasInstance" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolIsConcatSpreadable" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolMatch" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolReplace" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolSearch" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolSplit" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolToPrimitive" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolUnscopables" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolToStringTag" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetSymbolIterator" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_SetMicrotaskPolicy" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_TraceStart" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_TraceStop" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_SetHandlerForOOMError" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_SetHandlerForFatalError" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_SetHandlerForPromiseReject" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_DefineClassWithOptions" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_AddHandlerForGC" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_RemoveHandlerForGC" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_CreateExternalStringLatin1" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_CreateExternalStringUtf16" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_CreatePrivate" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_SetPrivate" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetPrivate" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_DeletePrivate" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_CreateDataReference" + }, + { + "first_introduced": "18", + "name": "OH_JSVM_GetReferenceData" } ] diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index 99ad7f7781adde996d9d37eade4313e79696aa97..b48b73ada3d60b5a9903bbb79167cbdd0c55399d 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -33,6 +33,8 @@ if (!is_arkui_x) { "native_gesture.h", "native_interface.h", "native_interface_accessibility.h", + "native_interface_focus.h", + "native_key_event.h", "native_node.h", "native_node_napi.h", "native_type.h", diff --git a/arkui/ace_engine/native/drag_and_drop.h b/arkui/ace_engine/native/drag_and_drop.h index 2f68d95b0f7affd5a6d626e7bd425d6513752183..38e49caad1f19bd895f11cf455359a9c4ea2cf44 100644 --- a/arkui/ace_engine/native/drag_and_drop.h +++ b/arkui/ace_engine/native/drag_and_drop.h @@ -434,6 +434,54 @@ float OH_ArkUI_DragEvent_GetVelocity(ArkUI_DragEvent* event); */ int32_t OH_ArkUI_DragEvent_GetModifierKeyStates(ArkUI_DragEvent* event, uint64_t* keys); +/** + * @brief Request to start the data sync process with the sync option. + * + * @param event Indicates the pointer to an ArkUI_DragEvent object. + * @param options Indicates the pointer to an OH_UdmfGetDataParams object. + * @param key Represents return value after set data to database successfully, it should be not + * less than {@link UDMF_KEY_BUFFER_LEN}. + * @param keyLen Represents the length of key string. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_DRAG_DATA_SYNC_FAILED} if the data sync is not allowed or failed. + * @since 15 + */ +int32_t OH_ArkUI_DragEvent_StartDataLoading( + ArkUI_DragEvent* event, OH_UdmfGetDataParams* options, char* key, unsigned int keyLen); + +/** + * @brief Cancel the data sync process. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param key Represents the data key returned by {@link OH_ArkUI_DragEvent_StartDataLoading}. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_OPERATION_FAILED} if no any data sync is in progress. + * @since 15 + */ +int32_t OH_ArkUI_CancelDataLoading(ArkUI_ContextHandle uiContext, const char* key); + +/** + * @brief Sets whether to disable data prefetch process before the onDrop callback executing. + * The system will retry to getting data until the max time limit (2.4s for now) reaches, + * this's useful for the cross device draging operation, as the system helps to eliminate + * the communication instability, but it's redundant for {@link OH_ArkUI_DragEvent_StartDataLoading} + * method, as it will take care the data fetching with asynchronous mechanism, so must set this + * field to true if using {@link OH_ArkUI_DragEvent_StartDataLoading} in onDrop to avoid the data is + * fetched before onDrop executing unexpectedly. + * + * @param node Indicates the pointer to a component node. + * @param disabled Indicates whether to disable the data pre-fetch process, true for disable, false for not. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_DisableDropDataPrefetchOnNode(ArkUI_NodeHandle node, bool disabled); + /** * @brief Sets whether to enable strict reporting on drag events. * This feature is disabled by default, and you are advised to enable it. @@ -793,6 +841,49 @@ ArkUI_DragEvent* OH_ArkUI_DragAndDropInfo_GetDragEvent(ArkUI_DragAndDropInfo* dr */ int32_t OH_ArkUI_StartDrag(ArkUI_DragAction* dragAction); +/** + * @brief Request to delay the drop end handling for a while to wait until the process result + * is really conformed by application, the result need to be notified back to system through + * {@link OH_ArkUI_NotifyDragResult} interface. And when all the handling done, the + * {@link OH_ArkUI_NotifyDragEndPendingDone} should be called. + * Please be aware, the maximum pending time is 2 seconds; + * + * @param event Indicates the pointer to an ArkUI_DragEvent object. + * @param requestIdentify Indicates the Identify for the request initiated by this method, it's a number generated + by system automatically, and it's an out parameter too, so one valid address needed. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_DRAG_DROP_OPERATION_NOT_ALLOWED} if current is not during the drop handing. + * @since 18 + */ +int32_t OH_ArkUI_DragEvent_RequestDragEndPending(ArkUI_DragEvent* event, int32_t* requestIdentify); + +/** + * @brief Notify the system final drag result, the request identify will be checked, it should be the same + * as the one returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface, if it's not, + * the calling will be ignored. + * + * @param requestIdentify The identify returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface. + * @param result Indicates the drag result. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_NotifyDragResult(int32_t requestIdentify, ArkUI_DragResult result); + +/** + * @brief Notify the system all handling done, the drag end pending can be finished. + * + * @param requestIdentify The identify returned by {@link OH_ArkUI_DragEvent_RequestDragEndPending} interface. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_NotifyDragEndPendingDone(int32_t requestIdentify); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/drawable_descriptor.h b/arkui/ace_engine/native/drawable_descriptor.h index 76b2f1723cc6463c9f76018d73206620bf293835..ba221641f4f94079f3ff2a0d765dda3e2029628b 100644 --- a/arkui/ace_engine/native/drawable_descriptor.h +++ b/arkui/ace_engine/native/drawable_descriptor.h @@ -142,7 +142,7 @@ int32_t OH_ArkUI_DrawableDescriptor_GetAnimationDuration(ArkUI_DrawableDescripto * @brief Sets the number of playback times. * * @param drawableDescriptor Indicates the pointer to the drawableDescriptor. - * @param iterations Indicates the number of playback times. + * @param iteration Indicates the number of playback times. * @since 12 */ void OH_ArkUI_DrawableDescriptor_SetAnimationIteration( diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3da27da0767a5e05e1119c10aa52e175cbb883d5..c80fc0750649e90dbc180d82275ce63ba87c42dc 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -167,6 +167,10 @@ "first_introduced": "12", "name": "OH_ArkUI_AxisEvent_GetPinchAxisScaleValue" }, + { + "first_introduced": "15", + "name": "OH_ArkUI_AxisEvent_GetAxisAction" + }, { "first_introduced": "12", "name": "OH_ArkUI_GetNodeHandleFromNapiValue" @@ -247,6 +251,18 @@ "first_introduced": "12", "name": "OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType" }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GestureInterruptInfo_GetTouchRecognizers" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TouchRecognizer_GetNodeHandle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TouchRecognizer_CancelTouch" + }, { "first_introduced": "12", "name": "OH_ArkUI_GetResponseRecognizersFromInterruptInfo" @@ -255,6 +271,10 @@ "first_introduced": "12", "name": "OH_ArkUI_SetGestureRecognizerEnabled" }, + { + "first_introduced": "15", + "name": "OH_ArkUI_SetGestureRecognizerLimitFingerCount" + }, { "first_introduced": "12", "name": "OH_ArkUI_GetGestureRecognizerEnabled" @@ -487,6 +507,18 @@ "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetTiltY" }, + { + "first_introduced": "18", + "name": "OH_ArkUI_PointerEvent_GetRollAngle" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_GetInteractionHand" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_GetInteractionHandByIndex" + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetTouchAreaWidth" @@ -510,75 +542,75 @@ { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryPointerId" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryX" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryY" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryWindowX" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryWindowY" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryDisplayX" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryDisplayY" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryPressure" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryTiltX" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryTiltY" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryTouchAreaWidth" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_PointerEvent_GetHistoryTouchAreaHeight" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetEventType" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetTargetId" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetNodeHandle" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetInputEvent" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetNodeComponentEvent" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetStringAsyncEvent" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeEvent_GetUserData" @@ -592,7 +624,7 @@ "name": "OH_ArkUI_GetModuleInterface" }, { - "first_introduced": "12", + "first_introduced": "12", "name": "OH_ArkUI_NodeAdapter_Create" }, { @@ -678,11 +710,11 @@ { "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_SetSize" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_SetItemCount" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_SetCrossCount" @@ -706,7 +738,7 @@ { "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_GetItemCount" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_WaterFlowSectionOption_GetCrossCount" @@ -810,15 +842,15 @@ { "first_introduced": "12", "name": "OH_ArkUI_NodeContent_InsertNode" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeContent_RemoveNode" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeContent_RegisterCallback" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_NodeContentEvent_GetEventType" @@ -852,7 +884,7 @@ "name": "OH_ArkUI_MouseEvent_GetMouseAction" }, { - "first_introduced": "12", + "first_introduced": "12", "name": "OH_ArkUI_GuidelineOption_Create" }, { @@ -1022,7 +1054,7 @@ { "first_introduced": "12", "name": "OH_ArkUI_AlignmentRuleOption_GetBiasVertical" - }, + }, { "first_introduced": "12", "name": "OH_ArkUI_SwiperIndicator_Create" @@ -1127,6 +1159,174 @@ "first_introduced": "12", "name": "OH_ArkUI_SwiperIndicator_GetMaxDisplayCount" }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperIndicator_SetIgnoreSizeOfBottom" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperIndicator_GetIgnoreSizeOfBottom" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperIndicator_SetSpace" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperIndicator_GetSpace" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetStartPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetStartPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetTopPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetTopPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetEndPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetEndPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetBottomPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetBottomPosition" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetFontColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetFontColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetSelectedFontColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetSelectedFontColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetFontSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetFontSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetSelectedFontSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetSelectedFontSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetFontWeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetFontWeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetSelectedFontWeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetSelectedFontWeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_Destroy" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_SetIgnoreSizeOfBottom" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperDigitIndicator_GetIgnoreSizeOfBottom" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetShowBackground" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetShowBackground" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetShowSidebarMiddle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetShowSidebarMiddle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetBackgroundSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetBackgroundSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetBackgroundColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetBackgroundColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetArrowSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetArrowSize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_SetArrowColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_GetArrowColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SwiperArrowStyle_Destroy" + }, { "first_introduced": "12", "name": "OH_ArkUI_DrawableDescriptor_CreateFromPixelMap" @@ -1296,13 +1496,105 @@ "name": "OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen" }, { - "first_introduced": "14", + "first_introduced": "13", "name": "OH_ArkUI_NodeUtils_AddCustomProperty" }, { - "first_introduced": "14", + "first_introduced": "13", "name": "OH_ArkUI_NodeUtils_RemoveCustomProperty" }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_GetCustomProperty" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_GetParentInPageTree" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_GetActiveChildrenInfo" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_GetCurrentPageRootNode" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_IsCreatedByNDK" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_NodeUtils_GetNodeType" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetWindowInfo" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_CustomProperty_Destroy" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_CustomProperty_GetStringValue" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_ActiveChildrenInfo_Destroy" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_ActiveChildrenInfo_GetNodeByIndex" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_ActiveChildrenInfo_GetCount" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetAttachedNodeHandleById" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_NodeUtils_MoveTo" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_SetCrossLanguageOption" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetCrossLanguageOption" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CrossLanguageOption_Create" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CrossLanguageOption_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CrossLanguageOption_SetAttributeSettingStatus" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CrossLanguageOption_GetAttributeSettingStatus" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetFirstChildIndexWithoutExpand" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetLastChildIndexWithoutExpand" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetChildWithExpandMode" + }, { "first_introduced": "12", "name": "OH_ArkUI_ListChildrenMainSizeOption_Create" @@ -1475,6 +1767,30 @@ "first_introduced": "12", "name": "OH_ArkUI_AccessibilityValue_GetCurrent" }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_SetRangeMin" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_GetRangeMin" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_SetRangeMax" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_GetRangeMax" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_SetRangeCurrent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AccessibilityValue_GetRangeCurrent" + }, { "first_introduced": "12", "name": "OH_ArkUI_AccessibilityValue_SetText" @@ -2362,5 +2678,617 @@ { "first_introduced": "13", "name": "OH_ArkUI_AccessibilityElementInfoSetElementId" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_StyledString_Descriptor_Create" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_StyledString_Descriptor_Destroy" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_ConvertToHtml" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_MarshallStyledStringDescriptor" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_UnmarshallStyledStringDescriptor" + }, + { + "first_introduced": "14", + "name": "OH_NativeXComponent_RegisterKeyEventCallbackWithResult" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetType" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetKeyCode" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetKeyText" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetKeySource" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_UIInputEvent_GetDeviceId" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_StopPropagation" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_UIInputEvent_GetPressedKeys" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetKeyIntensionCode" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_GetUnicode" + }, + { + "first_introduced": "14", + "name": "OH_ArkUI_KeyEvent_SetConsumed" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusAxisEvent_GetAxisValue" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusAxisEvent_SetStopPropagation" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_AccessibilityProviderRegisterCallbackWithInstance" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_GetChangedPointerId" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_FingerCount" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_limitFingerCount" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_repeat" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_distance" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_speed" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_duration" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_angle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_distanceThreshold" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GetGestureParam_DirectMask" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_KeyEvent_Dispatch" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_Create" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_SetScanEffectEnabled" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_SetSmoothEffectEnabled" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_SetStrokeWidth" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_SetStrokeRadius" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_GetScanEffectEnabled" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_GetSmoothEffectEnabled" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_GetStrokeWidth" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_ProgressLinearStyleOption_GetStrokeRadius" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeEvent_GetTextChangeEvent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_PostFrameCallback" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_HostWindowInfo_GetName" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_HostWindowInfo_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_RegisterLayoutCallbackOnNodeHandle" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_RegisterDrawCallbackOnNodeHandle" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_UnregisterLayoutCallbackOnNodeHandle" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_UnregisterDrawCallbackOnNodeHandle" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_DragEvent_StartDataLoading" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CancelDataLoading" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_DisableDropDataPrefetchOnNode" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusRequest" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusClear" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusActivate" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusSetAutoTransfer" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_CreateSnapshotOptions" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_DestroySnapshotOptions" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_SnapshotOptions_SetScale" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_GetNodeSnapshot" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_GetPressedTimeByIndex" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_MouseEvent_GetRawDeltaX" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_MouseEvent_GetRawDeltaY" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_MouseEvent_GetPressedButtons" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_UIInputEvent_GetTargetDisplayId" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_StartImageAnalyzer" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_StopImageAnalyzer" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_KeyframeAnimateOption_SetExpectedFrameRate" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_KeyframeAnimateOption_GetExpectedFrameRate" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_Dispose" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_SetRatios" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_SetExpectedUpdateInterval" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_GetRatios" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_VisibleAreaEventOptions_GetExpectedUpdateInterval" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetWidth" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetHeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetPositionX" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetPositionY" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_HoverEvent_IsHovered" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_UIInputEvent_GetModifierKeyStates" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AxisEvent_SetPropagation" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_AxisEvent_GetScrollStep" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_DragEvent_RequestDragEndPending" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_NotifyDragResult" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_NotifyDragEndPendingDone" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_GestureInterrupter_GetUserData" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_FocusSetKeyProcessingMode" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_CreateClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_DestroyClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventLocalPosition" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventActionType" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_PointerEvent_PostClonedEvent" + }, + { + "first_introduced": "15", + "name": "OH_ArkUI_NodeUtils_GetPositionToParent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_CreateOptions" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_DisposeOptions" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetLevelMode" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetLevelUniqueId" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetImmersiveMode" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_OpenDialog" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_UpdateDialog" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_CloseDialog" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetBackgroundColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetCornerRadius" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetBorderWidth" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetBorderColor" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetBorderStyle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetWidth" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetHeight" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetShadow" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetCustomShadow" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetBackgroundBlurStyle" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetAlignment" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetModalMode" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetAutoCancel" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetSubwindowMode" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetMask" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetKeyboardAvoidMode" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetHoverModeEnabled" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_SetHoverModeArea" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextPickerRangeContentArray_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextPickerRangeContentArray_SetIconAtIndex" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextPickerRangeContentArray_SetTextAtIndex" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextPickerRangeContentArray_Destroy" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_SetTextAtIndex" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_TextCascadePickerRangeContentArray_Destroy" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_Dispose" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_SetUserData" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_GetUserData" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceCallback_Create" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceCallback_Dispose" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_AddSurfaceCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_GetNativeWindow" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_SetAutoInitialize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_Initialize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_Finalize" + }, + { + "first_introduced": "18", + "name": "OH_ArkUI_XComponent_IsInitialized" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_animate.h b/arkui/ace_engine/native/native_animate.h index 08709d7075aef14ef4587137aa8b6e50969c09d9..0fbbe8c88d8b89165117856812868a993c6d4c08 100644 --- a/arkui/ace_engine/native/native_animate.h +++ b/arkui/ace_engine/native/native_animate.h @@ -36,7 +36,11 @@ #ifndef ARKUI_NATIVE_ANIMATE_H #define ARKUI_NATIVE_ANIMATE_H +#ifdef __cplusplus #include +#else +#include +#endif #include "native_type.h" @@ -409,6 +413,19 @@ int32_t OH_ArkUI_KeyframeAnimateOption_SetIterations(ArkUI_KeyframeAnimateOption int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnFinishCallback( ArkUI_KeyframeAnimateOption* option, void* userData, void (*onFinish)(void* userData)); +/** + * @brief Sets the expected frame rate range of a keyframe animation. + * + * @param option Indicates the pointer to a keyframe animation configuration. + * @param frameRate Indicates the expected frame rate range. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_KeyframeAnimateOption_SetExpectedFrameRate( + ArkUI_KeyframeAnimateOption* option, ArkUI_ExpectedFrameRateRange* frameRate); + /** * @brief Sets the duration of a keyframe animation, in milliseconds. * @@ -472,6 +489,15 @@ int32_t OH_ArkUI_KeyframeAnimateOption_GetDelay(ArkUI_KeyframeAnimateOption* opt */ int32_t OH_ArkUI_KeyframeAnimateOption_GetIterations(ArkUI_KeyframeAnimateOption* option); +/** + * @brief Obtains the expected frame rate range of a keyframe animation configuration. + * + * @param option Indicates the pointer to a keyframe animation configuration. + * @return Returns the expected frame rate range of the keyframe animation. + * @since 18 + */ +ArkUI_ExpectedFrameRateRange* OH_ArkUI_KeyframeAnimateOption_GetExpectedFrameRate(ArkUI_KeyframeAnimateOption* option); + /** * @brief Obtains the duration of a specific state in a keyframe animation. * @@ -932,6 +958,7 @@ int32_t OH_ArkUI_Animator_Reverse(ArkUI_AnimatorHandle animatorHandle); * @param curve Indicates the curve type. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCurveByType(ArkUI_AnimationCurve curve); @@ -943,6 +970,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCurveByType(ArkUI_AnimationCurve curve); * true: Jumping occurs when the interpolation ends. false: Jumping occurs when the interpolation starts. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateStepsCurve(int32_t count, bool end); @@ -958,6 +986,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateStepsCurve(int32_t count, bool end); * @param y2 Indicates the Y coordinate of the second point on the Bezier curve. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCubicBezierCurve(float x1, float y1, float x2, float y2); @@ -979,6 +1008,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCubicBezierCurve(float x1, float y1, floa * the oscillation amplitude. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringCurve(float velocity, float mass, float stiffness, float damping); @@ -998,6 +1028,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringCurve(float velocity, float mass, f * transit smoothly over this duration if they are different. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringMotion(float response, float dampingFraction, float overlapDuration); @@ -1017,6 +1048,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringMotion(float response, float dampin * transit smoothly over this duration if they are different. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateResponsiveSpringMotion( float response, float dampingFraction, float overlapDuration); @@ -1043,6 +1075,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateResponsiveSpringMotion( * the oscillation amplitude. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateInterpolatingSpring(float velocity, float mass, float stiffness, float damping); @@ -1060,6 +1093,7 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateInterpolatingSpring(float velocity, float * which will result in an effect of transition from that end value to the value of the state variable. * @return Returns the pointer to the interpolation object of the curve. * Returns NULL if a parameter error occurs. + * @since 12 */ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCustomCurve( void* userData, float (*interpolate)(float fraction, void* userdata)); @@ -1067,7 +1101,8 @@ ArkUI_CurveHandle OH_ArkUI_Curve_CreateCustomCurve( /** * @brief Disposes of a custom curve. * - * @param curve Indicates the pointer to the interpolation object of the curve. + * @param curveHandle Indicates the pointer to the interpolation object of the curve. + * @since 12 */ void OH_ArkUI_Curve_DisposeCurve(ArkUI_CurveHandle curveHandle); @@ -1175,4 +1210,5 @@ int32_t OH_ArkUI_TransitionEffect_SetAnimation( }; #endif -#endif // ARKUI_NATIVE_ANIMATE_H \ No newline at end of file +#endif // ARKUI_NATIVE_ANIMATE_H +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/native_dialog.h b/arkui/ace_engine/native/native_dialog.h index 95b1a6cbefda04982a2e908f85bc796178a4954b..5de204ab42866f32ea1afae3fbb04128333ff732 100644 --- a/arkui/ace_engine/native/native_dialog.h +++ b/arkui/ace_engine/native/native_dialog.h @@ -39,6 +39,7 @@ #include #include "native_type.h" +#include "native_node.h" #ifdef __cplusplus extern "C" { @@ -60,6 +61,30 @@ typedef enum { DIALOG_DISMISS_SLIDE_DOWN, } ArkUI_DismissReason; +/** +* @brief Enumerates the level mode. +* +* @since 15 +*/ +typedef enum { + /** overlay mode. */ + ARKUI_LEVEL_MODE_OVERLAY = 0, + /** embedded mode. */ + ARKUI_LEVEL_MODE_EMBEDDED, +} ArkUI_LevelMode; + +/** +* @brief Enumerates the immersive mode. +* +* @since 15 +*/ +typedef enum { + /** Mask covering the parent node area. */ + ARKUI_IMMERSIVE_MODE_DEFAULT = 0, + /** Mask extend safe area includes status bar and navigation bar. */ + ARKUI_IMMERSIVE_MODE_EXTEND, +} ArkUI_ImmersiveMode; + /** * @brief Invoked when the dialog box is closed. * @@ -74,6 +99,13 @@ typedef bool (*ArkUI_OnWillDismissEvent)(int32_t reason); */ typedef struct ArkUI_DialogDismissEvent ArkUI_DialogDismissEvent; +/** + * @brief Defines a struct for the content object of a custom dialog box. + * + * @since 18 + */ +typedef struct ArkUI_CustomDialogOptions ArkUI_CustomDialogOptions; + /** * @brief Provides the custom dialog box APIs for the native side. * @@ -285,6 +317,333 @@ typedef struct { ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)); } ArkUI_NativeDialogAPI_1; +/** + * @brief Provides the custom dialog box APIs for the native side. + * + * @version 2 + * @since 15 + */ +typedef struct { + /** + * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1} + * + * @since 15 + */ + ArkUI_NativeDialogAPI_1 nativeDialogAPI1; + /** + * @brief Defines the distance between the customDialog and system keyboard. + * + * @note This method must be called before the show method. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param distance distance, in vp. + * @param unit Indicates the unit, which is an enumerated value of {@link ArkUI_LengthMetricUnit} + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ + int32_t (*setKeyboardAvoidDistance)(ArkUI_NativeDialogHandle handle, float distance, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the level mode for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ + int32_t (*setLevelMode)(ArkUI_NativeDialogHandle handle, ArkUI_LevelMode levelMode); + + /** + * @brief Sets the level uniqueId for a custom dialog box. + * + * @note This method must be called before the setLevelMode method. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param uniqueId Indicates the uniquedId of any nodes in router or navigation pages. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ + int32_t (*setLevelUniqueId)(ArkUI_NativeDialogHandle handle, int32_t uniqueId); + + /** + * @brief Sets the immersive mode for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ + int32_t (*setImmersiveMode)(ArkUI_NativeDialogHandle handle, ArkUI_ImmersiveMode immersiveMode); +} ArkUI_NativeDialogAPI_2; + +/** + * @brief Provides the custom dialog box APIs for the native side. + * + * @version 3 + * @since 18 + */ +typedef struct { + /** + * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_1} + * + * @since 18 + */ + ArkUI_NativeDialogAPI_1 nativeDialogAPI1; + /** + * @brief Provides the custom dialog box APIs for the native side. The API scope is {@link ArkUI_NativeDialogAPI_2} + * + * @since 18 + */ + ArkUI_NativeDialogAPI_2 nativeDialogAPI2; + /** + * @brief Sets the display order for a custom dialog box. + * + * @note This method must be called before the show method. + * @param handle Indicates the pointer to the custom dialog box controller. + * @param levelOrder Indicates the display order. The valid range is [-100000.0, 100000.0]. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + int32_t (*setLevelOrder)(ArkUI_NativeDialogHandle handle, double levelOrder); + /** + * @brief Registers a listener callback before the dialog openAnimation starts. + * + * @param handle Indicates the pointer to the custom dialog box controller. + * @param userData Indicates the pointer to the custom data. + * @param callback Indicates the callback before the dialog openAnimation starts. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + + int32_t (*registerOnWillAppear)( + ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); + + /** + * @brief Registers a listener callback when the dialog appears. + * + * @param handle Indicates the pointer to the custom dialog box controller. + * @param userData Indicates the pointer to the custom data. + * @param callback Indicates the callback when the dialog appears. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + int32_t (*registerOnDidAppear)( + ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); + + /** + * @brief Registers a listener callback before the dialog closeAnimation starts. + * + * @param handle Indicates the pointer to the custom dialog box controller. + * @param userData Indicates the pointer to the custom data. + * @param callback Indicates the callback before the dialog closeAnimation starts. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + int32_t (*registerOnWillDisappear)( + ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); + + /** + * @brief Registers a listener callback when the dialog disappears. + * + * @param handle Indicates the pointer to the custom dialog box controller. + * @param userData Indicates the pointer to the custom data. + * @param callback Indicates the callback when the dialog disappears. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + int32_t (*registerOnDidDisappear)( + ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(void* userData)); + + /** + * @brief Sets the border width of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Width of the top border. + * @param right Width of the right border. + * @param bottom Width of the bottom border. + * @param left Width of the left border. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setBorderWidth)( + ArkUI_NativeDialogHandle handle, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the border color of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Color of the top border. + * @param right Color of the right border. + * @param bottom Color of the bottom border. + * @param left Color of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setBorderColor)( + ArkUI_NativeDialogHandle handle, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); + + /** + * @brief Sets the border style of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param top Style of the top border. + * @param right Style of the right border. + * @param bottom Style of the bottom border. + * @param left Style of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setBorderStyle)( + ArkUI_NativeDialogHandle handle, int32_t top, int32_t right, int32_t bottom, int32_t left); + + /** + * @brief Sets the width of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param width Width of the background. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setWidth)(ArkUI_NativeDialogHandle handle, float width, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the height of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param height Height of the background. + * @param unit Unit of the height. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setHeight)(ArkUI_NativeDialogHandle handle, float height, ArkUI_LengthMetricUnit unit); + + /** + * @brief Sets the shadow of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param shadow Shadow style of the background, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setShadow)(ArkUI_NativeDialogHandle handle, ArkUI_ShadowStyle shadow); + + /** + * @brief Sets the custom shadow of the dialog box background. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param customShadow Custom shadow parameter. The format is the same as that of the NODE_SHADOW property. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setCustomShadow)(ArkUI_NativeDialogHandle handle, const ArkUI_AttributeItem* customShadow); + + /** + * @brief Sets the background blur style of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param blurStyle Background blur style, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setBackgroundBlurStyle)(ArkUI_NativeDialogHandle handle, ArkUI_BlurStyle blurStyle); + + /** + * @brief Sets the keyboard avoidance mode of the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*setKeyboardAvoidMode)(ArkUI_NativeDialogHandle handle, ArkUI_KeyboardAvoidMode keyboardAvoidMode); + + /** + * @brief Sets whether to enable the hover mode for the dialog box. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param enableHoverMode Whether to enable the hover mode. The default value is false. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur.. + * @since 18 + */ + int32_t (*enableHoverMode)(ArkUI_NativeDialogHandle handle, bool enableHoverMode); + + /** + * @brief Set the default display area of the dialog box in hover mode. + * + * @note This method must be called before the show method. + * @param handle Pointer to the dialog box controller. + * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occur. + * @since 18 + */ + int32_t (*setHoverModeArea)(ArkUI_NativeDialogHandle handle, ArkUI_HoverModeAreaType hoverModeAreaType); + + /** + * @brief Sets whether to get focus when the custom dialog is displayed. + * + * @param handle Indicates the pointer to the custom dialog box controller. + * @param focusable Specifies whether to get focus when the custom dialog is displayed. The default value is true. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ + int32_t (*setFocusable)(ArkUI_NativeDialogHandle handle, bool focusable); +} ArkUI_NativeDialogAPI_3; + /** * @brief Sets whether to block the system behavior of dismissing a dialog box. * @@ -320,8 +679,417 @@ void* OH_ArkUI_DialogDismissEvent_GetUserData(ArkUI_DialogDismissEvent* event); */ int32_t OH_ArkUI_DialogDismissEvent_GetDismissReason(ArkUI_DialogDismissEvent* event); +/** + * @brief Displays a custom dialog box. + * + * @param options Dialog box parameters. + * @param callback Callback to be invoked when the custom dialog box displays. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_OpenDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); + +/** + * @brief Updates a custom dialog box. + * + * @param options Dialog box parameters. + * @param callback Callback to be invoked when the custom dialog box updates. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_UpdateDialog(ArkUI_CustomDialogOptions* options, void (*callback)(int32_t dialogId)); + +/** + * @brief Closes a custom dialog box. + * + * @param dialogId Dialog id. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_CloseDialog(int32_t dialogId); + +/** + * @brief Creates custom dialog box options. + * + * @param content Content of the custom dialog box. + * @return Returns the pointer to the custom dialog box options. + * @since 18 + */ +ArkUI_CustomDialogOptions* OH_ArkUI_CustomDialog_CreateOptions(ArkUI_NodeHandle content); + +/** + * @brief Destroys the custom dialog box options. + * + * @param options The pointer to the custom dialog box options. + * @since 18 + */ +void OH_ArkUI_CustomDialog_DisposeOptions(ArkUI_CustomDialogOptions* options); + +/** + * @brief Sets the level mode for a custom dialog box. + * + * @note This method must be called before the OH_ArkUI_CustomDialog_OpenDialog method. + * @param options Indicates the pointer to the custom dialog options. + * @param levelMode Indicates the level mode. The parameter type is {@link ArkUI_LevelMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetLevelMode(ArkUI_CustomDialogOptions* options, ArkUI_LevelMode levelMode); + +/** + * @brief Sets the level uniqueId for a custom dialog box. + * + * @param options Indicates the pointer to the custom dialog options. + * @param uniqueId Indicates the unique id of any nodes in router or navigation pages. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetLevelUniqueId(ArkUI_CustomDialogOptions* options, int32_t uniqueId); + +/** + * @brief Sets the immersive mode for a custom dialog box. + * + * @note This method must be called before the OH_ArkUI_CustomDialog_OpenDialog method. + * @param options Indicates the pointer to the custom dialog options. + * @param immersiveMode Indicates the immersive mode. The parameter type is {@link ArkUI_ImmersiveMode}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetImmersiveMode(ArkUI_CustomDialogOptions* options, ArkUI_ImmersiveMode immersiveMode); + +/** + * @brief Sets the background color of the dialog box. + * + * @param options Dialog box parameters. + * @param backgroundColor Background color of the dialog box. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetBackgroundColor(ArkUI_CustomDialogOptions* options, uint32_t backgroundColor); + +/** + * @brief Sets the corner radius for a custom dialog box. + * + * @param options Dialog box parameters. + * @param topLeft Corner radius of the upper left corner. + * @param topRight Corner radius of the upper right corner. + * @param bottomLeft Corner radius of the lower left corner. + * @param bottomRight Corner radius of the lower right corner. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetCornerRadius( + ArkUI_CustomDialogOptions* options, float topLeft, float topRight, float bottomLeft, float bottomRight); + +/** + * @brief Sets the border width of the dialog box. + * + * @param options Dialog box parameters. + * @param top Width of the top border. + * @param right Width of the right border. + * @param bottom Width of the bottom border. + * @param left Width of the left border. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderWidth( + ArkUI_CustomDialogOptions* options, float top, float right, float bottom, float left, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the border color of the dialog box. + * + * @param options Dialog box parameters. + * @param top Color of the top border. + * @param right Color of the right border. + * @param bottom Color of the bottom border. + * @param left Color of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderColor( + ArkUI_CustomDialogOptions* options, uint32_t top, uint32_t right, uint32_t bottom, uint32_t left); + +/** + * @brief Sets the border style of the dialog box. + * + * @param options Dialog box parameters. + * @param top Style of the top border. + * @param right Style of the right border. + * @param bottom Style of the bottom border. + * @param left Style of the left border. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetBorderStyle( + ArkUI_CustomDialogOptions* options, int32_t top, int32_t right, int32_t bottom, int32_t left); + +/** + * @brief Sets the width of the dialog box background. + * + * @param options Dialog box parameters. + * @param width Width of the background. + * @param unit Unit of the width. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetWidth(ArkUI_CustomDialogOptions* options, float width, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the height of the dialog box background. + * + * @param options Dialog box parameters. + * @param height Height of the background. + * @param unit Unit of the height. The default value is vp. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetHeight(ArkUI_CustomDialogOptions* options, float height, ArkUI_LengthMetricUnit unit); + +/** + * @brief Sets the shadow of the dialog box background. + * + * @param options Dialog box parameters. + * @param shadow Shadow style of the background, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetShadow(ArkUI_CustomDialogOptions* options, ArkUI_ShadowStyle shadow); + +/** + * @brief Sets the custom shadow of the dialog box background. + * + * @param options Dialog box parameters. + * @param customShadow Custom shadow parameter. The format is the same as that of the NODE_SHADOW property. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetCustomShadow( + ArkUI_CustomDialogOptions* options, const ArkUI_AttributeItem* customShadow); + +/** + * @brief Sets the background blur style of the dialog box. + * + * @param options Dialog box parameters. + * @param blurStyle Background blur style, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetBackgroundBlurStyle(ArkUI_CustomDialogOptions* options, ArkUI_BlurStyle blurStyle); + +/** + * @brief Sets the alignment mode of the dialog box. + * + * @param options Dialog box parameters. + * @param alignment Alignment mode of the dialog box. The parameter type is {@link ArkUI_Alignment}. + * @param offsetX Indicates the horizontal offset of the custom dialog box. The value is a floating point number. + * @param offsetY Indicates the vertical offset of the custom dialog box. The value is a floating point number. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetAlignment( + ArkUI_CustomDialogOptions* options, int32_t alignment, float offsetX, float offsetY); + +/** + * @brief Sets the modal mode for a custom dialog box. + * + * @param options Dialog box parameters. + * @param isModal Whether the dialog box is a modal. A modal dialog box has a mask applied, + * while a non-modal dialog box does not. The value true means that the dialog box is a modal. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetModalMode(ArkUI_CustomDialogOptions* options, bool isModal); + +/** + * @brief Specifies whether to allow users to touch the mask to dismiss the custom dialog box. + * + * @param options Dialog box parameters. + * @param autoCancel Specifies whether to allow users to touch the mask to dismiss the dialog box. + * The value true means to allow users to do so, and false means the opposite. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetAutoCancel(ArkUI_CustomDialogOptions* options, bool autoCancel); + +/** + * @brief Sets whether to display the dialog box in a subwindow. + * + * @param options Dialog box parameters. + * @param showInSubwindow Whether to display the dialog box in a subwindow when it is not in the main window. + * The default value is false, meaning the dialog box is displayed within the application, not in a + * separate subwindow. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetSubwindowMode(ArkUI_CustomDialogOptions* options, bool showInSubwindow); + +/** + * @brief Sets the mask for a custom dialog box. + * + * @param options Dialog box parameters. + * @param maskColor Mask color, in 0xargb format. + * @param maskRect Pointer to the mask area. Events outside the mask area are transparently transmitted, + * and events within the mask area are not. The parameter type is {@link ArkUI_Rect}. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetMask( + ArkUI_CustomDialogOptions* options, uint32_t maskColor, const ArkUI_Rect* maskRect); + +/** + * @brief Sets the keyboard avoidance mode of the dialog box. + * + * @param options Dialog box parameters. + * @param keyboardAvoidMode Keyboard avoidance mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetKeyboardAvoidMode( + ArkUI_CustomDialogOptions* options, ArkUI_KeyboardAvoidMode keyboardAvoidMode); + +/** + * @brief Sets whether to enable the hover mode for the dialog box. + * + * @param options Dialog box parameters. + * @param enabled Whether to enable the hover mode. The default value is false. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetHoverModeEnabled(ArkUI_CustomDialogOptions* options, bool enabled); + +/** + * @brief Set the default display area of the dialog box in hover mode. + * + * @param options Dialog box parameters. + * @param hoverModeAreaType Display area in hover mode, specified by an enumerated value. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_SetHoverModeArea( + ArkUI_CustomDialogOptions* options, ArkUI_HoverModeAreaType hoverModeAreaType); + +/** + * @brief Registers a callback for the dismissal event of the custom dialog box. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback for the dismissal event of the custom dialog box. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillDismissCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box is about to appear. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the dialog box is about to appear. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillAppearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box appears. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the custom dialog box appears. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnDidAppearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box is about to disappear. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the dialog box is about to disappear. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnWillDisappearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + +/** + * @brief Registers a callback to be invoked when the custom dialog box disappears. + * + * @param options Dialog box parameters. + * @param userData Pointer to the user-defined data. + * @param callback Callback to be invoked when the custom dialog box disappears. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_CustomDialog_RegisterOnDidDisappearCallback( + ArkUI_CustomDialogOptions* options, void* userData, void (*callback)(void* userData)); + #ifdef __cplusplus }; #endif #endif // ARKUI_NATIVE_DIALOG_H +/** @} */ diff --git a/arkui/ace_engine/native/native_gesture.h b/arkui/ace_engine/native/native_gesture.h index 42b37aa9c4b2fec751befab632b234d9ff24be14..edfafda42cb3b8c2621de52af32ec4c27f44edc0 100644 --- a/arkui/ace_engine/native/native_gesture.h +++ b/arkui/ace_engine/native/native_gesture.h @@ -277,6 +277,27 @@ typedef struct ArkUI_GestureEventTargetInfo ArkUI_GestureEventTargetInfo; */ typedef struct ArkUI_ParallelInnerGestureEvent ArkUI_ParallelInnerGestureEvent; +/** + * @brief Defines a touch recognizer. + * + * @since 15 + */ +typedef struct ArkUI_TouchRecognizer ArkUI_TouchRecognizer; + +/** + * @brief Defines a touch recognizer handle. + * + * @since 15 + */ +typedef ArkUI_TouchRecognizer* ArkUI_TouchRecognizerHandle; + +/** + * @brief Defines an array of touch recognizer handle. + * + * @since 15 + */ +typedef ArkUI_TouchRecognizerHandle* ArkUI_TouchRecognizerHandleArray; + /** * @brief Defines a callback function for notifying gesture recognizer destruction. * @since 12 @@ -321,6 +342,39 @@ ArkUI_GestureEvent* OH_ArkUI_GestureInterruptInfo_GetGestureEvent(const ArkUI_Ge */ int32_t OH_ArkUI_GestureInterruptInfo_GetSystemRecognizerType(const ArkUI_GestureInterruptInfo* event); +/** +* @brief Get the touch recognizer handles from the gesture interrupt info. +* +* @param info Indicates the pointer to a gesture interrupt info. +* @param recognizers Indicates the pointer to an array of touch recognizer handles. +* @param size Indicates the size of recognizers. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* @since 15 +*/ +int32_t OH_ArkUI_GestureInterruptInfo_GetTouchRecognizers(const ArkUI_GestureInterruptInfo* info, + ArkUI_TouchRecognizerHandleArray* recognizers, int32_t* size); + +/** +* @brief Get component object of the specific touch recognizer. +* +* @param recognizer Indicates the pointer to the TouchRecognizer. +* @return Get component object of the specific touch recognizer. +* @since 15 +*/ +ArkUI_NodeHandle OH_ArkUI_TouchRecognizer_GetNodeHandle(const ArkUI_TouchRecognizerHandle recognizer); + +/** +* @brief Send touch-cancel event to the touch recognizer in a gesture interruption callback. +* +* @param recognizer Indicates the touch recognizer handle. +* @param info Indicates the pointer to a gesture interrupt info. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* @since 15 +*/ +int32_t OH_ArkUI_TouchRecognizer_CancelTouch(ArkUI_TouchRecognizerHandle recognizer, ArkUI_GestureInterruptInfo* info); + /** * @brief Obtains the gesture event type. * @@ -493,6 +547,18 @@ int32_t OH_ArkUI_GetResponseRecognizersFromInterruptInfo(const ArkUI_GestureInte */ int32_t OH_ArkUI_SetGestureRecognizerEnabled(ArkUI_GestureRecognizer* recognizer, bool enabled); +/** +* @brief Sets whether to enable strict finger count checking. If this feature is enabled and the actual number of touch +* fingers does not match the set number, the gesture recognition fails. +* +* @param recognizer Indicates the pointer to a gesture recognizer. +* @param limitFingerCount Indicates whether to enable strict finger count checking. +* @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 15 +*/ +int32_t OH_ArkUI_SetGestureRecognizerLimitFingerCount(ArkUI_GestureRecognizer* recognizer, bool limitFingerCount); + /** * @brief Obtains the enabled state of a gesture recognizer. * @@ -649,10 +715,126 @@ int32_t OH_ArkUI_ParallelInnerGestureEvent_GetConflictRecognizers(ArkUI_Parallel * @param userData Indicates the custom data. * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if success. * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter exception occurs. +* @since 12 */ int32_t OH_ArkUI_SetArkUIGestureRecognizerDisposeNotify(ArkUI_GestureRecognizer* recognizer, ArkUI_GestureRecognizerDisposeNotifyCallback callback, void* userData); +/** +* @brief Obtains the swipe direction of a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param directMask Swipe direction of the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_DirectMask( + ArkUI_GestureRecognizer* recognizer, ArkUI_GestureDirectionMask* directMask); + +/** +* @brief Obtains the number of fingers used by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param finger Number of fingers used by the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_FingerCount(ArkUI_GestureRecognizer* recognizer, int* finger); + +/** +* @brief Checks whether a gesture recognizer has a finger count limit. +* +* @param recognizer Pointer to a gesture recognizer. +* @param isLimited Whether the gesture recognizer has a finger count limit. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_limitFingerCount(ArkUI_GestureRecognizer* recognizer, bool* isLimited); + +/** +* @brief Checks whether a gesture recognizer supports repeated event callbacks. +* +* @param recognizer Pointer to a gesture recognizer. +* @param isRepeat Whether the gesture recognizer supports repeated event callbacks. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_repeat(ArkUI_GestureRecognizer* recognizer, bool* isRepeat); + +/** +* @brief Obtains the allowed movement distance range for a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param distance Allowed movement distance range of the gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_distance(ArkUI_GestureRecognizer* recognizer, double* distance); + +/** +* @brief Obtains the minimum swipe speed recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param speed Minimum swipe speed recognized by a gesture recognizer. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_speed(ArkUI_GestureRecognizer* recognizer, double* speed); + +/** +* @brief Obtains the minimum duration required to trigger a long press by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param duration Minimum duration for a long press. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_duration(ArkUI_GestureRecognizer* recognizer, int* duration); + +/** +* @brief Obtains the minimum angle change required for a rotation gesture to be recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param angle Minimum angle change. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_angle(ArkUI_GestureRecognizer* recognizer, double* angle); + +/** +* @brief Obtains the movement threshold for gestures to be recognized by a gesture recognizer. +* +* @param recognizer Pointer to a gesture recognizer. +* @param distanceThresHold Movement threshold. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED} if the gesture recognizer type is not +* supported. +* @since 18 +*/ +int32_t OH_ArkUI_GetGestureParam_distanceThreshold(ArkUI_GestureRecognizer* recognizer, double* distanceThreshold); + /** * @brief Defines the gesture APIs. * @@ -912,6 +1094,41 @@ typedef struct { int32_t countNum, int32_t fingersNum, double distanceThreshold); } ArkUI_NativeGestureAPI_1; +/** + * @brief Defines the gesture APIs. + * + * @since 18 + */ +typedef struct { + /** + * @brief Pointer to the ArkUI_NativeGestureAPI_1 struct. + */ + ArkUI_NativeGestureAPI_1* gestureApi1; + + /** + * @brief Sets the callback for gesture interruption events. + * + * @param node Node for which you want to set a gesture interruption callback. + * @param userData Custom data. + * @param interrupter Gesture interruption callback to set. info indicates the gesture interruption data. + * If interrupter returns GESTURE_INTERRUPT_RESULT_CONTINUE, the gesture recognition process proceeds + * properly. If it returns GESTURE_INTERRUPT_RESULT_REJECT, the gesture recognition process is paused. + * @return Returns 0 if success. + * Returns 401 if a parameter error occurs. + */ + int32_t (*setGestureInterrupterToNode)(ArkUI_NodeHandle node, void* userData, + ArkUI_GestureInterruptResult (*interrupter)(ArkUI_GestureInterruptInfo* info)); +} ArkUI_NativeGestureAPI_2; + +/** +* @brief Obtains the custom data from a gesture interruption event. +* +* @param event Pointer to the gesture interruption information. +* @return Returns the pointer to the custom data. +* @since 18 +*/ +void* OH_ArkUI_GestureInterrupter_GetUserData(ArkUI_GestureInterruptInfo* event); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h index 2c138912ccf9bae4b5b577c7d7f30422b2c62a7f..64cae7e06ea74db39542281356b42f0bcb425b82 100644 --- a/arkui/ace_engine/native/native_interface.h +++ b/arkui/ace_engine/native/native_interface.h @@ -64,7 +64,7 @@ typedef enum { * * @param type Indicates the type of the native API set provided by ArkUI, for example, ARKUI_NATIVE_NODE * and ARKUI_NATIVE_GESTURE. - * @param sturctName Indicates the name of a native struct defined in the corresponding header file, for example, + * @param structName Indicates the name of a native struct defined in the corresponding header file, for example, * ArkUI_NativeNodeAPI_1 in . * @return Returns the pointer to the abstract native API, which can be used after being converted into a specific type. * @code {.cpp} diff --git a/arkui/ace_engine/native/native_interface_accessibility.h b/arkui/ace_engine/native/native_interface_accessibility.h index 4150edcec64efad87550a5c61c321d0cd07dd7a4..03c14702f77e9c2c547fbc7896172b1ec372db02 100644 --- a/arkui/ace_engine/native/native_interface_accessibility.h +++ b/arkui/ace_engine/native/native_interface_accessibility.h @@ -27,6 +27,8 @@ * @file native_interface_accessibility.h * * @brief Declares the APIs used to access the native Accessibility. + * + * @library libace_ndk.z.so * @syscap SystemCapability.ArkUI.ArkUI.Full * @kit ArkUI * @since 13 @@ -34,10 +36,14 @@ #ifndef _NATIVE_INTERFACE_ACCESSIBILITY_H #define _NATIVE_INTERFACE_ACCESSIBILITY_H +#ifdef __cplusplus #include +#else +#include +#endif #ifdef __cplusplus -extern "C"{ +extern "C" { #endif /** @@ -101,6 +107,14 @@ typedef enum { ARKUI_ACCESSIBILITY_NATIVE_ACTION_TYPE_SET_TEXT = 0x00004000, /** Cursor position setting action. */ ARKUI_ACCESSIBILITY_NATIVE_ACTION_TYPE_SET_CURSOR_POSITION = 0x00100000, + /** Support action for find next item in focus move operation + * @since 15 + */ + ARKUI_ACCESSIBILITY_NATIVE_ACTION_TYPE_NEXT_HTML_ITEM = 0x02000000, + /** Support action for find previous item in focus move operation + * @since 15 + */ + ARKUI_ACCESSIBILITY_NATIVE_ACTION_TYPE_PREVIOUS_HTML_ITEM = 0x04000000, } ArkUI_Accessibility_ActionType; /** @@ -400,6 +414,104 @@ typedef struct ArkUI_AccessibilityProviderCallbacks { int32_t OH_ArkUI_AccessibilityProviderRegisterCallback( ArkUI_AccessibilityProvider* provider, ArkUI_AccessibilityProviderCallbacks* callbacks); +/** + * @brief Registers callbacks with instance for the accessibility provider. + * @since 15 + */ +typedef struct ArkUI_AccessibilityProviderCallbacksWithInstance { + /** + * @brief Called to obtain element information based on a specified node. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param mode Indicates accessibility search mode. + * @param requestId Matched the request and response. transfer it by callback only. + * @param elementList The all obtained accessibility elements list information. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*findAccessibilityNodeInfosById)(const char* instanceId, int64_t elementId, + ArkUI_AccessibilitySearchMode mode, int32_t requestId, ArkUI_AccessibilityElementInfoList* elementList); + /** + * @brief Called to obtain element information based on a specified node and text content. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param text Filter for the child components to matched with the text. + * @param requestId Matched the request and response. transfer it by callback only. + * @param elementList The all obtained accessibility elements list information. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*findAccessibilityNodeInfosByText)(const char* instanceId, int64_t elementId, const char* text, + int32_t requestId, ArkUI_AccessibilityElementInfoList* elementList); + /** + * @brief Called to obtain focused element information based on a specified node. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param focusType Indicates focus type. + * @param requestId Matched the request and response. transfer it by callback only. + * @param elementInfo The all obtained accessibility elements list information. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*findFocusedAccessibilityNode)(const char* instanceId, int64_t elementId, + ArkUI_AccessibilityFocusType focusType, int32_t requestId, ArkUI_AccessibilityElementInfo* elementInfo); + /** + * @brief Called to find the next focusable node based on the reference node. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param direction Indicates direction. + * @param requestId Matched the request and response. transfer it by callback only. + * @param elementInfo The all obtained accessibility elements list information. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*findNextFocusAccessibilityNode)( + const char* instanceId, int64_t elementId, ArkUI_AccessibilityFocusMoveDirection direction, + int32_t requestId, ArkUI_AccessibilityElementInfo* elementInfo); + /** + * @brief Called to execute a specified action on a specified node. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param action Indicates action. + * @param actionArguments Indicates action arguments. + * @param requestId Matched the request and response. transfer it by callback only. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*executeAccessibilityAction)(const char* instanceId, int64_t elementId, + ArkUI_Accessibility_ActionType action, ArkUI_AccessibilityActionArguments *actionArguments, int32_t requestId); + /** + * @brief Called to clear the focus state of the current focused node. + * @param instanceId Indicates ID of third-party framework instance. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_FAILED} if the operation is failed. + */ + int32_t (*clearFocusedFocusAccessibilityNode)(const char* instanceId); + /** + * @brief Called to query the current cursor position of the specified node. + * @param instanceId Indicates ID of third-party framework instance. + * @param elementId The unique id of the component ID. + * @param requestId Matched the request and response. transfer it by callback only. + * @param index Indicates index. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + */ + int32_t (*getAccessibilityNodeCursorPosition)(const char* instanceId, int64_t elementId, + int32_t requestId, int32_t* index); +} ArkUI_AccessibilityProviderCallbacksWithInstance; + +/** + * @brief Registers a callback with instance for this ArkUI_AccessibilityProvider instance. + * @param instanceId Indicates ID of third-party framework instance. + * @param provider Indicates the pointer to the ArkUI_AccessibilityProvider instance. + * @param callbacks Indicates the pointer to the ArkUI_AccessibilityProviderCallbacksWithInstance callback. + * @return Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * Returns {@link ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 15 + */ +int32_t OH_ArkUI_AccessibilityProviderRegisterCallbackWithInstance(const char* instanceId, + ArkUI_AccessibilityProvider* provider, ArkUI_AccessibilityProviderCallbacksWithInstance* callbacks); + /** * @brief Sends accessibility event information. * @@ -1027,3 +1139,4 @@ int32_t OH_ArkUI_FindAccessibilityActionArgumentByKey( }; #endif #endif // _NATIVE_INTERFACE_ACCESSIBILITY_H +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/native_interface_focus.h b/arkui/ace_engine/native/native_interface_focus.h new file mode 100644 index 0000000000000000000000000000000000000000..c5878c63f925bd0ded3fd89687e42df24bdf3ba6 --- /dev/null +++ b/arkui/ace_engine/native/native_interface_focus.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2025 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 ArkUI_NativeModule + * @{ + * + * @brief Provides focus capabilities of ArkUI on the native side, such as focus transfer operaions. + * + * @since 15 + */ + +/** + * @file native_interface_focus.h + * + * @brief Declares the APIs used to control the focus system. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @kit ArkUI + * @since 15 + */ + +#ifndef ARKUI_NATIVE_INTERFACE_FOCUS_H +#define ARKUI_NATIVE_INTERFACE_FOCUS_H + +#include "napi/native_api.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Determines the priority of key event processing when component cannot handle the key event. + * + * @since 15 + */ +typedef enum { + /** Key events are used to move focus. */ + ARKUI_KEY_PROCESSING_MODE_FOCUS_NAVIGATION = 0, + /** Key events bubble up to ancestors. */ + ARKUI_KEY_PROCESSING_MODE_FOCUS_ANCESTOR_EVENT, +} ArkUI_KeyProcessingMode; + +/** + * @brief Apply focus for a specific node. + * + * @param node The node. + * @return The error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * {@link ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE} if the node is not focusable. + * {@link ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE_ANCESTOR} if the node has unfocusable ancestor. + * {@link ARKUI_ERROR_CODE_FOCUS_NON_EXISTENT} if the node is not exists. + * @since 15 + */ +ArkUI_ErrorCode OH_ArkUI_FocusRequest(ArkUI_NodeHandle node); + +/** + * @brief Clear current focus to root scope. + * + * @param uiContext Indicates the pointer to a UI instance. + * @since 15 + */ +void OH_ArkUI_FocusClear(ArkUI_ContextHandle uiContext); + +/** + * @brief Set the focus active state in current window, the focus node would show its focus box. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param isActive Set the state to be active or inactive. + * @param isAutoInactive When touch event or mouse-pressed event triggerd, + * "true" indicates to set state to inactive, + * "false" indicates to maintain the state until relative API is called. + * @since 15 + */ +void OH_ArkUI_FocusActivate(ArkUI_ContextHandle uiContext, bool isActive, bool isAutoInactive); + +/** + * @brief Set the focus transfer behaviour when current focus view changes. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param autoTransfer Indicates whether to transfer focus when focus view show. + * @since 15 + */ +void OH_ArkUI_FocusSetAutoTransfer(ArkUI_ContextHandle uiContext, bool autoTransfer); + + +/** + * @brief Set the priority of key event processing when component cannot handle the key event. + * + * @param uiContext Indicates the pointer to a UI instance. + * @param mode Indicates the key processing mode. + * @since 15 +*/ +void OH_ArkUI_FocusSetKeyProcessingMode(ArkUI_ContextHandle uiContext, ArkUI_KeyProcessingMode mode); +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_INTERFACE_FOCUS_H +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/native_interface_xcomponent.h b/arkui/ace_engine/native/native_interface_xcomponent.h index 1e427d91e938dc046a62b3b7ba95b76cef89a86c..851520486679499a38d2f774d4c45995fa4fc5c7 100644 --- a/arkui/ace_engine/native/native_interface_xcomponent.h +++ b/arkui/ace_engine/native/native_interface_xcomponent.h @@ -28,7 +28,8 @@ * @file native_interface_xcomponent.h * * @brief Declares APIs for accessing a Native XComponent. - * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full * @kit ArkUI * @since 8 * @version 1.0 @@ -74,6 +75,24 @@ enum { OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2, }; +/** + * @brief Status code for AI analyzer. + * + * @since 18 + */ +typedef enum { + /** AI analyzer execution is finished. */ + ARKUI_XCOMPONENT_AI_ANALYSIS_FINISHED = 0, + /** AI analyzer is disabled. */ + ARKUI_XCOMPONENT_AI_ANALYSIS_DISABLED = 110000, + /** AI analyzer is unsupported. */ + ARKUI_XCOMPONENT_AI_ANALYSIS_UNSUPPORTED = 110001, + /** AI analyzer is ongoing. */ + ARKUI_XCOMPONENT_AI_ANALYSIS_ONGOING = 110002, + /** AI analyzer is stopped. */ + ARKUI_XCOMPONENT_AI_ANALYSIS_STOPPED = 110003, +} ArkUI_XComponent_ImageAnalyzerState; + typedef enum { /** Trigger a touch event when a finger is pressed. */ OH_NATIVEXCOMPONENT_DOWN = 0, @@ -151,6 +170,10 @@ typedef enum { OH_NATIVEXCOMPONENT_MOUSE_PRESS, OH_NATIVEXCOMPONENT_MOUSE_RELEASE, OH_NATIVEXCOMPONENT_MOUSE_MOVE, + /** Triggered when the mouse event is canceled. + * @since 18 + */ + OH_NATIVEXCOMPONENT_MOUSE_CANCEL, } OH_NativeXComponent_MouseEventAction; /** @@ -724,6 +747,30 @@ int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, */ int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); +/** + * @brief Registers a callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @param callback Indicates the pointer to a surface show event callback. + * @return Returns the status code of the execution. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterSurfaceShowCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief Registers a callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @param callback Indicates the pointer to a surface hide event callback. + * @return Returns the status code of the execution. + * @since 12 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterSurfaceHideCallback( + OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); + /** * @brief Registers a UI input event callback for this OH_NativeXComponent instance and enables the callback to * be invoked when a UI input event is received. @@ -753,30 +800,6 @@ int32_t OH_NativeXComponent_RegisterUIInputEventCallback( */ int32_t OH_NativeXComponent_SetNeedSoftKeyboard(OH_NativeXComponent* component, bool needSoftKeyboard); -/** - * @brief Registers a callback for this OH_NativeXComponent instance. - * - * @param component Indicates the pointer to this OH_NativeXComponent instance. - * @param callback Indicates the pointer to a surface show event callback. - * @return Returns the status code of the execution. - * @since 12 - * @version 1.0 - */ -int32_t OH_NativeXComponent_RegisterSurfaceShowCallback( - OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); - -/** - * @brief Registers a callback for this OH_NativeXComponent instance. - * - * @param component Indicates the pointer to this OH_NativeXComponent instance. - * @param callback Indicates the pointer to a surface hide event callback. - * @return Returns the status code of the execution. - * @since 12 - * @version 1.0 - */ -int32_t OH_NativeXComponent_RegisterSurfaceHideCallback( - OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window)); - /** * @brief Registers a custom event intercept callback for this OH_NativeXComponent and enables the callback * during the hit test. @@ -830,7 +853,251 @@ OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle no int32_t OH_NativeXComponent_GetNativeAccessibilityProvider( OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle); +/** + * @brief Registers a callback for this OH_NativeXComponent instance. + * + * @param component Indicates the pointer to this OH_NativeXComponent instance. + * @param callback Indicates the pointer to a key event callback with result. + * @return Returns the status code of the execution. + * {@link OH_NATIVEXCOMPONENT_RESULT_SUCCESS} the callback function is successfully registered.\n + * {@link OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER} component is nullptr or callback is nullptr.\n + * @since 14 + * @version 1.0 + */ +int32_t OH_NativeXComponent_RegisterKeyEventCallbackWithResult( + OH_NativeXComponent* component, bool (*callback)(OH_NativeXComponent* component, void* window)); + +/** + * @brief Start image analyzer for the specified XComponent + * instance created by the native API. + * + * @param node Indicates the pointer to the XComponent instance created by the native API. + * @param userData Indicates the pointer to a user defined data. + * @param callback Indicates the pointer to a image analyzer status callback function. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful.\n + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} component is nullptr or callback is nullptr, + * or the type of node is not XComponent.\n + * @since 18 + */ +int32_t OH_ArkUI_XComponent_StartImageAnalyzer(ArkUI_NodeHandle node, void* userData, + void (*callback)(ArkUI_NodeHandle node, ArkUI_XComponent_ImageAnalyzerState statusCode, void* userData)); + +/** + * @brief Stop image analyzer for the specified XComponent + * instance created by the native API. + * + * @param node Indicates the pointer to the XComponent instance created by the native API. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful.\n + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} component is nullptr or the type of node is not XComponent.\n + * @since 18 + */ +int32_t OH_ArkUI_XComponent_StopImageAnalyzer(ArkUI_NodeHandle node); + +/** + * @brief Provides an encapsulated OH_ArkUI_SurfaceHolder instance. + * + * @since 18 + */ +typedef struct OH_ArkUI_SurfaceHolder OH_ArkUI_SurfaceHolder; + +/** + * @brief Create a OH_ArkUI_SurfaceHolder object from an XComponent node. + * + * @param node Indicates the pointer to the XComponent node. + * @return Returns the created OH_ArkUI_SurfaceHolder object's pointer. + * @since 18 + */ +OH_ArkUI_SurfaceHolder* OH_ArkUI_SurfaceHolder_Create(ArkUI_NodeHandle node); + +/** + * @brief Disposes of a OH_ArkUI_SurfaceHolder object. + * + * @param node Indicates the pointer to OH_ArkUI_SurfaceHolder object needed to dispose. + * @since 18 + */ +void OH_ArkUI_SurfaceHolder_Dispose(OH_ArkUI_SurfaceHolder* surfaceHolder); + +/** + * @brief Saves custom data on the OH_ArkUI_SurfaceHolder instance. + * + * @param surfaceHolder Indicates the OH_ArkUI_SurfaceHolder instance + * on which the custom data will be saved. + * @param userData Indicates the custom data to be saved. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_SurfaceHolder_SetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder, void* userData); + +/** + * @brief Obtains the custom data saved on the OH_ArkUI_SurfaceHolder instance. + * + * @param surfaceHolder Indicates the target OH_ArkUI_SurfaceHolder instance. + * @return Returns the custom data. + * @since 18 + */ +void* OH_ArkUI_SurfaceHolder_GetUserData(OH_ArkUI_SurfaceHolder* surfaceHolder); + +/** + * @brief Define the surface lifecycle callback. + * + * @since 18 + */ +typedef struct OH_ArkUI_SurfaceCallback OH_ArkUI_SurfaceCallback; + +/** + * @brief Create a OH_ArkUI_SurfaceCallback object. + * + * @return Returns the created OH_ArkUI_SurfaceCallback object's pointer. + * @since 18 + */ +OH_ArkUI_SurfaceCallback* OH_ArkUI_SurfaceCallback_Create(); + +/** + * @brief Disposes of a OH_ArkUI_SurfaceCallback object. + * + * @param callback Indicates the pointer to OH_ArkUI_SurfaceCallback object needed to dispose. + * @since 18 + */ +void OH_ArkUI_SurfaceCallback_Dispose(OH_ArkUI_SurfaceCallback* callback); + +/** + * @brief Set the surface created event of the surface callback. + * + * @param callback Indicated the pointer to the surface callback. + * @param onSurfaceCreated Indicates the surface created callback event + * which will called when the surface is created. + * @since 18 + */ +void OH_ArkUI_SurfaceCallback_SetSurfaceCreatedEvent( + OH_ArkUI_SurfaceCallback* callback, + void (*onSurfaceCreated)(OH_ArkUI_SurfaceHolder* surfaceHolder)); + +/** + * @brief Set the surface changed event of the surface callback. + * + * @param callback Indicated the pointer to the surface callback. + * @param onSurfaceChanged Indicates the surface changed callback event + * which will called when the surface is changed. + * @since 18 + */ +void OH_ArkUI_SurfaceCallback_SetSurfaceChangedEvent( + OH_ArkUI_SurfaceCallback* callback, + void (*onSurfaceChanged)(OH_ArkUI_SurfaceHolder* surfaceHolder, uint64_t width, uint64_t height)); + +/** + * @brief Set the surface destroyed event of the surface callback. + * + * @param callback Indicated the pointer to the surface callback. + * @param onSurfaceDestroyed Indicates the surface destroyed callback event + * which will called when the surface is destroyed. + * @since 18 + */ +void OH_ArkUI_SurfaceCallback_SetSurfaceDestroyedEvent( + OH_ArkUI_SurfaceCallback* callback, + void (*onSurfaceDestroyed)(OH_ArkUI_SurfaceHolder* surfaceHolder)); + +/** + * @brief Adds a surface lifecycle callback for this OH_ArkUI_SurfaceHolder instance. + * + * @param surfaceHolder Indicates the pointer to this OH_ArkUI_SurfaceHolder instance. + * @param callback Indicates the pointer to this new callback. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_SurfaceHolder_AddSurfaceCallback( + OH_ArkUI_SurfaceHolder* surfaceHolder, + OH_ArkUI_SurfaceCallback* callback); + +/** + * @brief Removes a previously added surface lifecycle callback + * from this OH_ArkUI_SurfaceHolder instance. + * + * @param surfaceHolder Indicates the pointer to this OH_ArkUI_SurfaceHolder instance. + * @param callback Indicates the pointer to the callback needed to remove. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_SurfaceHolder_RemoveSurfaceCallback( + OH_ArkUI_SurfaceHolder* surfaceHolder, + OH_ArkUI_SurfaceCallback* callback); + +/** + * @brief Forward declaration of OHNativeWindow. + * + * @since 18 + */ +typedef struct NativeWindow OHNativeWindow; + +/** + * @brief Obtains the nativeWindow associated with a OH_ArkUI_SurfaceHolder instance. + * + * @param surfaceHolder Indicates the pointer to this OH_ArkUI_SurfaceHolder instance. + * @return Returns the nativeWindow associated with this OH_ArkUI_SurfaceHolder instance. + * @since 18 + */ +OHNativeWindow* OH_ArkUI_XComponent_GetNativeWindow(OH_ArkUI_SurfaceHolder* surfaceHolder); + +/** + * @brief Set whether the XComponent node needs to initialize automatically. + * + * @param node Indicates the pointer to the XComponent node. + * @param autoInitialize Indicates whether the XComponent node needs to initialize automatically or not. + * If the value is true, OnSurfaceCreated will be called when the node is mounted and + * OnSurfaceDestroyed will be called when the node is unmounted. + * Default value is true. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the node is invalid. + * @since 18 + */ +int32_t OH_ArkUI_XComponent_SetAutoInitialize(ArkUI_NodeHandle node, bool autoInitialize); + +/** + * @brief Initialize the XComponent node. + * + * @param node Indicates the pointer to the XComponent node. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the node is invalid. + * {@link ARKUI_ERROR_CODE_XCOMPONENT_STATE_INVALID} if the node has initialized. + * @since 18 + */ +int32_t OH_ArkUI_XComponent_Initialize(ArkUI_NodeHandle node); + +/** + * @brief Finalize the XComponent node. + * + * @param node Indicates the pointer to the XComponent node. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the node is invalid. + * {@link ARKUI_ERROR_CODE_XCOMPONENT_STATE_INVALID} if the node has finalized. + * @since 18 + */ +int32_t OH_ArkUI_XComponent_Finalize(ArkUI_NodeHandle node); + +/** + * @brief Obtains whether the XComponent node has initalized or not. + * + * @param node Indicates the pointer to the XComponent node. + * @param isInitialized Indicates whether the XComponent node has initalized. + * @return Returns the status code of the execution. + * {@link ARKUI_ERROR_CODE_NO_ERROR} the execution is successful. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the node is invalid. + * @since 18 + */ +int32_t OH_ArkUI_XComponent_IsInitialized(ArkUI_NodeHandle node, bool* isInitialized); + #ifdef __cplusplus }; #endif #endif // _NATIVE_INTERFACE_XCOMPONENT_H_ +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/native_key_event.h b/arkui/ace_engine/native/native_key_event.h new file mode 100644 index 0000000000000000000000000000000000000000..a20f0e9b5f75e9ca329d42efdf748b49375ab77b --- /dev/null +++ b/arkui/ace_engine/native/native_key_event.h @@ -0,0 +1,573 @@ +/* + * 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 ArkUI_NativeModule + * @{ + * + * @brief Provides the general key event APIs of ArkUI on the native side. + * + * @since 14 + */ + +/** + * @file native_key_event.h + * + * @brief Declares the APIs related to native key events. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @kit ArkUI + * @since 14 + */ + +#ifndef ARKUI_NATIVE_KEY_EVENT_H +#define ARKUI_NATIVE_KEY_EVENT_H + +#include + +#include "native_type.h" +#include "ui_input_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines an enum for the key codes in key events. + * + * @since 14 + */ +typedef enum { + /** Unknown (or unrecognized) key **/ + ARKUI_KEYCODE_UNKNOWN = -1, + /** Function (Fn) key **/ + ARKUI_KEYCODE_FN = 0, + /** Volume Up key **/ + ARKUI_KEYCODE_VOLUME_UP = 16, + /** Volume Down key **/ + ARKUI_KEYCODE_VOLUME_DOWN = 17, + /** Power key **/ + ARKUI_KEYCODE_POWER = 18, + /** Shutter key **/ + ARKUI_KEYCODE_CAMERA = 19, + /** Speaker Mute key **/ + ARKUI_KEYCODE_VOLUME_MUTE = 22, + /** Mute key **/ + ARKUI_KEYCODE_MUTE = 23, + /** Brightness Up key **/ + ARKUI_KEYCODE_BRIGHTNESS_UP = 40, + /** Brightness Down key **/ + ARKUI_KEYCODE_BRIGHTNESS_DOWN = 41, + /** Key 0 **/ + ARKUI_KEYCODE_0 = 2000, + /** Key 1 **/ + ARKUI_KEYCODE_1 = 2001, + /** Key 2 **/ + ARKUI_KEYCODE_2 = 2002, + /** Key 3 **/ + ARKUI_KEYCODE_3 = 2003, + /** Key 4 **/ + ARKUI_KEYCODE_4 = 2004, + /** Key 5 **/ + ARKUI_KEYCODE_5 = 2005, + /** Key 6 **/ + ARKUI_KEYCODE_6 = 2006, + /** Key 7 **/ + ARKUI_KEYCODE_7 = 2007, + /** Key 8 **/ + ARKUI_KEYCODE_8 = 2008, + /** Key 9 **/ + ARKUI_KEYCODE_9 = 2009, + /** Key + **/ + ARKUI_KEYCODE_STAR = 2010, + /** Key # **/ + ARKUI_KEYCODE_POUND = 2011, + /** Up key on D-pad **/ + ARKUI_KEYCODE_DPAD_UP = 2012, + /** Down key on D-pad **/ + ARKUI_KEYCODE_DPAD_DOWN = 2013, + /** Left key on D-pad **/ + ARKUI_KEYCODE_DPAD_LEFT = 2014, + /** Right key on D-pad **/ + ARKUI_KEYCODE_DPAD_RIGHT = 2015, + /** OK key on D-pad **/ + ARKUI_KEYCODE_DPAD_CENTER = 2016, + /** Key A **/ + ARKUI_KEYCODE_A = 2017, + /** Key B **/ + ARKUI_KEYCODE_B = 2018, + /** Key C **/ + ARKUI_KEYCODE_C = 2019, + /** Key D **/ + ARKUI_KEYCODE_D = 2020, + /** Key E **/ + ARKUI_KEYCODE_E = 2021, + /** Key F **/ + ARKUI_KEYCODE_F = 2022, + /** Key G **/ + ARKUI_KEYCODE_G = 2023, + /** Key H **/ + ARKUI_KEYCODE_H = 2024, + /** Key I **/ + ARKUI_KEYCODE_I = 2025, + /** Key J **/ + ARKUI_KEYCODE_J = 2026, + /** Key K **/ + ARKUI_KEYCODE_K = 2027, + /** Key L **/ + ARKUI_KEYCODE_L = 2028, + /** Key M **/ + ARKUI_KEYCODE_M = 2029, + /** Key N **/ + ARKUI_KEYCODE_N = 2030, + /** Key O **/ + ARKUI_KEYCODE_O = 2031, + /** Key P **/ + ARKUI_KEYCODE_P = 2032, + /** Key R **/ + ARKUI_KEYCODE_Q = 2033, + /** Key R **/ + ARKUI_KEYCODE_R = 2034, + /** Key S **/ + ARKUI_KEYCODE_S = 2035, + /** Key T **/ + ARKUI_KEYCODE_T = 2036, + /** Key U **/ + ARKUI_KEYCODE_U = 2037, + /** Key V **/ + ARKUI_KEYCODE_V = 2038, + /** Key W **/ + ARKUI_KEYCODE_W = 2039, + /** Key X **/ + ARKUI_KEYCODE_X = 2040, + /** Key Y **/ + ARKUI_KEYCODE_Y = 2041, + /** Key Z **/ + ARKUI_KEYCODE_Z = 2042, + /** Key # **/ + ARKUI_KEYCODE_COMMA = 2043, + /** Key # **/ + ARKUI_KEYCODE_PERIOD = 2044, + /** Left Alt key **/ + ARKUI_KEYCODE_ALT_LEFT = 2045, + /** Right Alt key **/ + ARKUI_KEYCODE_ALT_RIGHT = 2046, + /** Left Shift key **/ + ARKUI_KEYCODE_SHIFT_LEFT = 2047, + /** Right Shift key **/ + ARKUI_KEYCODE_SHIFT_RIGHT = 2048, + /** Tab key **/ + ARKUI_KEYCODE_TAB = 2049, + /** Space key **/ + ARKUI_KEYCODE_SPACE = 2050, + /** Symbol key **/ + ARKUI_KEYCODE_SYM = 2051, + /** Explorer key, used to start the explorer application **/ + ARKUI_KEYCODE_EXPLORER = 2052, + /** Email key, used to start the email application **/ + ARKUI_KEYCODE_ENVELOPE = 2053, + /** Enter key **/ + ARKUI_KEYCODE_ENTER = 2054, + /** Backspace key **/ + ARKUI_KEYCODE_DEL = 2055, + /** Key ` **/ + ARKUI_KEYCODE_GRAVE = 2056, + /** Key - **/ + ARKUI_KEYCODE_MINUS = 2057, + /** Key = **/ + ARKUI_KEYCODE_EQUALS = 2058, + /** Key [ **/ + ARKUI_KEYCODE_LEFT_BRACKET = 2059, + /** Key ]**/ + ARKUI_KEYCODE_RIGHT_BRACKET = 2060, + /** Key \\ **/ + ARKUI_KEYCODE_BACKSLASH = 2061, + /** Key ; **/ + ARKUI_KEYCODE_SEMICOLON = 2062, + /** Key ' **/ + ARKUI_KEYCODE_APOSTROPHE = 2063, + /** Key / **/ + ARKUI_KEYCODE_SLASH = 2064, + /** Key @ **/ + ARKUI_KEYCODE_AT = 2065, + /** Key + **/ + ARKUI_KEYCODE_PLUS = 2066, + /** Menu key **/ + ARKUI_KEYCODE_MENU = 2067, + /** Page Up key **/ + ARKUI_KEYCODE_PAGE_UP = 2068, + /** Page Down key **/ + ARKUI_KEYCODE_PAGE_DOWN = 2069, + /** ESC key **/ + ARKUI_KEYCODE_ESCAPE = 2070, + /** Delete key **/ + ARKUI_KEYCODE_FORWARD_DEL = 2071, + /** Left Ctrl key **/ + ARKUI_KEYCODE_CTRL_LEFT = 2072, + /** Right Ctrl key **/ + ARKUI_KEYCODE_CTRL_RIGHT = 2073, + /** Caps Lock key **/ + ARKUI_KEYCODE_CAPS_LOCK = 2074, + /** Scroll Lock key **/ + ARKUI_KEYCODE_SCROLL_LOCK = 2075, + /** Left Meta key **/ + ARKUI_KEYCODE_META_LEFT = 2076, + /** Right Meta key **/ + ARKUI_KEYCODE_META_RIGHT = 2077, + /** Function key **/ + ARKUI_KEYCODE_FUNCTION = 2078, + /** System Request/Print Screen key **/ + ARKUI_KEYCODE_SYSRQ = 2079, + /** Break/Pause key **/ + ARKUI_KEYCODE_BREAK = 2080, + /** Move to Home key **/ + ARKUI_KEYCODE_MOVE_HOME = 2081, + /** Move to End key **/ + ARKUI_KEYCODE_MOVE_END = 2082, + /** Insert key **/ + ARKUI_KEYCODE_INSERT = 2083, + /** Forward key **/ + ARKUI_KEYCODE_FORWARD = 2084, + /** Play key **/ + ARKUI_KEYCODE_MEDIA_PLAY = 2085, + /** Pause key **/ + ARKUI_KEYCODE_MEDIA_PAUSE = 2086, + /** Close key **/ + ARKUI_KEYCODE_MEDIA_CLOSE = 2087, + /** Eject key **/ + ARKUI_KEYCODE_MEDIA_EJECT = 2088, + /** Record key **/ + ARKUI_KEYCODE_MEDIA_RECORD = 2089, + /** F1 key **/ + ARKUI_KEYCODE_F1 = 2090, + /** F2 key **/ + ARKUI_KEYCODE_F2 = 2091, + /** F3 key **/ + ARKUI_KEYCODE_F3 = 2092, + /** F4 key **/ + ARKUI_KEYCODE_F4 = 2093, + /** F5 key **/ + ARKUI_KEYCODE_F5 = 2094, + /** F6 key **/ + ARKUI_KEYCODE_F6 = 2095, + /** F7 key **/ + ARKUI_KEYCODE_F7 = 2096, + /** F8 key **/ + ARKUI_KEYCODE_F8 = 2097, + /** F9 key **/ + ARKUI_KEYCODE_F9 = 2098, + /** F10 key **/ + ARKUI_KEYCODE_F10 = 2099, + /** F11 key **/ + ARKUI_KEYCODE_F11 = 2100, + /** F12 key **/ + ARKUI_KEYCODE_F12 = 2101, + /** Number Lock key on numeric keypad **/ + ARKUI_KEYCODE_NUM_LOCK = 2102, + /** Key 0 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_0 = 2103, + /** Key 1 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_1 = 2104, + /** Key 2 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_2 = 2105, + /** Key 3 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_3 = 2106, + /** Key 4 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_4 = 2107, + /** Key 5 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_5 = 2108, + /** Key 6 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_6 = 2109, + /** Key 7 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_7 = 2110, + /** Key 8 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_8 = 2111, + /** Key 9 on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_9 = 2112, + /** Key / on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_DIVIDE = 2113, + /** Key ) on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_MULTIPLY = 2114, + /** Key - on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_SUBTRACT = 2115, + /** Key + on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_ADD = 2116, + /** Key . on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_DOT = 2117, + /** Key , on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_COMMA = 2118, + /** Enter key on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_ENTER = 2119, + /** Key = on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_EQUALS = 2120, + /** Key ( on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_LEFT_PAREN = 2121, + /** Key ) on numeric keypad **/ + ARKUI_KEYCODE_NUMPAD_RIGHT_PAREN = 2122, + /** + * Joystick key A + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_A = 2301, + /** + * Joystick key B + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_B = 2302, + /** + * Joystick key X + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_X = 2304, + /** + * Joystick key Y + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_Y = 2305, + /** + * Joystick key L1 + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_L1 = 2307, + /** + * Joystick key R1 + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_R1 = 2308, + /** + * Joystick key L2 + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_L2 = 2309, + /** + * Joystick key R2 + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_R2 = 2310, + /** + * Joystick key Select + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_SELECT = 2311, + /** + * Joystick key Start + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_START = 2312, + /** + * Joystick key Mode + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_MODE = 2313, + /** + * Joystick key THUMBL + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_THUMBL = 2314, + /** + * Joystick key THUMBR + * @since 15 + */ + ARKUI_KEYCODE_BUTTON_THUMBR = 2315, +} ArkUI_KeyCode; + +/** + * @brief Defines an enum for the key event types. + * + * @since 14 + */ +typedef enum { + /** Unknown type **/ + ARKUI_KEY_EVENT_UNKNOWN = -1, + /** Pressing of a key **/ + ARKUI_KEY_EVENT_DOWN = 0, + /** Release of a key **/ + ARKUI_KEY_EVENT_UP = 1, + /** Long press of a key **/ + ARKUI_KEY_EVENT_LONG_PRESS = 2, + /** Click of a key **/ + ARKUI_KEY_EVENT_CLICK = 3, +} ArkUI_KeyEventType; + +/** + * @brief Defines an enum for the types of devices that trigger a key event. + * + * @since 14 + */ +typedef enum { + /** Unknown type **/ + ARKUI_KEY_SOURCE_UNKNOWN = 0, + /** Mouse **/ + ARKUI_KEY_SOURCE_TYPE_MOUSE = 1, + /** Keyboard **/ + ARKUI_KEY_SOURCE_TYPE_KEYBOARD = 4, + /** + * @brief Joystick. + * + * @since 15 + */ + ARKUI_KEY_SOURCE_TYPE_JOYSTICK = 5, +} ArkUI_KeySourceType; + +/** + * @brief Defines an enum for key intentions. + * + * @since 14 + */ +typedef enum { + /** Unknown intention **/ + ARKUI_KEY_INTENSION_UNKNOWN = -1, + /**Upward**/ + ARKUI_KEY_INTENSION_UP = 1, + /** Downward **/ + ARKUI_KEY_INTENSION_DOWN = 2, + /** Leftward **/ + ARKUI_KEY_INTENSION_LEFT = 3, + /** Rightward **/ + ARKUI_KEY_INTENSION_RIGHT = 4, + /** Select **/ + ARKUI_KEY_INTENSION_SELECT = 5, + /** Escape **/ + ARKUI_KEY_INTENSION_ESCAPE = 6, + /** Back**/ + ARKUI_KEY_INTENSION_BACK = 7, + /** Forward **/ + ARKUI_KEY_INTENSION_FORWARD = 8, + /** Menu **/ + ARKUI_KEY_INTENSION_MENU = 9, + /** Home **/ + ARKUI_KEY_INTENSION_HOME = 10, + /** Page up **/ + ARKUI_KEY_INTENSION_PAGE_UP = 11, + /** Page down **/ + ARKUI_KEY_INTENSION_PAGE_DOWN = 12, + /** Zoom out **/ + ARKUI_KEY_INTENSION_ZOOM_OUT = 13, + /** Zoom in **/ + ARKUI_KEY_INTENSION_ZOOM_IN = 14, + + /** Play or pause **/ + ARKUI_KEY_INTENTION_MEDIA_PLAY_PAUSE = 100, + /** Fast-forward **/ + ARKUI_KEY_INTENTION_MEDIA_FAST_FORWARD = 101, + /** Fast playback **/ + ARKUI_KEY_INTENTION_MEDIA_FAST_PLAYBACK = 103, + /** Play next **/ + ARKUI_KEY_INTENTION_MEDIA_NEXT = 104, + /** Play previous **/ + ARKUI_KEY_INTENTION_MEDIA_PREVIOUS = 105, + /** Mute **/ + ARKUI_KEY_INTENTION_MEDIA_MUTE = 106, + /** Volume up **/ + ARKUI_KEY_INTENTION_VOLUME_UP = 107, + /** Volume down **/ + ARKUI_KEY_INTENTION_VOLUME_DOWN = 108, + + /** Answer a call **/ + ARKUI_KEY_INTENTION_CALL = 200, + /** Camera **/ + ARKUI_KEY_INTENTION_CAMERA = 300, +} ArkUI_KeyIntension; + +/** + * @brief Obtains the type of a key event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the key event type. + * @since 14 + */ +ArkUI_KeyEventType OH_ArkUI_KeyEvent_GetType(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the key code from a key event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the key code. + * @since 14 + */ +int32_t OH_ArkUI_KeyEvent_GetKeyCode(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the key value from a key event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the key value. + * @since 14 + */ +const char *OH_ArkUI_KeyEvent_GetKeyText(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the type of device that triggers a key event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the device type. + * @since 14 + */ +ArkUI_KeySourceType OH_ArkUI_KeyEvent_GetKeySource(const ArkUI_UIInputEvent* event); + +/** + * @brief Prevents a key event from bubbling up. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param stopPropagation Whether to stop event propagation. + * @since 14 + */ +void OH_ArkUI_KeyEvent_StopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); + +/** + * @brief Obtains the intention code associated with a key event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the intention code associated with the key event. + * @since 14 + */ +ArkUI_KeyIntension OH_ArkUI_KeyEvent_GetKeyIntensionCode(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the Unicode value associated with a key event. + * Non-space basic Latin characters in the 0x0021-0x007E range are supported. Characters with a value of 0 are not + * supported. In the case of key combination, this API returns the Unicode value of the key corresponding to the key + * event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the Unicode value. + * @since 14 + */ +uint32_t OH_ArkUI_KeyEvent_GetUnicode(const ArkUI_UIInputEvent* event); + +/** + * @brief Sets whether a key event is consumed in the key event callback. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param isConsumed Whether the event is consumed. + * @since 14 + */ +void OH_ArkUI_KeyEvent_SetConsumed(const ArkUI_UIInputEvent* event, bool isConsumed); + +/** + * @brief Dispatch key event to a specific component node. + * + * @param node Indicates the pointer to a component node. + * @param event Pointer to an ArkUI_UIInputEvent object. + * @since 15 + */ +void OH_ArkUI_KeyEvent_Dispatch(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event); +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_KEY_EVENT_H +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index a8ff1e5dd962ef1931818772ec99a939fb800169..c246d755ff67c3e5ce6bcc1f956cc26498ac5f50 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -39,6 +39,7 @@ #include "native_type.h" #include "ui_input_event.h" +#include #ifdef __cplusplus extern "C" { @@ -92,6 +93,14 @@ typedef enum { ARKUI_NODE_RADIO = 18, /** Image animator. */ ARKUI_NODE_IMAGE_ANIMATOR = 19, + /** XComponent of type TEXTURE. + * @since 18 + */ + ARKUI_NODE_XCOMPONENT_TEXTURE, + /** Check box group. + * @since 15 + */ + ARKUI_NODE_CHECKBOX_GROUP = 21, /** Stack container. */ ARKUI_NODE_STACK = MAX_NODE_SCOPE_NUM, /** Swiper. */ @@ -475,10 +484,10 @@ typedef enum { * This attribute can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].f32: z-index value. \n + * .value[0].i32: z-index value. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].f32: z-index value. \n + * .value[0].i32: z-index value. \n * */ NODE_Z_INDEX, @@ -1792,6 +1801,16 @@ typedef enum { */ NODE_TRANSITION = 94, + /** + * @brief Defines the component ID. + * This attribute can be obtained through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute:\n + * .value[0].i32: component ID. \n + * + */ + NODE_UNIQUE_ID = 95, + /** * @brief Set the current component system focus box style. * @@ -1806,16 +1825,6 @@ typedef enum { */ NODE_FOCUS_BOX = 96, - /** - * @brief Defines the component ID. - * This attribute can be obtained through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for obtaining the attribute:\n - * .value[0].i32: component ID. \n - * - */ - NODE_UNIQUE_ID = 95, - /** * @brief Defines the moving distance limit for the component-bound tap gesture. * This attribute can be set as required through APIs. @@ -1825,7 +1834,96 @@ typedef enum { * */ NODE_CLICK_DISTANCE = 97, + + /** + * @brief Sets whether the focus can be placed on this component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether the focus can be placed on the current component. The parameter type is 1 or 0. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether the focus can be placed on the current component. The parameter type is 1 or 0. + * + * @since 14 + */ + NODE_TAB_STOP = 98, + /** + * @brief Defines the backdrop blur attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32:backdrop blur radius, in px. The value range is [0, +∞).\n + * .value[1]?.f32:grayscale blur settings that control the brightness of the black color.\n + * The value range is [0, 127].\n + * .value[2]?.f32:grayscale blur settings that control the darkness of the white color.\n + * The value range is [0, 127].\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32:backdrop blur radius, in px. The value range is [0, +∞).\n + * .value[1].f32:grayscale blur settings that control the brightness of the black color.\n + * The value range is [0, 127].\n + * .value[2].f32:grayscale blur settings that control the darkness of the white color.\n + * The value range is [0, 127].\n + * + * @since 15 + */ + NODE_BACKDROP_BLUR = 99, + + /** + * @brief Defines the background image resizable attribute, which can be set, reset, + * and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: width of the left edge. The unit is vp. \n + * .value[1].f32: width of the top edge. The unit is vp. \n + * .value[2].f32: width of the right edge. The unit is vp. \n + * .value[3].f32: width of the bottom edge. The unit is vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: width of the left edge. The unit is vp. \n + * .value[1].f32: width of the top edge. The unit is vp. \n + * .value[2].f32: width of the right edge. The unit is vp. \n + * .value[3].f32: width of the bottom edge. The unit is vp. \n + * + * @since 18 + */ + NODE_BACKGROUND_IMAGE_RESIZABLE_WITH_SLICE = 100, + + /** + * @brief Sets the next focus node. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0].i32: focus movement direction, as defined in {@link ArkUI_FocusMove}. + * .object: next focus node. The parameter type is {@link ArkUI_NodeHandle}.\n + * \n + * + * @since 18 + */ + NODE_NEXT_FOCUS = 101, + + /** + * @brief Sets the parameters for visible area change events. + * + * @note The visible area change callback is not a real-time callback. The actual callback interval may differ from + * the expected interval due to system load and other factors. + * The interval between two visible area change callbacks will not be less than the expected update interval. If the + * provided expected interval is too short, the actual callback interval will be determined by the system load. + * By default, the interval threshold of the visible area change callback includes 0. This means that, + * if the provided threshold is [0.5], the effective threshold will be [0.0, 0.5]. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: parameters for visible area change events. + * The parameter type is {@link ArkUI_VisibleAreaEventOptions}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: parameters for visible area change events. + * The parameter type is {@link ArkUI_VisibleAreaEventOptions}. \n + * + * @since 18 + */ + NODE_VISIBLE_AREA_APPROXIMATE_CHANGE_RATIO = 102, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -2199,6 +2297,20 @@ typedef enum { */ NODE_TEXT_HALF_LEADING = 1029, + /** + * @brief Defines the font weight attribute, which can be set, reset, and obtained as required through APIs. + * The font weight specified by this API is not affected by any changes in the system font weight settings. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: font weight {@link ArkUI_FontWeight}. The default value is ARKUI_FONT_WEIGHT_NORMAL.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: font weight {@link ArkUI_FontWeight}.\n + * + * @since 15 + */ + NODE_IMMUTABLE_FONT_WEIGHT = 1030, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * @@ -2952,6 +3064,60 @@ typedef enum { * */ NODE_TEXT_INPUT_NUMBER_OF_LINES, + + /** + * @brief Sets the letter spacing of the TextInput component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * + * @since 15 + */ + NODE_TEXT_INPUT_LETTER_SPACING = 7032, + /** + * @brief Sets whether to enable preview text for the TextInput component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to enable preview tex. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable preview tex. \n + * + * @since 15 + */ + NODE_TEXT_INPUT_ENABLE_PREVIEW_TEXT = 7033, + + /** + * @brief Sets whether to center text vertically in the textInput component. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to center text vertically. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to center text vertically. \n + * + * @since 18 + */ + NODE_TEXT_INPUT_HALF_LEADING = 7034, + + /** + * @brief Set the keyboard style of textInput + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:keyboard style,the parameter type is {@link ArkUI_KeyboardAppearanceType}。\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32:keyboard style,the parameter type is {@link ArkUI_KeyboardAppearanceType}。\n + * + * @since 15 + */ + NODE_TEXT_INPUT_KEYBOARD_APPEARANCE = 7035, + /** * @brief Defines the default placeholder text for the multi-line text box. * This attribute can be set, reset, and obtained as required through APIs. @@ -3246,6 +3412,60 @@ typedef enum { * */ NODE_TEXT_AREA_NUMBER_OF_LINES, + + /** + * @brief Sets the letter spacing of the TextArea component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: letter spacing. The default unit is fp. \n + * + * @since 15 + */ + NODE_TEXT_AREA_LETTER_SPACING = 8023, + /** + * @brief Sets whether to enable preview text for the TextArea component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to enable preview tex. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable preview tex. \n + * + * @since 15 + */ + NODE_TEXT_AREA_ENABLE_PREVIEW_TEXT = 8024, + + /** + * @brief Sets whether to center text vertically in the textArea component. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to center text vertically. The default value is false. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to center text vertically. \n + * + * @since 18 + */ + NODE_TEXT_AREA_HALF_LEADING = 8025, + + /** + * @brief Set the keyboard style of textArea + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32:keyboard style,the parameter type is {@link ArkUI_KeyboardAppearanceType}。\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32:keyboard style,the parameter type is {@link ArkUI_KeyboardAppearanceType}。\n + * + * @since 15 + */ + NODE_TEXT_AREA_KEYBOARD_APPEARANCE = 8026, + /** * @brief Defines the button text content. This attribute can be set, reset, and obtained as required through APIs. * @@ -3264,14 +3484,42 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: button type. The parameter type is {@link ArkUI_ButtonType}. * The default value is ARKUI_BUTTON_TYPE_CAPSULE. \n + * After api 16 the default value change to ARKUI_BUTTON_ROUNDED_RECTANGLE. * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: button type. The parameter type is {@link ArkUI_ButtonType}. * The default value is ARKUI_BUTTON_TYPE_CAPSULE. \n + * After api 16 the default value change to ARKUI_BUTTON_ROUNDED_RECTANGLE. * */ NODE_BUTTON_TYPE, + /** + * @brief Defines the minimum font scale attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: minimum font scale, in fp. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum font scale, in fp. + * + * @since 18 + */ + NODE_BUTTON_MIN_FONT_SCALE, + + /** + * @brief Defines the maximum font scale attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: maximum font scale, in fp. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: maximum font scale, in fp. + * + * @since 18 + */ + NODE_BUTTON_MAX_FONT_SCALE, + /** * @brief Defines the current value of the progress indicator. * This attribute can be set, reset, and obtained as required through APIs. @@ -3321,6 +3569,20 @@ typedef enum { * */ NODE_PROGRESS_TYPE, + /** + * @brief Sets the style of the linear progress indicator. + * This attribute can be set, reset, and obtained as required through APIs. + * If the progress indicator type is not linear, it will not take effect. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: Use the {@link ArkUI_ProgressLinearStyleOption} object to set the style. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: Use the {@link ArkUI_ProgressLinearStyleOption} object to get the style. \n + * + * @since 15 + */ + NODE_PROGRESS_LINEAR_STYLE, /** * @brief Defines whether the check box is selected. @@ -3392,6 +3654,34 @@ typedef enum { */ NODE_CHECKBOX_SHAPE, + /** + * @brief Defines the name of the checkbox. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: component name. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: component name. \n + * + * @since 15 + */ + NODE_CHECKBOX_NAME, + + /** + * @brief Defines the name of the checkbox. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: component name. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: component name. \n + * + * @since 15 + */ + NODE_CHECKBOX_GROUP, + /** * @brief Defines the ID of the component. * This attribute can be set and obtained as required through APIs. @@ -3430,6 +3720,37 @@ typedef enum { * */ NODE_XCOMPONENT_SURFACE_SIZE, + /** + * @brief Defines the rectangle information of surface created by the component. + * This attribute can be set and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: The horizontal offset of the surface relative to XComponent, in pixels. \n + * .value[1].i32: The vertical offset of the surface relative to XComponent, in pixels. \n + * .value[2].i32: The width of the surface created by XComponent, in pixels. \n + * .value[3].i32: The height of the surface created by XComponent, in pixels. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: The horizontal offset of the surface relative to XComponent, in pixels. \n + * .value[1].i32: The vertical offset of the surface relative to XComponent, in pixels. \n + * .value[2].i32: The width of the surface created by XComponent, in pixels. \n + * .value[3].i32: The height of the surface created by XComponent, in pixels. \n + * @since 18 + */ + NODE_XCOMPONENT_SURFACE_RECT, + /** + * @brief Defines whether to enable the AI analyzer for the component. + * This attribute can be set and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * value[0].i32: The parameter type is 1 or 0. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: The parameter type is 1 or 0. + * @since 18 + */ + NODE_XCOMPONENT_ENABLE_ANALYZER, /** * @brief Defines whether to display the lunar calendar in the date picker. @@ -3551,6 +3872,33 @@ typedef enum { * */ NODE_DATE_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief Defines the mode of the date picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * value[0].i32: the mode. The value is and enum of {@link ArkUI_DatePickerMode}.\n. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: the mode. The value is and enum of {@link ArkUI_DatePickerMode}.\n. + * + * @since 18 + */ + NODE_DATE_PICKER_MODE = 13007, + /** + * @brief Defines whether haptic feedback. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to feedback. The value true means to feedback, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether to feedback.\n + * + * @since 18 + */ + NODE_DATE_PICKER_ENABLE_HAPTIC_FEEDBACK = 13008, /** * @brief Defines the time of the selected item. in the timer picker. * This attribute can be set, reset, and obtained as required through APIs. @@ -3648,6 +3996,45 @@ typedef enum { * */ NODE_TIME_PICKER_SELECTED_TEXT_STYLE, + /** + * @brief Defines the start time of the time picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: time. The default value is "00:00:00".\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: time. The default value is "00:00:00".\n + * + * @since 18 + */ + NODE_TIME_PICKER_START = 14005, + /** + * @brief Defines the end time of the time picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: time. The default value is "23:59:59".\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: time. The default value is "23:59:59".\n + * + * @since 18 + */ + NODE_TIME_PICKER_END = 14006, + /** + * @brief Defines whether the AM/PM option is cascaded with the time in 12-hour mode. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to enable cascade. The default value is false.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable cascade.\n + * + * @since 18 + */ + NODE_TIME_PICKER_ENABLE_CASCADE = 14007, /** * @brief Defines the data selection range of the text picker. @@ -3809,14 +4196,28 @@ typedef enum { */ NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, /** - * @brief Defines the style of the background in the selected state of the calendar picker. + * @brief Defines whether haptic feedback. * This attribute can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].f32: style of the background in the selected state of the calendar picker. - * The value range is [0, +∞). If the value is 0, the background is a rectangle with square corners. - If the value is in the 0–16 range, the background is a rectangle with rounded corners. If the value is equal to - * or greater than 16, the background is a circle. \n + * .value[0].i32: whether to feedback. The value true means to feedback, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether to feedback.\n + * + * @since 18 + */ + NODE_TEXT_PICKER_ENABLE_HAPTIC_FEEDBACK = 15010, + /** + * @brief Defines the style of the background in the selected state of the calendar picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: style of the background in the selected state of the calendar picker. + * The value range is [0, +∞). If the value is 0, the background is a rectangle with square corners. + If the value is in the 0–16 range, the background is a rectangle with rounded corners. If the value is equal to + * or greater than 16, the background is a circle. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: style of the background in the selected state of the calendar picker. The value range is [0, +∞). @@ -3877,6 +4278,32 @@ typedef enum { * */ NODE_CALENDAR_PICKER_TEXT_STYLE, + /** + * @brief Defines the start date of the calendar picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: date. The value like "1970-1-1". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: date. \n + * + * @since 18 + */ + NODE_CALENDAR_PICKER_START = 16004, + /** + * @brief Defines the end date of the calendar picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: date. The value like "2100-12-31". \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: date. \n + * + * @since 18 + */ + NODE_CALENDAR_PICKER_END = 16005, /** * @brief Defines the color of the slider. This attribute can be set, reset, and obtained as required through APIs. * @@ -4104,6 +4531,21 @@ typedef enum { */ NODE_SLIDER_TRACK_THICKNESS, + /** + * @brief Defines whether haptic feedback. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to feedback. The value true means to feedback, and + * false means the opposite.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether to feedback.\n + * + * @since 18 + */ + NODE_SLIDER_ENABLE_HAPTIC_FEEDBACK = 17013, + /** * @brief Set the selection status of an option button. Attribute setting, * attribute resetting, and attribute obtaining are supported. @@ -4257,6 +4699,95 @@ typedef enum { */ NODE_IMAGE_ANIMATOR_ITERATION = 19006, + /** + * @brief Defines the name of the checkboxgroup. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: component name. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: component name. \n + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_NAME = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX_GROUP, + + /** + * @brief Defines whether the checkboxgroup is selected. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether the checkboxgroup is selected. + * The value 1 means that the checkboxgroup is selected, and 0 means the opposite. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The value 1 means that the checkboxgroup is selected, and 0 means the opposite. \n + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_SELECT_ALL, + + /** + * @brief Defines the color of the checkboxgroup when it is selected. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: color of the checkboxgroup when it is selected, in 0xARGB format, + * for example, 0xFF1122FF. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: color of the checkboxgroup when it is selected, in 0xARGB format, for example, 0xFF1122FF. + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_SELECTED_COLOR, + /** + * @brief Defines the border color of the checkboxgroup when it is not selected. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF. + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_UNSELECTED_COLOR, + + /** + * @brief Defines the internal icon style of the checkboxgroup. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF.\n + * .value[1]?.f32: size of the internal mark, in vp. Optional.\n + * .value[2]?.f32: stroke width of the internal mark, in vp. Optional. The default value is 2. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF.\n + * .value[1].f32: size of the internal mark, in vp. \n + * .value[2].f32: stroke width of the internal mark, in vp. The default value is 2. \n + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_MARK, + + /** + * @brief Defines the shape of the checkboxgroup. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: component shape. The parameter type is {@link ArkUI_CheckboxShape}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: component shape. The parameter type is {@link ArkUI_CheckboxShape}. + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_SHAPE, + /** * @brief Defines the alignment mode of the child components in the container. This attribute can be set, reset, * and obtained as required through APIs. @@ -4329,12 +4860,17 @@ typedef enum { * .value[1]?.i32: whether to enable the scroll effect when the component content size is smaller than the * component itself. Optional. The value 1 means to enable the scroll effect, and 0 means the * opposite. The default value is 1. \n + * .value[2]?.i32: direction in which the effect takes effect. The parameter type is {@link ArkUI_EffectEdge}. + * The default value is ARKUI_EFFECT_EDGE_START | ARKUI_EFFECT_EDGE_END. This parameter is supported since + * API version 16. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: effect used at the edges of the component when the boundary of the scrollable content is reached. * The parameter type is {@link ArkUI_EdgeEffect}. \n * .value[1].i32: whether to enable the scroll effect when the component content size is smaller than the component * itself. Optional. The value 1 means to enable the scroll effect, and 0 means the opposite. \n + * .value[2].i32: edge for which the effect takes effect when the boundary of the scrollable content is reached. + * The parameter type is {@link ArkUI_EffectEdge}. This parameter is supported since API version 16. \n * */ NODE_SCROLL_EDGE_EFFECT, @@ -4483,6 +5019,120 @@ typedef enum { */ NODE_SCROLL_BY, + /** + * @brief Performs inertial scrolling based on the initial velocity passed in. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: Initial velocity of inertial scrolling. Unit: vp/s. If the value specified is 0, it is + * considered as invalid, and the scrolling for this instance will not take effect. If the value is positive, + * the scroll will move downward; if the value is negative, the scroll will move upward. \n + * + * @since 13 + */ + NODE_SCROLL_FLING, + + /** + * @brief Sets the fading effect for the edges of scrollable components. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: + * .value[0].i32: whether to enable the fading effect on edges. The value 0 means to disable the fading effect, + * and 1 means to enable it. + * .value[1]?.f32: length of the fading effect on edges, in vp. Default value: 32. + * + * Format of the return value {@link ArkUI_AttributeItem}: + * .value[0].i32: whether the fading effect on edges is enabled. The value 0 means that the fading effect is + * disabled, and 1 means that it is enabled. + * .value[1].f32: length of the fading effect on edges, in vp. + * + * @since 14 + */ + NODE_SCROLL_FADING_EDGE, + + /** + * @brief Obtains the total size of all child components when fully expanded in the scrollable component. + * + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: total width of all child components when fully expanded in the scrollable component. + * The default unit is vp. \n + * .value[1].f32: total height of all child components when fully expanded in the scrollable component. + * The default unit is vp. \n + * When NODE_PADDING, NODE_MARGIN, or NODE_BORDER_WIDTH is set, the values are rounded to the + * nearest pixel when being converted from vp to px. + * The returned values are calculated based on these rounded pixel values. \n + * + * @since 14 + */ + NODE_SCROLL_SIZE, + + /** + * @brief Sets the offset from the start of the scrollable components content. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: offset from the start of the content, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: offset from the start of the content, in vp. \n + * + * @since 15 + */ + NODE_SCROLL_CONTENT_START_OFFSET, + + /** + * @brief Sets the offset from the end of the scrollable components content. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: offset from the end of the content, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: offset from the end of the content, in vp. \n + * + * @since 15 + */ + NODE_SCROLL_CONTENT_END_OFFSET, + + /** + * @brief Defines the maximum starting fling speed of the scrollable when the fling animation starts. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0].f32: maximum starting fling speed, Unit: vp/s \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].f32: maximum starting fling speed, Unit: vp/s \n + * + * @since 18 + */ + NODE_SCROLL_FLING_SPEED_LIMIT = 1002019, + + /** + * @brief Defines the clip mode of the scrollable. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0].i32: clip content mode, The parameter type is {@link ArkUI_ContentClipMode}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].i32: clip content mode, The parameter type is {@link ArkUI_ContentClipMode}. \n + * + * @since 18 + */ + NODE_SCROLL_CLIP_CONTENT = 1002020, + + /** + * @brief Defines whether the scrollable scrolls back to top when status bar is clicked. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute: \n + * .value[0].i32: whether the scrollable scrolls back to top when status bar is clicked. + * The value 1 means to scroll back to top, and 0 means the opposite. The default value is 0/b>. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}: \n + * .value[0].i32: whether the scrollable scrolls back to top when status bar is clicked. \n + * + * @since 15 + */ + NODE_SCROLL_BACK_TO_TOP = 1002021, + /** * @brief Defines the direction in which the list items are arranged. This attribute can be set, reset, and * obtained as required through APIs. @@ -4533,12 +5183,20 @@ typedef enum { NODE_LIST_NODE_ADAPTER, /** - * @brief Sets the number of cached items in the list adapter. - * This attribute can be set, reset, and obtained as required through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: number of cached items in the list adapter. \n - */ + * @brief Sets the number of cached items in the list adapter. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: number of cached items in the list adapter. \n + * .value[1]?.i32: whether to show cached items. The value 0 means to hide cached items, and 0 means + * to show cached items. The default value is 0. This parameter is supported since API version 15. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of cached items in the list adapter. \n + * .value[1].i32: whether to show cached items. The value 0 means to hide cached items, and 0 means + * to show cached items. This parameter is supported since API version 15. \n + * + */ NODE_LIST_CACHED_COUNT, /** @@ -4553,6 +5211,7 @@ typedef enum { * 1 indicates an action and 0 indicates no action. Default value: 0。\n * .value[2]?.i32:Specify the alignment of the sliding element with the current container,The parameter type is * {@link ArkUI_ScrollAlignment}, default value is ARKUI_SCROLL_ALIGNMENT_START. \n + * .value[3]?.f32: extra offset, in vp. The default value is 0. * */ NODE_LIST_SCROLL_TO_INDEX, @@ -4614,6 +5273,93 @@ typedef enum { */ NODE_LIST_DIVIDER = 1003009, + /** + * @brief Scrolls to the item with the specified index in the specified list item group. + * + * When smooth is set to true, all passed items are loaded and counted in layout calculation. + * This may result in performance issues if a large number of items are involved. \n + * \n + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: index of the target list item group in the current list. \n + *.value[1].i32: index of the target list item in the list item group. \n + * .value[2]?.i32: whether to enable the smooth animation for scrolling to the item with the specified index. + * The value 1 means to enable the animation, and 0 means the opposite. + * The default value is 0. \n + * .value[3]?.i32: how the item to scroll to is aligned with the container. The parameter type is + * {@link ArkUI_ScrollAlignment}. The default value is ARKUI_SCROLL_ALIGNMENT_START. \n + * + * @since 15 + */ + NODE_LIST_SCROLL_TO_INDEX_IN_GROUP = 1003010, + + /** + * @brief Sets the number of lanes in the list. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].u32: number of lanes in the list. If the maximum and minimum lane widths are set, setting the number + * of lanes will not take effect. \n + * .value[1]?.f32: minimum lane width, in vp. \n + * .value[2]?.f32: maximum column width, in vp. \n + * .value[3]?.f32: lane spacing, in vp. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].u32: number of lanes in the list. \n + * .value[1].f32: minimum lane width, in vp. \n + * .value[2].f32: maximum column width, in vp. \n + * .value[3].f32: lane spacing, in vp. \n \n + * + * @since 15 + */ + NODE_LIST_LANES = 1003011, + + /** + * @brief Sets the list snap alignment mode. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: alignment mode for the list snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}. + * The default value is ARKUI_SCROLL_SNAP_ALIGN_NONE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + *.value[0].i32: alignment mode for the list snap position. The parameter type is {@link ArkUI_ScrollSnapAlign}.\n + * + * @since 15 + */ + NODE_LIST_SCROLL_SNAP_ALIGN = 1003012, + + /** + * @brief Sets whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. The value 0 means not to maintain the visible content's + * position, and 1 means the opposite. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to maintain the visible content's position when data is inserted or deleted outside the + * display area of the List component. The value 0 means not to maintain the visible content's + * position, and 1 means the opposite. The default value is 0. \n + * + * @since 15 + */ + NODE_LIST_MAINTAIN_VISIBLE_CONTENT_POSITION = 1003013, + + /** + * @brief Sets whether the List component starts layout from the end. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether the List component starts layout from the end. The value 0 means layout + * starts from the top, and 1 means layout starts from the end. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether the List component starts layout from the end. The value 0 means layout + * starts from the top, and 1 means layout starts from the end. The default value is 0. \n + * + * @since 18 + */ + NODE_LIST_STACK_FROM_END = 1003014, + /** * @brief Defines whether to enable loop playback for the swiper. * This attribute can be set, reset, and obtained as required through APIs. @@ -4636,9 +5382,15 @@ typedef enum { * .value[0].i32: whether to enable automatic playback for child component switching. The value 1 * means to enable automatic playback, and 0 means the opposite. The default value is 0. \n * \n + * .value[1]?.i32: whether to stop automatic playback when the user touches the screen. The value 1 means + * to stop automatic playback, and 0 means the opposite. The default value is 1. This parameter is + * supported since API version 16. \n + * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: whether to enable automatic playback for child component switching. The value 1 means * to enable automatic playback, and 0 means the opposite. The default value is 0. \n + * .value[1].i32: whether to stop automatic playback when the user touches the screen. The value 1 means to + * stop automatic playback, and 0 means the opposite. This parameter is supported since API version 16. \n * */ NODE_SWIPER_AUTO_PLAY, @@ -4732,6 +5484,9 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: index value of the child component. \n + * .value[1]?.i32: animation mode, the parameter type is {@link ArkUI_SwiperAnimationMode}. \n + * The default value is ARKUI_SWIPER_NO_ANIMATION. This parameter is valid only for the current call. \n + * This parameter is supported since API version 15. \n * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: index value of the child component. \n @@ -4740,16 +5495,22 @@ typedef enum { NODE_SWIPER_INDEX, /** - * @brief Defines the number of elements to display per page. - * This attribute can be set, reset, and obtained as required through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: index value of the child component. \n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: index value of the child component. \n - * - */ + * @brief Defines the number of elements to display per page. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: number of elements to display per page. \n + * .value[1]?.i32: whether to turn pages by group. The value 0 means to turn pages by child element, + * and 1 means to turn pages by group. This parameter is supported since API version 16. \n + * .string?: this parameter can only be set to 'auto'. When 'auto' is set, the value[] parameters are ignored. + * This parameter is supported since API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of elements to display per page. \n + * .value[1].i32: whether to turn pages by group. This parameter is supported since API version 16. \n + * .string: 'auto' or empty string. + * + */ NODE_SWIPER_DISPLAY_COUNT, /** @@ -4768,20 +5529,24 @@ typedef enum { NODE_SWIPER_DISABLE_SWIPE, /** - * @brief Defines whether to show the arrow when the mouse pointer hovers over the navigation point indicator. - * This attribute can be set, reset, and obtained as required through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: whether to show the arrow when the mouse pointer hovers over the navigation point indicator. - * The parameter type is {@link ArkUI_SwiperArrow}.\n - * The default value is ARKUI_SWIPER_ARROW_HIDE. \n - * \n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: whether to show the arrow when the mouse pointer hovers over the navigation point indicator. - * The parameter type is {@link ArkUI_SwiperArrow}.\n - * The default value is ARKUI_SWIPER_ARROW_HIDE. \n - * - */ + * @brief Defines whether to show the arrow when the mouse pointer hovers over the navigation point indicator. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to show the arrow when the mouse pointer hovers over the navigation point indicator. + * The parameter type is {@link ArkUI_SwiperArrow}.\n + * The default value is ARKUI_SWIPER_ARROW_HIDE. \n + * .?object: arrow style. The parameter type is {@link ArkUI_SwiperArrowStyle}. \n + * This parameter is supported since API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to show the arrow when the mouse pointer hovers over the navigation point indicator. + * The parameter type is {@link ArkUI_SwiperArrow}.\n + * The default value is ARKUI_SWIPER_ARROW_HIDE. \n + * .object: arrow style. The parameter type is {@link ArkUI_SwiperArrowStyle}. \n + * This parameter is supported since API version 16. \n + * + */ NODE_SWIPER_SHOW_DISPLAY_ARROW, /** @@ -4814,6 +5579,14 @@ typedef enum { * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: number of cached items in the swiper adapter. \n + * .value[1]?.i32: whether the cached items will be displayed. \n + * The value 0 indicates that cached items will not be displayed, \n + * and 1 indicates that cached nodes will be displayed. The default value is 0. \n + * This parameter is supported from API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of cached items in the swiper adapter. \n + * .value[1].i32: whether the cached items will be displayed. This parameter is supported from API version 16. \n */ NODE_SWIPER_CACHED_COUNT, @@ -4848,18 +5621,26 @@ typedef enum { NODE_SWIPER_NEXT_MARGIN, /** - * @brief Defines the navigation indicator type of the swiper. - * The attribute can be set, reset, and obtained as required through APIs. - * - * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n - * .object: The parameter type is {@link ArkUI_SwiperIndicator}.\n - * Format of the return value {@link ArkUI_AttributeItem}:\n - * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n - * .object: The parameter type is {@link ArkUI_SwiperIndicator}.\n - * - */ + * @brief Defines the navigation indicator type of the swiper. + * The attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n + * .object: The parameter type is {@link ArkUI_SwiperIndicator} when the indicator type \n + * is ARKUI_SWIPER_INDICATOR_TYPE_DOT. The parameter type is {@link ArkUI_SwiperDigitIndicator} + * when the indicator type is ARKUI_SWIPER_INDICATOR_TYPE_DIGIT. \n + * {@link ArkUI_SwiperDigitIndicator} is supported since API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: navigation indicator type, the parameter type is {@link ArkUI_SwiperIndicatorType}.\n + * .object: The parameter type is {@link ArkUI_SwiperIndicator} when the indicator type \n + * is ARKUI_SWIPER_INDICATOR_TYPE_DOT. The parameter type is {@link ArkUI_SwiperDigitIndicator} + * when the indicator type is ARKUI_SWIPER_INDICATOR_TYPE_DIGIT. \n + * {@link ArkUI_SwiperDigitIndicator} is supported since API version 16. \n + * + */ NODE_SWIPER_INDICATOR, + /** * @brief Set the nested scrolling mode for the Swiper component and parent component. * @@ -4895,6 +5676,36 @@ typedef enum { */ NODE_SWIPER_INDICATOR_INTERACTIVE, + /** + * @brief Sets the page flipping mode using the mouse wheel. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: page flipping mode using the mouse wheel. The parameter type is {@link ArkUI_PageFlipMode}. \n + * \n + * Format of the return value {@link ArkUI_PageFlipMode}:\n + * .value[0].i32: page flipping mode using the mouse wheel. \n + * + * @since 15 + */ + NODE_SWIPER_PAGE_FLIP_MODE, + + /** + * @brief Defines the minimum main axis size of child element for swiper to works out the display count. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: minimum main axis size of the child element, Unit: vp. \n + * .value[1]?.i32: whether to turn pages by group. The value 0 means to turn pages by child element, + * and 1 means to turn pages by group. The default value is 0. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum main axis size of the child element, Unit: vp. \n + * .value[1].i32: whether to turn pages by group. \n + * + * @since 18 + */ + NODE_SWIPER_AUTO_FILL, + /** * @brief: Set the delineation component of the ListItem, supporting property settings, property resets, and * property acquisition interfaces. @@ -4962,6 +5773,20 @@ typedef enum { */ NODE_LIST_ITEM_GROUP_CHILDREN_MAIN_SIZE = 1005003, + /** + * @brief Defines the list item group adapter. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object: {@link ArkUI_NodeAdapter} object as the adapter. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object: {@link ArkUI_NodeAdapter} object. \n + * + * @since 15 + */ + NODE_LIST_ITEM_GROUP_NODE_ADAPTER = 1005004, + /** * @brief Defines the horizontal alignment mode of child components in the column. * This attribute can be set, reset, and obtained as required through APIs. @@ -5212,7 +6037,14 @@ typedef enum { * This attribute can be set, reset, and obtained as required through APIs. * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n - * .value[0].i32: number of cached items in the water flowadapter. \n + * value[0].i32:number of cached items in the water flow adapter. \n + * .value[1]?.i32:whether to the cached items will be displayed, 0: not displayed, 1: displayed, default value: 0. + * This parameter is supported since API version 16. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: number of cached items in the water flow adapter. \n + * .value[1].i32: whether to the cached items will be displayed, 0: not displayed, 1: displayed, default value: 0. + * This parameter is supported since API version 16. \n */ NODE_WATER_FLOW_CACHED_COUNT, @@ -5260,6 +6092,19 @@ typedef enum { */ NODE_WATER_FLOW_ITEM_CONSTRAINT_SIZE, + /** + * @brief Defines the layout mode of the component. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: waterflow layout mode. The parameter type is {@Link ArkUI_WaterFlowLayoutMode}. + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: waterflow layout mode. The parameter type is {@Link ArkUI_WaterFlowLayoutMode}. + * @since 18 + */ + NODE_WATER_FLOW_LAYOUT_MODE, + /** * @brief Set the auxiliary line in the RelativeContaine container, supporting property setting, * property reset and property acquisition interfaces. @@ -5364,6 +6209,57 @@ typedef enum { * .value[0].i32: number of cached items in the grid adapter. \n */ NODE_GRID_CACHED_COUNT, + + /** + * @brief Defines the column width of the text picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: percentage of total width. The default value is that all colulmns are equal width.\n + * .value[1]?.f32: percentage of total width. The default value is that all colulmns are equal width.\n + * .value[2]?.f32: percentage of total width. The default value is that all colulmns are equal width.\n + * ...\n + * .value[n]?.f32: percentage of total width. The default value is that all colulmns are equal width.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].f32: percentage of total width.\n + * value[1].f32: percentage of total width.\n + * value[2].f32: percentage of total width.\n + * ...\n + * value[n].f32: percentage of total width.\n + * + * @since 18 + */ + NODE_TEXT_PICKER_COLUMN_WIDTHS = 15009, + /** + * @brief Defines the disabled date range of the calendar picker. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .string: A string of dates. The `1st start date`,`1st end date`,`2nd start date`,`2nd end date`, + * ...,`nth start date`,`nth end date` of the disabled date range.\n + * Example: 1910-01-01,1910-12-31,2020-01-01,2020-12-31\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .string: A string of dates.\n + * + * @since 18 + */ + NODE_CALENDAR_PICKER_DISABLED_DATE_RANGE = 16006, + + /** + * @brief Defines whether the calendar picker marks today. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * value[0].i32: whether the calendar picker marks today. The default value is false.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * value[0].i32: whether the calendar picker marks today.\n + * + * @since 18 + */ + NODE_CALENDAR_PICKER_MARK_TODAY = 16007, } ArkUI_NodeAttributeType; #define MAX_COMPONENT_EVENT_ARG_NUM 12 @@ -5387,6 +6283,20 @@ typedef struct { const char* pStr; } ArkUI_StringAsyncEvent; +/** + * @brief Defines a hybrid data structure for component events. + * + * @since 15 + */ +typedef struct { + /** String data */ + const char* pStr; + /** Extended string data */ + const char* pExtendStr; + /** Numeric data */ + int32_t number; +} ArkUI_TextChangeEvent; + /** * @brief Enumerates the event types supported by the NativeNode component. * @@ -5632,6 +6542,114 @@ typedef enum { * {@link ArkUI_NodeEvent} object. \n */ NODE_ON_DRAG_END = 20, + /** + * @brief Defines the event triggered when a key event occurs. + * + * The callback can be triggered during interactions with a focused window using an external keyboard or other input + * device. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * + * @since 14 + */ + NODE_ON_KEY_EVENT = 21, + /** + * @brief Defines the event triggered before the input method responds to the key action. + * + * If the return value of this callback is true, it is considered that the key event has been consumed, and + * subsequent event callbacks (keyboardShortcut, input method events, onKeyEvent) will be intercepted + * and no longer triggered. + * The callback can be triggered during interactions with a focused window using an external keyboard or other input + * device. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * + * @since 14 + */ + NODE_ON_KEY_PRE_IME = 22, + /** + * @brief Defines the event triggered when the bound component receives a focus axis event after gaining focus. + * + * The event callback is triggered by interactions with a joystick and a focused component. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_UIInputEvent}. \n + * + * @since 15 + */ + NODE_ON_FOCUS_AXIS = 23, + + /** + * @brief Dispatch key event on the component node. + * + * When the component node receives a key event, this callback will be triggered instead of dispatching event to its + * children. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * + * @since 15 + */ + NODE_DISPATCH_KEY_EVENT = 24, + + /** + * @brief Defines the event triggered when the bound component receives an axis event. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_UIInputEvent}. \n + * + * @since 18 + */ + NODE_ON_AXIS = 25, + + /** + * @brief Defines the event triggered when the bound component is clicked. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_UIInputEvent}. \n + * + * @since 18 + */ + NODE_ON_CLICK_EVENT = 26, + + /** + * @brief Defines the event triggered when the mouse pointer hovers over or moves away from a component. + * + * This event is triggered when the mouse pointer enters or leaves the component's bounding box. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_UIInputEvent}. \n + * + *@since 18 + */ + NODE_ON_HOVER_EVENT = 27, + + /** + * @brief Sets the callback for the NODE_EVENT_ON_VISIBLE_AREA_CHANGE event, which limits the callback interval. + * + * The callback is triggered when the ratio of the component's visible area to its total area is greater than or + * less than the threshold. Before registering the callback, you must configure the threshold and update interval + * using NODE_VISIBLE_AREA_APPROXIMATE_CHANGE_RATIO. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains two parameters:\n + * ArkUI_NodeComponentEvent.data[0].i32: how the ratio of the component's visible area to its total area + * changes compared to the previous one. The value 1 indicates an increase, and 0 indicates + * a decrease. \n + * ArkUI_NodeComponentEvent.data[1].f32: ratio of the component's visible area to its total area + * when this callback is invoked. \n + * + * @since 18 + */ + NODE_VISIBLE_AREA_APPROXIMATE_CHANGE_EVENT = 28, + + /** + * @brief Defines the hover event. + * + * The event is triggered when the pointer is hovered by a pen device. + * within the component. \n + * When the event callback occurs, the {@link ArkUI_NodeEvent} object can be obtained from the + * {@link ArkUI_UIInputEvent} object. \n + * @since 15 + */ + NODE_ON_HOVER_MOVE = 29, /** * @brief Triggers onDetectResultUpdate callback @@ -5874,6 +6892,20 @@ typedef enum { */ NODE_TEXT_INPUT_ON_DID_DELETE = 7012, + /** + * @brief Defines the event triggered when content (including preview text) changes in the TextInput + * component. + * + * When the event callback occurs, the union type {@link ArkUI_NodeEvent} is {@link ArkUI_TextChangeEvent}. \n + * {@link ArkUI_TextChangeEvent} contains the following parameters: \n + * ArkUI_TextChangeEvent.pStr: content in the TextInput component. + * ArkUI_TextChangeEvent.pExtendStr: content of the preview text in the TextInput component. + * ArkUI_TextChangeEvent.number: start position of the preview text in the TextInput component. + * + * @since 15 + */ + NODE_TEXT_INPUT_ON_CHANGE_WITH_PREVIEW_TEXT = 7013, + /** * @brief Defines the event triggered when the input in the text box changes. * @@ -6026,6 +7058,20 @@ typedef enum { */ NODE_TEXT_AREA_ON_DID_DELETE = 8011, + /** + * @brief Defines the event triggered when content (including preview text) changes in the TextArea + * component. + * + * When the event callback occurs, the union type {@link ArkUI_NodeEvent} is {@link ArkUI_TextChangeEvent}. \n + * {@link ArkUI_TextChangeEvent} contains the following parameters: \n + * ArkUI_TextChangeEvent.pStr: content in the TextArea component. + * ArkUI_TextChangeEvent.pExtendStr: content of the preview text in the TextArea component. + * ArkUI_TextChangeEvent.number: start position of the preview text in the TextArea component. + * + * @since 15 + */ + NODE_TEXT_AREA_ON_CHANGE_WITH_PREVIEW_TEXT = 8012, + /** * @brief Defines the event triggered when the selected status of the ARKUI_NODE_CHECKBOX component changes. * @@ -6071,6 +7117,19 @@ typedef enum { */ NODE_TEXT_PICKER_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT_PICKER, + /** + * @brief Defines the event triggered when an item is selected and scrolling has stopped in the + * ARKUI_NODE_TEXT_PICKER component. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0...11].i32: value of the selected item. \n + * + * @since 14 + */ + NODE_TEXT_PICKER_EVENT_ON_SCROLL_STOP = 15001, + /** * @brief Defines the event triggered when a date is selected in the NODE_CALENDAR_PICKER. * @@ -6147,7 +7206,24 @@ typedef enum { * */ NODE_IMAGE_ANIMATOR_EVENT_ON_FINISH = 19004, - + + /** + * @brief Defines the callback triggered when the selected status of the ARKUI_NODE_CHECKBOX_GROOUP + * or checkbox changes. + * + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_StringAsyncEvent}. \n + * ArkUI_StringAsyncEvent.pStr + * Name: The names of the selected checkboxes; + * Status: + * 0: All checkboxes are selected. + * 1: Some checkboxes are selected. + * 2: No checkboxes are selected. \n + * + * @since 15 + */ + NODE_CHECKBOX_GROUP_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX_GROUP, + /** * @brief Defines the event triggered when the index of the currently displayed element of this * ARKUI_NODE_SWIPER instance changes. @@ -6226,6 +7302,56 @@ typedef enum { */ NODE_SWIPER_EVENT_ON_CONTENT_DID_SCROLL, + /** + * @brief Defines the event triggered when the selected index of the ARKUI_NODE_SWIPER changed. + * + * This event is triggered under the following scenarios: \n + * 1. When the page switching animation starts after the user lifts their finger after swiping and the swipe meets + * the threshold for page turning. \n + * 2. When the page is changed programmatically using either NODE_SWIPER_INDEX or + * NODE_SWIPER_SWIPE_TO_INDEX. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0].i32: index of the currently selected element. \n + * + * @since 18 + */ + NODE_SWIPER_EVENT_ON_SELECTED = 1001005, + + /** + * @brief Defines the event triggered when the selected index of the ARKUI_NODE_SWIPER changed. + * + * This event is triggered under the following scenarios: \n + * 1. When the page switching animation starts after the user lifts their finger after swiping and the swipe meets + * the threshold for page turning. \n + * 2. When the page is changed programmatically using either NODE_SWIPER_INDEX or + * NODE_SWIPER_SWIPE_TO_INDEX. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains one parameter:\n + * ArkUI_NodeComponentEvent.data[0].i32: the index of the element becomes unselected. \n + * + * @since 18 + */ + NODE_SWIPER_EVENT_ON_UNSELECTED = 1001006, + + /** + * @brief Defines the event triggered when content in the swiper component will scroll. + * Instructions: Before page scrolling, the ContentWillScrollCallback callback is invoked. \n \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains three parameters:\n + * ArkUI_NodeComponentEvent.data[0].i32: the index value of the current child page. \n + * ArkUI_NodeComponentEvent.data[1].i32: the index value of the child page that will display. \n + * ArkUI_NodeComponentEvent.data[2].f32: the sliding offset of each frame. + * Positive numbers indicating slide backward(e.g. from index=1 to index=0), negative numbers indicating + * slide forward(e.g. from index=0 to index=1). \n + * + * @since 15 + */ + NODE_SWIPER_EVENT_ON_CONTENT_WILL_SCROLL = 1001007, + /** * @brief Defines the event triggered when the ARKUI_NODE_SCROLL component scrolls. * @@ -6414,6 +7540,34 @@ typedef enum { */ NODE_LIST_ON_DID_SCROLL, + /** + * @brief Defines the event triggered when the currently displayed content of the ARKUI_NODE_LIST changes. + * + * Notes for triggering the event:\n + * This event is triggered once when the list is initialized and when the index of the first child component or the + * next child component in the list display area changes. + * During index calculation, the list item, header of the list item group, and footer of the list item group each + * are counted as a child component. \n + * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is + * {@link ArkUI_NodeComponentEvent}. \n + * {@link ArkUI_NodeComponentEvent} contains three parameters: \n + * ArkUI_NodeComponentEvent.data[0].i32: index of the first child component in the list display area. \n + * ArkUI_NodeComponentEvent.data[1].i32: area in the list item group where the list display area starts. + * The type is {@link ArkUI_ListItemGroupArea}. \n + * ArkUI_NodeComponentEvent.data[2].i32: index of the list item at the start of the list display area + * in the list item group. + * If the start of the list display area is not on a list item, the value is -1. \n + * ArkUI_NodeComponentEvent.data[3].i32: index of the last child component in the list display area. \n + * ArkUI_NodeComponentEvent.data[4].i32: area in the list item group where the list display area ends. + * The type is {@link ArkUI_ListItemGroupArea}. \n + * ArkUI_NodeComponentEvent.data[5].i32: index of the list item at the end of the list display area in the + * list item group. + * If the end of the list display area is not on a list item, the value is -1. \n + * + * @since 15 + */ + NODE_LIST_ON_SCROLL_VISIBLE_CONTENT_CHANGE, + /** * @brief Defines the event triggered when the refresh state of the ARKUI_NODE_REFRESH object changes. * @@ -6559,6 +7713,15 @@ ArkUI_NodeComponentEvent* OH_ArkUI_NodeEvent_GetNodeComponentEvent(ArkUI_NodeEve */ ArkUI_StringAsyncEvent* OH_ArkUI_NodeEvent_GetStringAsyncEvent(ArkUI_NodeEvent* event); +/** + * @brief Obtains the ArkUI_TextChangeEvent data from a component event. + * + * @param event Pointer to a component event. It cannot be null. + * @return Returns the pointer to the ArkUI_TextChangeEvent object. + * @since 15 + */ +ArkUI_TextChangeEvent* OH_ArkUI_NodeEvent_GetTextChangeEvent(ArkUI_NodeEvent* event); + /** * @brief Obtains the custom data in a component event. * @@ -7502,6 +8665,21 @@ typedef enum { NODE_CONTENT_EVENT_ON_DETACH_FROM_WINDOW = 1, } ArkUI_NodeContentEventType; +/** + * @brief Enumerates the inspector error codes. + * @since 15 + */ +typedef enum { + /** + * @error Success. + */ + ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL = 0, + /** + * @error Invalid parameter. + */ + ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER = -1, +} ArkUI_InspectorErrorCode; + /** * @brief Defines the general structure of a node content event. * @since 12 @@ -7681,23 +8859,138 @@ int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInWindow(ArkUI_NodeHandle nod int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen(ArkUI_NodeHandle node, ArkUI_IntOffset* translateOffset); /** - * @brief Add the custom property of the component. + * @brief Add the custom property of the component. This interface only works on the main thread. * * @param node ArkUI_NodeHandle pointer. - * @param key The key of the custom property. - * @param key The value of the custom property. - * @since 14 + * @param name The name of the custom property. Passing null pointers is not allowed. + * @param value The value of the custom property. Passing null pointers is not allowed. + * @since 13 */ -void OH_ArkUI_NodeUtils_AddCustomProperty(ArkUI_NodeHandle node, const char* key, const char* value); +void OH_ArkUI_NodeUtils_AddCustomProperty(ArkUI_NodeHandle node, const char* name, const char* value); /** * @brief Remove the custom property of the component. * * @param node ArkUI_NodeHandle pointer. - * @param key The key of the custom property. + * @param name The name of the custom property. + * @since 13 + */ +void OH_ArkUI_NodeUtils_RemoveCustomProperty(ArkUI_NodeHandle node, const char* name); + +/** + * @brief Get the value of the custom property of the component. + * + * @param node ArkUI-NodeHandle pointer. + * @param name The name of the custom attribute. + * @param handle The structure of the custom attribute corresponding to the key parameter name obtained. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 14 + */ +int32_t OH_ArkUI_NodeUtils_GetCustomProperty(ArkUI_NodeHandle node, const char* name, ArkUI_CustomProperty** handle); + +/** + * @brief Get the parent node to obtain the component nodes created by ArkTs. + * + * @param node Target node object. + * @return Return the pointer of the component. + * @since 14 + */ +ArkUI_NodeHandle OH_ArkUI_NodeUtils_GetParentInPageTree(ArkUI_NodeHandle node); + +/** + * @brief Retrieve all active child nodes of a node. Span will not be counted in the children. + * + * @param head Pass in the node that needs to be obtained. + * @param handle The structure corresponding to the sub node information of the head node. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 14 + */ +int32_t OH_ArkUI_NodeUtils_GetActiveChildrenInfo(ArkUI_NodeHandle head, ArkUI_ActiveChildrenInfo** handle); + +/** + * @brief Retrieve the root node of the current page. + * + * @param node Target node object. + * @return Return the pointer of the component. + * @since 14 + */ +ArkUI_NodeHandle OH_ArkUI_NodeUtils_GetCurrentPageRootNode(ArkUI_NodeHandle node); + +/** + * @brief Retrieve whether the component is labeled by C-API. + * + * @param node Target node object. + * @return Return whether the node is a Tag created by C-API, + * true represents created by C-API, false represents not created by C-API. + * @since 14 + */ +bool OH_ArkUI_NodeUtils_IsCreatedByNDK(ArkUI_NodeHandle node); + +/** + * @brief Get the type of node. + * + * @param node Target node object. + * @return Return the type of the node. + * For specific open types, refer to {@link ArkUI_NodeType}. For unopened nodes, return -1. * @since 14 */ -void OH_ArkUI_NodeUtils_RemoveCustomProperty(ArkUI_NodeHandle node, const char* key); +int32_t OH_ArkUI_NodeUtils_GetNodeType(ArkUI_NodeHandle node); + +/** + * @brief Get info of the window to which the node belongs. + * + * @param node Target node object. + * @param info Window info. Use {@link OH_ArkUI_HostWindowInfo_Destroy} to release memory. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * {@link ARKUI_ERROR_CODE_NODE_NOT_ON_MAIN_TREE} The node is not mounted. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetWindowInfo(ArkUI_NodeHandle node, ArkUI_HostWindowInfo** info); + +/** + * @brief Obtains the index of the current FrameNode's first child node which is on the tree. + * + * @param node Indicates the target node. + * @param index The index of the subnode. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetFirstChildIndexWithoutExpand(ArkUI_NodeHandle node, uint32_t* index); + +/** + * @brief Obtains the index of the current FrameNode's last child node which is on the tree. + * + * @param node Indicates the target node. + * @param index the index of the subnode. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetLastChildIndexWithoutExpand(ArkUI_NodeHandle node, uint32_t* index); + +/** + * @brief Obtains a subnode by position with the expand mode. + * + * @param node Indicates the target node. + * @param position Indicates the position of the subnode. + * @param subnode The pointer to the subnode. + * @param expandMode Indicates the expand mode. {@link ArkUI_ExpandMode}. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetChildWithExpandMode(ArkUI_NodeHandle node, int32_t position, + ArkUI_NodeHandle* subnode, uint32_t expandMode); /** * @brief Collapse the ListItem in its expanded state. @@ -7789,9 +9082,141 @@ float OH_ArkUI_SystemFontStyleEvent_GetFontSizeScale(const ArkUI_SystemFontStyle */ float OH_ArkUI_SystemFontStyleEvent_GetFontWeightScale(const ArkUI_SystemFontStyleEvent* event); +/** + * @brief Get the node handle by id. + * + * @param id The id of the target node handle. + * @param node The handle of target node handle. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetAttachedNodeHandleById(const char* id, ArkUI_NodeHandle* node); + +/** + * @brief Move the node handle to target parent node as child. + * + * @param node The node handle of the node to move. + * @param target_parent The node handle of target parent. + * @param index Indicates the index which the node is moved to. If the value is a nagative number of invalid, the + * node is moved to the end of the target parent node. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * @since 18 + */ +int32_t OH_ArkUI_NodeUtils_MoveTo(ArkUI_NodeHandle node, ArkUI_NodeHandle target_parent, int32_t index); + +/** + * @brief Set the cross-language option of the target node handle. + * + * @param node The target node handle. + * @param option The cross-language option {@link ArkUI_CrossLanguageOption}. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_SetCrossLanguageOption(ArkUI_NodeHandle node, ArkUI_CrossLanguageOption* option); + +/** + * @brief Get the cross-language option of the target node handle. + * + * @param node The target node handle. + * @param option The cross-language option {@link ArkUI_CrossLanguageOption}. + * @return Error code. + * {@link ARKUI_ERROR_CODE_NO_ERROR} success. + * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetCrossLanguageOption(ArkUI_NodeHandle node, ArkUI_CrossLanguageOption* option); + +/** + * @brief Registers a callback for node when layout is completed. + * + * @param node Indicates the target node. + * @param userData Indicates the custom data used in onLayoutCompleted callback function. + * @param onLayoutCompleted Indicates the function when layout completed is callback. + * @return error code + {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 15 + */ +int32_t OH_ArkUI_RegisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node, + void* userData, void (*onLayoutCompleted)(void* userData)); + + +/** + * @brief Registers a callback for node when draw is completed. + * + * @param node Indicates the target node. + * @param userData Indicates the custom data used in onDrawCompleted callback function. + * @param onDrawCompleted Indicates the function when draw completed is callback. + * @return error code + {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 15 + */ +int32_t OH_ArkUI_RegisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node, + void* userData, void (*onDrawCompleted)(void* userData)); + +/** + * @brief Unregisters the layout completed callback for node. + * + * @param node Indicates the target node. + * @return error code + {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 15 + */ +int32_t OH_ArkUI_UnregisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node); + +/** + * @brief Unregisters the draw completed callback for node. + * + * @param node Indicates the target node. + * @return error code + {@link ARKUI_INSPECTOR_NATIVE_RESULT_SUCCESSFUL} if the operation is successful. + * {@link ARKUI_INSPECTOR_NATIVE_RESULT_BAD_PARAMETER} if a parameter is incorrect. + * @since 15 + */ +int32_t OH_ArkUI_UnregisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node); + +/** + * @brief Get the snapshot pixelmap for the given node synchronously, will get error if the node is not on the + * tree or is not rendered yet. + * Note: the pixelmap should be released through OH_PixelmapNative_Release when it's not used any more. + * + * @param node Indicates the target node. + * @param snapshotOptions the given configuration for taking snapshot, can be null for using default. + * @param pixelmap Pixelmap pointer created by system, it's the out result. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_INTERNAL_ERROR} if the snapshot taking failed will null pixelmap returned. + * Returns {@link ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT} if the snapshot taking is timeout. + * @since 15 + */ +int32_t OH_ArkUI_GetNodeSnapshot(ArkUI_NodeHandle node, ArkUI_SnapshotOptions* snapshotOptions, + OH_PixelmapNative** pixelmap); + +/** + * @brief Obtains the offset of a specific node relative to its parent node. + * + * @param node Target node. + * @param globalOffset Offset of the target node relative to its parent node, in px. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_NodeUtils_GetPositionToParent(ArkUI_NodeHandle node, ArkUI_IntOffset* globalOffset); + #ifdef __cplusplus }; #endif #endif // ARKUI_NATIVE_NODE_H -/** @}*/ +/** @} */ diff --git a/arkui/ace_engine/native/native_node_napi.h b/arkui/ace_engine/native/native_node_napi.h index ade5e7edfd6b24e76146c22ff8578da81c829347..8070149fa3245b42b6568ca73fe1194cfa10a075 100644 --- a/arkui/ace_engine/native/native_node_napi.h +++ b/arkui/ace_engine/native/native_node_napi.h @@ -355,6 +355,25 @@ ArkUI_ErrorCode OH_ArkUI_GetRouterPageState(ArkUI_NodeHandle node, ArkUI_RouterP ArkUI_ErrorCode OH_ArkUI_GetRouterPageId( ArkUI_NodeHandle node, char* buffer, int32_t bufferSize, int32_t* writeLength); +/** + * @brief Register a callback to be executed when rendering in the next frame. Cannot be called on + * the non-UI thread. Checking for non-UI thread calls will abort. + * + * @param uiContext ArkUI_ContextHandle. + * @param userData Indicates the custom data to be saved. + * @param callback Custom callback function. + * @param nanoTimestamp Timestamp of frame signal. + * @param frameCount Frame count. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_CAPI_INIT_ERROR} if the CAPI init error. + * Returns {@link ARKUI_ERROR_CODE_UI_CONTEXT_INVALID} if the uiContext is invalid. + * Returns {@link ARKUI_ERROR_CODE_CALLBACK_INVALID} if the callback function is invalid. + * @since 18 + */ +int32_t OH_ArkUI_PostFrameCallback(ArkUI_ContextHandle uiContext, void* userData, + void (*callback)(uint64_t nanoTimestamp, uint32_t frameCount, void* userData)); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 18f2e18b68046508b23687393c418dbf30a5d2bb..64676cb956567bca6b4a76e163dd7889c41599f8 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -136,6 +136,27 @@ typedef struct ArkUI_Context* ArkUI_ContextHandle; */ typedef struct ArkUI_SwiperIndicator ArkUI_SwiperIndicator; +/** + * @brief Defines the digital indicator style for the swiper. + * + * @since 18 + */ +typedef struct ArkUI_SwiperDigitIndicator ArkUI_SwiperDigitIndicator; + +/** + * @brief Defines the arrow style for the swiper. + * + * @since 18 + */ +typedef struct ArkUI_SwiperArrowStyle ArkUI_SwiperArrowStyle; + +/** +* @brief Define the data objects of styled string supported by text components. +* +* @since 14 +*/ +typedef struct ArkUI_StyledString_Descriptor ArkUI_StyledString_Descriptor; + /** * @brief specifies the alignment rules for subcomponents set in relative containers. * @@ -186,6 +207,41 @@ typedef struct ArkUI_AccessibilityState ArkUI_AccessibilityState; */ typedef struct ArkUI_AccessibilityValue ArkUI_AccessibilityValue; +/** + * @brief Define the information of the Custom Property class for custom properties. + * + * @since 14 + */ +typedef struct ArkUI_CustomProperty ArkUI_CustomProperty; + +/** + * @brief Define the information of the HostWindowInfo class for window properties. + * + * @since 15 + */ +typedef struct ArkUI_HostWindowInfo ArkUI_HostWindowInfo; + +/** + * @brief Define ActiveChildenInfo class information. + * + * @since 14 + */ +typedef struct ArkUI_ActiveChildrenInfo ArkUI_ActiveChildrenInfo; + +/** + * @brief Set the linear progress indicator style. + * + * @since 15 + */ +typedef struct ArkUI_ProgressLinearStyleOption ArkUI_ProgressLinearStyleOption; + +/** + * @brief The cross-language option. + * + * @since 15 + */ +typedef struct ArkUI_CrossLanguageOption ArkUI_CrossLanguageOption; + /** * @brief Defines the event callback type. * @@ -507,6 +563,20 @@ typedef enum { ARKUI_SHADOW_TYPE_BLUR } ArkUI_ShadowType; +/** + * @brief Enumerates the modes of the date picker. + * + * @since 18 + */ +typedef enum { + /** A mode that displays the date in months, days of month, and years. */ + ARKUI_DATEPICKER_MODE_DATE = 0, + /** A mode that displays the date in months and years. */ + ARKUI_DATEPICKER_YEAR_AND_MONTH = 1, + /** A mode that displays the date in months and days of the month. */ + ARKUI_DATEPICKER_MONTH_AND_DAY = 2, +} ArkUI_DatePickerMode; + /** * @brief Enumerates the types of the text picker. * @@ -565,6 +635,18 @@ typedef enum { ARKUI_EDGE_EFFECT_NONE, } ArkUI_EdgeEffect; +/** + * @brief Enumerates the edges for which the effect takes effect when the boundary of the scrollable content is reached. + * + * @since 18 + */ +typedef enum { + /** Start edge. */ + ARKUI_EFFECT_EDGE_START = 1, + /** End edge. */ + ARKUI_EFFECT_EDGE_END = 2, +} ArkUI_EffectEdge; + /** * @brief Enumerates the scroll directions for the component. * @@ -637,6 +719,32 @@ typedef enum { ARKUI_STICKY_STYLE_BOTH = 3, } ArkUI_StickyStyle; +/** + * @brief Enumerates the content clipping modes of scrollable components. + * + * @since 18 + */ +typedef enum { + /** clip by content */ + ARKUI_CONTENT_CLIP_MODE_CONTENT_ONLY = 0, + /** clip by boundary */ + ARKUI_CONTENT_CLIP_MODE_BOUNDARY, + /** clip by safe area padding */ + ARKUI_CONTENT_CLIP_MODE_SAFE_AREA, +} ArkUI_ContentClipMode; + +/** + * @brief Enumerates the layout modes of the WaterFlow component. + * + * @since 18 + */ +typedef enum { + /** Layout items from top to viewport. */ + ARKUI_WATER_FLOW_LAYOUT_MODE_ALWAYS_TOP_DOWN = 0, + /** Layout items in viewport. */ + ARKUI_WATER_FLOW_LAYOUT_MODE_SLIDING_WINDOW, +} ArkUI_WaterFlowLayoutMode; + /** * @brief Enumerates the border styles. * @@ -752,6 +860,33 @@ typedef enum { ARKUI_SWIPER_NESTED_SRCOLL_SELF_FIRST, } ArkUI_SwiperNestedScrollMode; +/** + * @brief Enumerates the page flipping modes using the mouse wheel for the Swiper component. + * + * @since 15 + */ +typedef enum { + /** When the mouse wheel is scrolled continuously, multiple pages are flipped, which is determined by the number of + * times that mouse events are reported. */ + ARKUI_PAGE_FLIP_MODE_CONTINUOUS = 0, + /** The system does not respond to other mouse wheel events until the page flipping animation ends. */ + ARKUI_PAGE_FLIP_MODE_SINGLE, +} ArkUI_PageFlipMode; + +/** + * @brief Enumerates the animation modes for {@link NODE_SWIPER_INDEX}. + * + * @since 15 + */ +typedef enum { + /** Jump to target index without animation. */ + ARKUI_SWIPER_NO_ANIMATION = 0, + /** Scroll to target index with animation. */ + ARKUI_SWIPER_DEFAULT_ANIMATION = 1, + /** Jump to some index near the target index without animation, then scroll to target index with animation. */ + ARKUI_SWIPER_FAST_ANIMATION = 2, +} ArkUI_SwiperAnimationMode; + /** * @brief Enumerates the accessibility modes. * @@ -1470,6 +1605,12 @@ typedef enum { * lines at appropriate characters (for example, spaces) whenever possible. CJK text behavior is the same as for NORMAL. */ ARKUI_WORD_BREAK_BREAK_WORD, + /** + * @brief Line breaks can occur between any two syllabic units for non-CJK text. + * CJK text behavior is the same as for NORMAL. + * @since 18 + */ + ARKUI_WORD_BREAK_HYPHENATION, } ArkUI_WordBreak; /** @@ -1742,6 +1883,11 @@ typedef enum { ARKUI_BUTTON_TYPE_CAPSULE, /** Circle button. */ ARKUI_BUTTON_TYPE_CIRCLE, + /** + * Rounded rectangle button. + * @since 18 + */ + ARKUI_BUTTON_ROUNDED_RECTANGLE = 8 } ArkUI_ButtonType; /** @@ -1804,6 +1950,77 @@ typedef enum { /** Standard address. The scenario-based autofill feature, when enabled, can automatically save and fill in standard * addresses. */ ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS, + /** + * Passport number. The scenario-based autofill feature, when enabled, can automatically save and fill in passport + * numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_PASSPORT_NUMBER, + /** + * Passport validity. The scenario-based autofill feature, when enabled, can automatically save and fill in + * passport validities. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_VALIDITY, + /** + * Place of issue. The scenario-based autofill feature, when enabled, can automatically save and fill in + * place of issues. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_ISSUE_AT, + /** + * Tax organization. The scenario-based autofill feature, when enabled, can automatically save and fill in tax + * organizations. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_ORGANIZATION, + /** + * Tax id. The scenario-based autofill feature, when enabled, can automatically save and fill in standard Tax ids. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_TAX_ID, + /** + * City name and state name or state code. The scenario-based autofill feature, when enabled, can automatically + * save and fill in city names and state names or state codes. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_ADDRESS_CITY_AND_STATE, + /** + * Flight number. The scenario-based autofill feature, when enabled, can automatically save and fill in flight + * numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_FLIGHT_NUMBER, + /** + * License number. The scenario-based autofill feature, when enabled, can automatically save and fill in license + * numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_LICENSE_NUMBER, + /** + * License file number. The scenario-based autofill feature, when enabled, can automatically save and fill in + * license file numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_LICENSE_FILE_NUMBER, + /** + * License plate number. The scenario-based autofill feature, when enabled, can automatically save and fill in + * license plate numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_LICENSE_PLATE, + /** + * Engine number. The scenario-based autofill feature, when enabled, can automatically save and fill in engine + * numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_ENGINE_NUMBER, + /** + * License chassis number. The scenario-based autofill feature, when enabled, can automatically save and fill in + * license chassis numbers. + * @since 18 + */ + ARKUI_TEXTINPUT_CONTENT_TYPE_LICENSE_CHASSIS_NUMBER, } ArkUI_TextInputContentType; /** @@ -1819,6 +2036,34 @@ typedef enum { ARKUI_TEXTINPUT_STYLE_INLINE } ArkUI_TextInputStyle; +/** + * @brief Defines the keyboard style of input box + * + * @since 15 + */ +typedef enum { + /** + * Default appearance mode, won't adopt immersive styles. + * @since 15 + */ + ARKUI_KEYBOARD_APPEARANCE_NONE_IMMERSIVE = 0, + /** + * Immersive mode. + * @since 15 + */ + ARKUI_KEYBOARD_APPEARANCE_IMMERSIVE = 1, + /** + * Light immersive style. + * @since 15 + */ + ARKUI_KEYBOARD_APPEARANCE_LIGHT_IMMERSIVE = 2, + /** + * Dark immersive style. + * @since 15 + */ + ARKUI_KEYBOARD_APPEARANCE_DARK_IMMERSIVE = 3, +} ArkUI_KeyboardAppearance; + /** * @brief Defines the entity type for text recognition. * @@ -1885,6 +2130,22 @@ typedef enum { ARKUI_ERROR_CODE_NO_ERROR = 0, /** @error Parameter error. */ ARKUI_ERROR_CODE_PARAM_INVALID = 401, + /** + * @error CAPI init error. + * @since 18 + */ + ARKUI_ERROR_CODE_CAPI_INIT_ERROR = 500, + /** + * @error Internal error occurs, such as failure occurs because of the internal environment error, + * or operation failed because of the internal execution failed. + * @since 15 + */ + ARKUI_ERROR_CODE_INTERNAL_ERROR = 100001, + /** + * @error The XComponent is in invalid state. + * @since 18 + */ + ARKUI_ERROR_CODE_XCOMPONENT_STATE_INVALID = 103501, /** @error The component does not support specific properties or events. */ ARKUI_ERROR_CODE_ATTRIBUTE_OR_EVENT_NOT_SUPPORTED = 106102, /** @error The corresponding operation does not support nodes created by ArkTS. */ @@ -1907,10 +2168,75 @@ typedef enum { ARKUI_ERROR_CODE_GET_INFO_FAILED = 106201, /** The buffer size is not large enough. */ ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR = 106202, + /** + * @error The node is not on main tree. + * @since 15 + */ + ARKUI_ERROR_CODE_NODE_NOT_ON_MAIN_TREE = 106203, + /** + * @error The node requesting focus is not focusable. + * @since 15 + */ + ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE = 150001, + /** + * @error The node requesting focus has unfocusable ancestor. + * @since 15 + */ + ARKUI_ERROR_CODE_FOCUS_NON_FOCUSABLE_ANCESTOR = 150002, + /** + * @error The node requesting focus does not exists. + * @since 15 + */ + ARKUI_ERROR_CODE_FOCUS_NON_EXISTENT = 150003, + /** + * @error The snapshot taking is timeout. + * @since 15 + */ + ARKUI_ERROR_CODE_COMPONENT_SNAPSHOT_TIMEOUT = 160002, /** The component is not a scroll container. */ ARKUI_ERROR_CODE_NON_SCROLLABLE_CONTAINER = 180001, /** The buffer is not large enough. */ ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH = 180002, + /** + * @error The event is not a clone event. + * @since 15 + */ + ARKUI_ERROR_CODE_NOT_CLONED_POINTER_EVENT = 180003, + /** + * @error The component status is abnormal. + * @since 15 + */ + ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL = 180004, + /** + * @error No component hit to respond to the event. + * @since 15 + */ + ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT = 180005, + /** + * @error invalid styled string. + * @since 14 + */ + ARKUI_ERROR_CODE_INVALID_STYLED_STRING = 180101, + /** + * @error The uiContext is invalid. + * @since 18 + */ + ARKUI_ERROR_CODE_UI_CONTEXT_INVALID = 190001, + /** + * @error The callback function is invalid. + * @since 18 + */ + ARKUI_ERROR_CODE_CALLBACK_INVALID = 190002, + /** + * @error The gesture recognizer type is not supported. + * @since 18 + */ + ARKUI_ERROR_CODE_RECOGNIZER_TYPE_NOT_SUPPORTED = 180102, + /** + * @error operation is not allowed for current drag drop pharse. + * @since 18 + */ + ARKUI_ERROR_CODE_DRAG_DROP_OPERATION_NOT_ALLOWED = 190004, } ArkUI_ErrorCode; /** @@ -2158,6 +2484,24 @@ typedef enum { ARKUI_SAFE_AREA_TYPE_KEYBOARD = 1 << 2, } ArkUI_SafeAreaType; +/** + * @brief Define an enum for the areas of the ListItemGroup component. + * + * @since 15 + */ +typedef enum { + /** Outside the area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_GROUP_AREA_OUTSIDE = 0, + /** Area when the ListItemGroup component does not have the header, footer, or list item. */ + ARKUI_LIST_ITEM_SWIPE_AREA_NONE, + /** List item area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_ITEM, + /** Header area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_HEADER, + /** Footer area of the ListItemGroup component. */ + ARKUI_LIST_ITEM_SWIPE_AREA_FOOTER, +} ArkUI_ListItemGroupArea; + /** * @brief defines the enumerated value of the direction of the extended security zone. * @@ -2174,6 +2518,64 @@ typedef enum { ARKUI_SAFE_AREA_EDGE_END = 1 << 3, } ArkUI_SafeAreaEdge; +/** + * @brief Define an enum for the focus movement directions. + * + * @since 18 +*/ +typedef enum { + /** Move focus forward. */ + ARKUI_FOCUS_MOVE_FORWARD = 0, + /** Move focus backward. */ + ARKUI_FOCUS_MOVE_BACKWARD, + /** Move focus up. */ + ARKUI_FOCUS_MOVE_UP, + /** Move focus down. */ + ARKUI_FOCUS_MOVE_DOWN, + /** Move focus left. */ + ARKUI_FOCUS_MOVE_LEFT, + /** Move focus right. */ + ARKUI_FOCUS_MOVE_RIGHT, +} ArkUI_FocusMove; + +/** + * @brief defines the enumerated value of the customDialog's keyboard avoid mode. + * + * @since 15 + */ +typedef enum { + /** Defines avoid keyboard when keyboard shows. */ + ARKUI_KEYBOARD_AVOID_MODE_DEFAULT = 0, + /** Defines not avoid keyboard when keyboard shows. */ + ARKUI_KEYBOARD_AVOID_MODE_NONE, +} ArkUI_KeyboardAvoidMode; + +/** + * @brief defines the enumerated value of area in hover mode. + * + * @since 15 + */ +typedef enum { + /** Layout top half screen when the phone in hover mode. */ + ARKUI_HOVER_MODE_AREA_TYPE_TOP = 0, + /** Layout bottom half screen when the phone in hover mode. */ + ARKUI_HOVER_MODE_AREA_TYPE_BOTTOM, +} ArkUI_HoverModeAreaType; + +/** + * @brief Enumerates the expand modes. + * + * @since 15 + */ +typedef enum { + /** Not expand. */ + ARKUI_NOT_EXPAND = 0, + /** Expand. */ + ARKUI_EXPAND = 1, + /** Lazy expand. Expand the children of node if needed. */ + ARKUI_LAZY_EXPAND = 2, +} ArkUI_ExpandMode; + /** * @brief Defines parameter used by the system font style callback event. * @@ -2181,6 +2583,27 @@ typedef enum { */ typedef struct ArkUI_SystemFontStyleEvent ArkUI_SystemFontStyleEvent; +/** + * @brief Defines the options for taking snapshot. + * + * @since 15 + */ +typedef struct ArkUI_SnapshotOptions ArkUI_SnapshotOptions; + +/** + * @brief TextPicker single column selector, supports mixing text and images. + * + * @since 18 + */ +typedef struct ArkUI_TextPickerRangeContentArray ArkUI_TextPickerRangeContentArray; + + /** + * @brief TextPicker multi column selector, supports mixing text and images. + * + * @since 18 + */ +typedef struct ArkUI_TextCascadePickerRangeContentArray ArkUI_TextCascadePickerRangeContentArray; + /** * @brief Creates a size constraint. * @@ -2502,16 +2925,6 @@ void OH_ArkUI_WaterFlowSectionOption_SetMargin(ArkUI_WaterFlowSectionOption* opt */ ArkUI_Margin OH_ArkUI_WaterFlowSectionOption_GetMargin(ArkUI_WaterFlowSectionOption* option, int32_t index); -/** -* @brief Obtains the number of items in the water flow section that matches the specified index. -* -* @param option Indicates the pointer to a water flow section configuration. -* @param index Indicates the index of the target water flow section. -* @return Returns the number of items in the water flow section. -* @since 12 -*/ -int32_t OH_ArkUI_WaterFlowSectionOption_GetItemCount(ArkUI_WaterFlowSectionOption* option, int32_t index); - /** * @brief Creates a navigation indicator. * @@ -2713,7 +3126,7 @@ uint32_t OH_ArkUI_SwiperIndicator_GetColor(ArkUI_SwiperIndicator* indicator); * @brief Sets the color of the selected dot for the navigation indicator. * * @param indicator Indicates the pointer to the indicator. - * @param color the color of the selected dot, in 0xARGB format. + * @param selectedColor the color of the selected dot, in 0xARGB format. * @since 12 */ void OH_ArkUI_SwiperIndicator_SetSelectedColor(ArkUI_SwiperIndicator* indicator, uint32_t selectedColor); @@ -2750,172 +3163,563 @@ int32_t OH_ArkUI_SwiperIndicator_SetMaxDisplayCount(ArkUI_SwiperIndicator* indic int32_t OH_ArkUI_SwiperIndicator_GetMaxDisplayCount(ArkUI_SwiperIndicator* indicator); /** - * @brief Create auxiliary line information in the RelativeContaine container. + * @brief Sets whether to ignore the size of the indicator for {@link OH_ArkUI_SwiperIndicator_SetBottomPosition}. * - * @param size The number of auxiliary lines. - * @return auxiliary line information. - * @since 12 - */ -ArkUI_GuidelineOption* OH_ArkUI_GuidelineOption_Create(int32_t size); + * @param indicator Indicates the pointer to the indicator. + * @param ignoreSize Whether to ignore the size of the indicator. The value 1 means to ignore, and 0 means the opposite. + * The default value is 0. + * @since 18 +*/ +void OH_ArkUI_SwiperIndicator_SetIgnoreSizeOfBottom(ArkUI_SwiperIndicator* indicator, int32_t ignoreSize); /** - * @brief Destroy auxiliary line information. + * @brief Obtains whether to ignore the size of the indicator for {@link OH_ArkUI_SwiperIndicator_SetBottomPosition}. * - * @param guideline auxiliary line information. - * @since 12 - */ -void OH_ArkUI_GuidelineOption_Dispose(ArkUI_GuidelineOption* guideline); + * @param indicator Indicates the pointer to the indicator. + * @return Returns whether to ignore the size of the indicator. + * @since 18 +*/ +int32_t OH_ArkUI_SwiperIndicator_GetIgnoreSizeOfBottom(ArkUI_SwiperIndicator* indicator); /** - * @brief Set the Id of the auxiliary line. + * @brief Sets the space between the dots of the navigation indicator. * - * @param guideline auxiliary line information. - * @param value id, must be unique and cannot have the same name as the component in the container. - * @param index auxiliary line index value. - * @since 12 - */ -void OH_ArkUI_GuidelineOption_SetId(ArkUI_GuidelineOption* guideline, const char* value, int32_t index); + * @param indicator Indicates the pointer to the indicator. + * @param space the space between the dots of the navigation indicator, the default value is 8vp. + * @since 18 +*/ +void OH_ArkUI_SwiperIndicator_SetSpace(ArkUI_SwiperIndicator* indicator, float space); /** - * @brief Set the direction of the auxiliary line. + * @brief Obtains the space between the dots of the navigation indicator. * - * @param guideline auxiliary line information. - * @param value direction. - * @param index auxiliary line index value. - * @since 12 - */ -void OH_ArkUI_GuidelineOption_SetDirection(ArkUI_GuidelineOption* guideline, ArkUI_Axis value, int32_t index); + * @param indicator Indicates the pointer to the indicator. + * @return the space between the dots of the navigation indicator + * @since 18 +*/ +float OH_ArkUI_SwiperIndicator_GetSpace(ArkUI_SwiperIndicator* indicator); /** - * @brief Set the distance from the left or top of the container. + * @brief Creates a digital indicator. * - * @param guideline auxiliary line information. - * @param value The distance from the left or top of the container. - * @param index auxiliary line index value. - * @since 12 + * @return Returns the pointer to the new indicator. + * @since 18 */ -void OH_ArkUI_GuidelineOption_SetPositionStart(ArkUI_GuidelineOption* guideline, float value, int32_t index); +ArkUI_SwiperDigitIndicator *OH_ArkUI_SwiperDigitIndicator_Create(); /** - * @brief Set the distance from the right or bottom of the container. + * @brief Sets the distance between the digital indicator and the start of the swiper. * - * @param guideline auxiliary line information. - * @param value The distance from the right side or bottom of the container. - * @param index auxiliary line index value. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param value Indicates the distance between the digital indicator and the start of the swiper. + * @since 18 */ -void OH_ArkUI_GuidelineOption_SetPositionEnd(ArkUI_GuidelineOption* guideline, float value, int32_t index); +void OH_ArkUI_SwiperDigitIndicator_SetStartPosition(ArkUI_SwiperDigitIndicator* indicator, float value); /** - * @brief Get the Id of the auxiliary line. + * @brief Gets the distance between the digital indicator and the start of the swiper. * - * @param guideline auxiliary line information. - * @param index auxiliary line index value. - * @return Id. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return Returns the distance between the digital indicator and the start of the swiper. + * @since 18 */ -const char* OH_ArkUI_GuidelineOption_GetId(ArkUI_GuidelineOption* guideline, int32_t index); +float OH_ArkUI_SwiperDigitIndicator_GetStartPosition(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Get the direction of the auxiliary line. + * @brief Sets the distance between the digital indicator and the top of the swiper. * - * @param guideline auxiliary line information. - * @param index auxiliary line index value. - * @return direction. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param value Indicates the distance between the digital indicator and the top of the swiper. + * @since 18 */ -ArkUI_Axis OH_ArkUI_GuidelineOption_GetDirection(ArkUI_GuidelineOption* guideline, int32_t index); +void OH_ArkUI_SwiperDigitIndicator_SetTopPosition(ArkUI_SwiperDigitIndicator* indicator, float value); /** - * @brief Get the distance from the left or top of the container. + * @brief Gets the distance between the digital indicator and the top of the swiper. * - * @param guideline auxiliary line information. - * @param index auxiliary line index value. - * @return The distance from the left or top of the container. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return Returns the distance between the digital indicator and the top of the swiper. + * @since 18 */ -float OH_ArkUI_GuidelineOption_GetPositionStart(ArkUI_GuidelineOption* guideline, int32_t index); +float OH_ArkUI_SwiperDigitIndicator_GetTopPosition(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Get the distance from the right side or bottom of the container. + * @brief Sets the distance between the digital indicator and the end of the swiper. * - * @param guideline auxiliary line information. - * @param index auxiliary line index value. - * @return The distance from the right side or bottom of the container. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param value Indicates the distance between the digital indicator and the end of the swiper. + * @since 18 */ -float OH_ArkUI_GuidelineOption_GetPositionEnd(ArkUI_GuidelineOption* guideline, int32_t index); +void OH_ArkUI_SwiperDigitIndicator_SetEndPosition(ArkUI_SwiperDigitIndicator* indicator, float value); /** - * @brief creates barrier information within the RelativeContaine container. + * @brief Gets the distance between the digital indicator and the end of the swiper. * - * @param size Number of barriers. - * @return barrier information. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return Returns the distance between the digital indicator and the end of the swiper. + * @since 18 */ -ArkUI_BarrierOption* OH_ArkUI_BarrierOption_Create(int32_t size); +float OH_ArkUI_SwiperDigitIndicator_GetEndPosition(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Destroy barrier information. + * @brief Sets the distance between the digital indicator and the bottom of the swiper. * - * @param barrierStyle barrier information. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param value Returns the distance between the digital indicator and the bottom of the swiper. + * @since 18 */ -void OH_ArkUI_BarrierOption_Dispose(ArkUI_BarrierOption* barrierStyle); +void OH_ArkUI_SwiperDigitIndicator_SetBottomPosition(ArkUI_SwiperDigitIndicator* indicator, float value); /** - * @brief Set the Id of the barrier. + * @brief Gets the distance between the digital indicator and the bottom of the swiper. * - * @param barrierStyle barrier information. - * @param value id, must be unique and cannot have the same name as the component in the container. - * @param index Barrier index value. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return Returns the distance between the digital indicator and the bottom of the swiper. + * @since 18 */ -void OH_ArkUI_BarrierOption_SetId(ArkUI_BarrierOption* barrierStyle, const char* value, int32_t index); +float OH_ArkUI_SwiperDigitIndicator_GetBottomPosition(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Set the direction of the barrier. + * @brief Sets the font color of total count in the digital indicator. * - * @param barrierStyle barrier information. - * @param value direction. - * @param index Barrier index value. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param color font color, in 0xARGB format. Default value: 0xFF182431. + * @since 18 */ -void OH_ArkUI_BarrierOption_SetDirection( - ArkUI_BarrierOption* barrierStyle, ArkUI_BarrierDirection value, int32_t index); +void OH_ArkUI_SwiperDigitIndicator_SetFontColor(ArkUI_SwiperDigitIndicator* indicator, uint32_t color); /** - * @brief Sets the dependent component of the barrier. + * @brief Gets the font color of total count in the digital indicator. * - * @param barrierStyle barrier information. - * @param value The ID of the dependent component. - * @param index Barrier index value. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return font color, in 0xARGB format. + * @since 18 */ -void OH_ArkUI_BarrierOption_SetReferencedId(ArkUI_BarrierOption* barrierStyle, const char* value, int32_t index); +uint32_t OH_ArkUI_SwiperDigitIndicator_GetFontColor(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Get the Id of the barrier. + * @brief Sets the font color of selected index in the digital indicator. * - * @param barrierStyle auxiliary line information. - * @param index auxiliary line index value. - * @return The Id of the barrier. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @param selectedColor font color, in 0xARGB format. Default value: 0xFF182431. + * @since 18 */ -const char* OH_ArkUI_BarrierOption_GetId(ArkUI_BarrierOption* barrierStyle, int32_t index); +void OH_ArkUI_SwiperDigitIndicator_SetSelectedFontColor(ArkUI_SwiperDigitIndicator* indicator, uint32_t selectedColor); /** - * @brief Gets the direction of the barrier. + * @brief Gets the font color of selected index in the digital indicator. * - * @param barrierStyle auxiliary line information. - * @param index auxiliary line index value. - * @return The direction of the barrier. - * @since 12 + * @param indicator The pointer to the digital indicator. + * @return font color, in 0xARGB format. + * @since 18 */ -ArkUI_BarrierDirection OH_ArkUI_BarrierOption_GetDirection(ArkUI_BarrierOption* barrierStyle, int32_t index); +uint32_t OH_ArkUI_SwiperDigitIndicator_GetSelectedFontColor(ArkUI_SwiperDigitIndicator* indicator); /** - * @brief Get the dependent components of the barrier. + * @brief Sets the font size of total count in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @param size font size, in fp. + * @since 18 + */ +void OH_ArkUI_SwiperDigitIndicator_SetFontSize(ArkUI_SwiperDigitIndicator* indicator, float size); + +/** + * @brief Gets the font size of total count in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @return font size, in fp. + * @since 18 + */ +float OH_ArkUI_SwiperDigitIndicator_GetFontSize(ArkUI_SwiperDigitIndicator* indicator); + +/** + * @brief Sets the font size of selected index in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @param size font size, in fp. + * @since 18 + */ +void OH_ArkUI_SwiperDigitIndicator_SetSelectedFontSize(ArkUI_SwiperDigitIndicator* indicator, float size); + +/** + * @brief Gets the font size of selected index in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @return font size, in fp. + * @since 18 + */ +float OH_ArkUI_SwiperDigitIndicator_GetSelectedFontSize(ArkUI_SwiperDigitIndicator* indicator); + +/** + * @brief Sets the font weight of total count in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @param fontWeight font weight {@link ArkUI_FontWeight}. The default value is ARKUI_FONT_WEIGHT_NORMAL. + * @since 18 + */ +void OH_ArkUI_SwiperDigitIndicator_SetFontWeight(ArkUI_SwiperDigitIndicator *indicator, ArkUI_FontWeight fontWeight); + +/** + * @brief Gets the font weight of total count in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @return font weight {@link ArkUI_FontWeight}. + * @since 18 + */ +ArkUI_FontWeight OH_ArkUI_SwiperDigitIndicator_GetFontWeight(ArkUI_SwiperDigitIndicator* indicator); + +/** + * @brief Sets the font weight of selected index in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @param selectedFontWeight font weight {@link ArkUI_FontWeight}. The default value is ARKUI_FONT_WEIGHT_NORMAL. + * @since 18 + */ +void OH_ArkUI_SwiperDigitIndicator_SetSelectedFontWeight( + ArkUI_SwiperDigitIndicator *indicator, ArkUI_FontWeight selectedFontWeight); + +/** + * @brief Gets the font weight of selected index in the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @return font weight {@link ArkUI_FontWeight}. + * @since 18 + */ +ArkUI_FontWeight OH_ArkUI_SwiperDigitIndicator_GetSelectedFontWeight(ArkUI_SwiperDigitIndicator* indicator); + +/** + * @brief Destroys the digital indicator. + * + * @param indicator The pointer to the digital indicator. + * @since 18 + */ +void OH_ArkUI_SwiperDigitIndicator_Destroy(ArkUI_SwiperDigitIndicator *indicator); + +/** + * @brief Sets whether to ignore the size of the indicator for {@link OH_ArkUI_SwiperDigitIndicator_SetBottomPosition}. + * + * @param indicator The pointer to the digital indicator. + * @param ignoreSize Whether to ignore the size of the indicator. The value 1 means to ignore, and 0 means the opposite. + * The default value is 0. + * @since 18 +*/ +void OH_ArkUI_SwiperDigitIndicator_SetIgnoreSizeOfBottom(ArkUI_SwiperDigitIndicator* indicator, int32_t ignoreSize); + +/** + * @brief Obtains whether to ignore the size of the indicator for {@link OH_ArkUI_SwiperDigitIndicator_SetBottomPosition}. + * + * @param indicator The pointer to the digital indicator. + * @return Returns whether to ignore the size of the indicator. + * @since 18 +*/ +int32_t OH_ArkUI_SwiperDigitIndicator_GetIgnoreSizeOfBottom(ArkUI_SwiperDigitIndicator* indicator); + +/** + * @brief Creates a arrow style for swiper. + * + * @return Returns the pointer to the new arrow style. + * @since 18 + */ +ArkUI_SwiperArrowStyle *OH_ArkUI_SwiperArrowStyle_Create(); + +/** + * @brief Sets whether to show the background for the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param showBackground whether to show the background for the arrow. + * The value 1 means to show the background, and 0 means the opposite. + * The default value is 0. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetShowBackground(ArkUI_SwiperArrowStyle *arrowStyle, int32_t showBackground); + +/** + * @brief Gets whether to show the background for the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return whether to show the background for the arrow. + * The value 1 means to show the background, and 0 means the opposite. + * @since 18 + */ +int32_t OH_ArkUI_SwiperArrowStyle_GetShowBackground(ArkUI_SwiperArrowStyle* arrowStyle); + +/** + * @brief Sets the display position of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param showSidebarMiddle the display position of the arrow. + * The value 1 means to display on boths sides of the swiper, + * and 0 means display on boths sides of the swiper indicator. + * The default value is 0. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetShowSidebarMiddle(ArkUI_SwiperArrowStyle* arrowStyle, int32_t showSidebarMiddle); + +/** + * @brief Gets the display position of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return the display position of the arrow. The value 1 means to display on boths sides of the swiper, + * and 0 means display on boths sides of the swiper indicator. + * @since 18 + */ +int32_t OH_ArkUI_SwiperArrowStyle_GetShowSidebarMiddle(ArkUI_SwiperArrowStyle* arrowStyle); + +/** + * @brief Sets the background size of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param backgroundSize the background size of the arrow. The unit is vp. + * The default value is 24 when the arrow displays on both sides of the swiper indicator. + * The default value is 32 when the arrow displays on both sides of the swiper. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetBackgroundSize(ArkUI_SwiperArrowStyle* arrowStyle, float backgroundSize); + +/** + * @brief Gets the background size of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return Returns the background size of the arrow. The unit is vp. + * @since 18 + */ +float OH_ArkUI_SwiperArrowStyle_GetBackgroundSize(ArkUI_SwiperArrowStyle *arrowStyle); + +/** + * @brief Destroys the arrow style. + * + * @param arrowStyle The pointer to the arrow style. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_Destroy(ArkUI_SwiperArrowStyle *arrowStyle); + +/** + * @brief Sets the background color of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param backgroundColor the background color of the arrow, in 0xARGB format. + * The default value is 0x00000000 when the arrow displays on both sides of the swiper indicator. + * The default value is 0x19182431 when the arrow displays on both sides of the swiper. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetBackgroundColor(ArkUI_SwiperArrowStyle *arrowStyle, uint32_t backgroundColor); + +/** + * @brief Gets the background color of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return Returns the background color of the arrow, in 0xARGB format. + * @since 18 + */ +uint32_t OH_ArkUI_SwiperArrowStyle_GetBackgroundColor(ArkUI_SwiperArrowStyle* arrowStyle); + +/** + * @brief Sets the size of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param arrowSize the size of the arrow. The unit is vp. + * The default value is 18 when the arrow displays on both sides of the swiper indicator. + * The default value is 24 when the arrow displays on both sides of the swiper. + * The arrow size is fixed to 3/4 of the background size when the background is shown. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetArrowSize(ArkUI_SwiperArrowStyle* arrowStyle, float arrowSize); + +/** + * @brief Gets the size of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return the size of the arrow. The unit is vp. + * @since 18 + */ +float OH_ArkUI_SwiperArrowStyle_GetArrowSize(ArkUI_SwiperArrowStyle* arrowStyle); + +/** + * @brief Sets the color of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @param arrowColor the color of the arrow, in 0xARGB format. The default value is 0x00182431. + * @since 18 + */ +void OH_ArkUI_SwiperArrowStyle_SetArrowColor(ArkUI_SwiperArrowStyle* arrowStyle, uint32_t arrowColor); + +/** + * @brief Gets the color of the arrow. + * + * @param arrowStyle The pointer to the arrow style. + * @return Returns the color of the arrow, in 0xARGB format. + * @since 18 + */ +uint32_t OH_ArkUI_SwiperArrowStyle_GetArrowColor(ArkUI_SwiperArrowStyle* arrowStyle); + +/** + * @brief Create auxiliary line information in the RelativeContaine container. + * + * @param size The number of auxiliary lines. + * @return auxiliary line information. + * @since 12 + */ +ArkUI_GuidelineOption* OH_ArkUI_GuidelineOption_Create(int32_t size); + +/** + * @brief Destroy auxiliary line information. + * + * @param guideline auxiliary line information. + * @since 12 + */ +void OH_ArkUI_GuidelineOption_Dispose(ArkUI_GuidelineOption* guideline); + +/** + * @brief Set the Id of the auxiliary line. + * + * @param guideline auxiliary line information. + * @param value id, must be unique and cannot have the same name as the component in the container. + * @param index auxiliary line index value. + * @since 12 + */ +void OH_ArkUI_GuidelineOption_SetId(ArkUI_GuidelineOption* guideline, const char* value, int32_t index); + +/** + * @brief Set the direction of the auxiliary line. + * + * @param guideline auxiliary line information. + * @param value direction. + * @param index auxiliary line index value. + * @since 12 + */ +void OH_ArkUI_GuidelineOption_SetDirection(ArkUI_GuidelineOption* guideline, ArkUI_Axis value, int32_t index); + +/** + * @brief Set the distance from the left or top of the container. + * + * @param guideline auxiliary line information. + * @param value The distance from the left or top of the container. + * @param index auxiliary line index value. + * @since 12 + */ +void OH_ArkUI_GuidelineOption_SetPositionStart(ArkUI_GuidelineOption* guideline, float value, int32_t index); + +/** + * @brief Set the distance from the right or bottom of the container. + * + * @param guideline auxiliary line information. + * @param value The distance from the right side or bottom of the container. + * @param index auxiliary line index value. + * @since 12 + */ +void OH_ArkUI_GuidelineOption_SetPositionEnd(ArkUI_GuidelineOption* guideline, float value, int32_t index); + +/** + * @brief Get the Id of the auxiliary line. + * + * @param guideline auxiliary line information. + * @param index auxiliary line index value. + * @return Id. + * @since 12 + */ +const char* OH_ArkUI_GuidelineOption_GetId(ArkUI_GuidelineOption* guideline, int32_t index); + +/** + * @brief Get the direction of the auxiliary line. + * + * @param guideline auxiliary line information. + * @param index auxiliary line index value. + * @return direction. + * @since 12 + */ +ArkUI_Axis OH_ArkUI_GuidelineOption_GetDirection(ArkUI_GuidelineOption* guideline, int32_t index); + +/** + * @brief Get the distance from the left or top of the container. + * + * @param guideline auxiliary line information. + * @param index auxiliary line index value. + * @return The distance from the left or top of the container. + * @since 12 + */ +float OH_ArkUI_GuidelineOption_GetPositionStart(ArkUI_GuidelineOption* guideline, int32_t index); + +/** + * @brief Get the distance from the right side or bottom of the container. + * + * @param guideline auxiliary line information. + * @param index auxiliary line index value. + * @return The distance from the right side or bottom of the container. + * @since 12 + */ +float OH_ArkUI_GuidelineOption_GetPositionEnd(ArkUI_GuidelineOption* guideline, int32_t index); + +/** + * @brief creates barrier information within the RelativeContaine container. + * + * @param size Number of barriers. + * @return barrier information. + * @since 12 + */ +ArkUI_BarrierOption* OH_ArkUI_BarrierOption_Create(int32_t size); + +/** + * @brief Destroy barrier information. + * + * @param barrierStyle barrier information. + * @since 12 + */ +void OH_ArkUI_BarrierOption_Dispose(ArkUI_BarrierOption* barrierStyle); + +/** + * @brief Set the Id of the barrier. + * + * @param barrierStyle barrier information. + * @param value id, must be unique and cannot have the same name as the component in the container. + * @param index Barrier index value. + * @since 12 + */ +void OH_ArkUI_BarrierOption_SetId(ArkUI_BarrierOption* barrierStyle, const char* value, int32_t index); + +/** + * @brief Set the direction of the barrier. + * + * @param barrierStyle barrier information. + * @param value direction. + * @param index Barrier index value. + * @since 12 + */ +void OH_ArkUI_BarrierOption_SetDirection( + ArkUI_BarrierOption* barrierStyle, ArkUI_BarrierDirection value, int32_t index); + +/** + * @brief Sets the dependent component of the barrier. + * + * @param barrierStyle barrier information. + * @param value The ID of the dependent component. + * @param index Barrier index value. + * @since 12 + */ +void OH_ArkUI_BarrierOption_SetReferencedId(ArkUI_BarrierOption* barrierStyle, const char* value, int32_t index); + +/** + * @brief Get the Id of the barrier. + * + * @param barrierStyle auxiliary line information. + * @param index auxiliary line index value. + * @return The Id of the barrier. + * @since 12 + */ +const char* OH_ArkUI_BarrierOption_GetId(ArkUI_BarrierOption* barrierStyle, int32_t index); + +/** + * @brief Gets the direction of the barrier. + * + * @param barrierStyle auxiliary line information. + * @param index auxiliary line index value. + * @return The direction of the barrier. + * @since 12 + */ +ArkUI_BarrierDirection OH_ArkUI_BarrierOption_GetDirection(ArkUI_BarrierOption* barrierStyle, int32_t index); + +/** + * @brief Get the dependent components of the barrier. * * @param barrierStyle auxiliary line information. * @param index auxiliary line index value. @@ -2957,7 +3761,7 @@ void OH_ArkUI_AlignmentRuleOption_Dispose(ArkUI_AlignmentRuleOption* option); * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. - * @param value Alignment relative to the anchor component. + * @param alignment Alignment relative to the anchor component. * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetStart( @@ -2968,7 +3772,7 @@ void OH_ArkUI_AlignmentRuleOption_SetStart( * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. - * @param value Alignment relative to the anchor component. + * @param alignment Alignment relative to the anchor component. * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetEnd( @@ -2979,7 +3783,7 @@ void OH_ArkUI_AlignmentRuleOption_SetEnd( * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. -* @param value Alignment relative to anchor component +* @param alignment Alignment relative to anchor component * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetCenterHorizontal( @@ -2990,7 +3794,7 @@ void OH_ArkUI_AlignmentRuleOption_SetCenterHorizontal( * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. - * @param value Alignment relative to anchor component + * @param alignment Alignment relative to anchor component * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetTop(ArkUI_AlignmentRuleOption* option, const char* id, @@ -3001,7 +3805,7 @@ void OH_ArkUI_AlignmentRuleOption_SetTop(ArkUI_AlignmentRuleOption* option, cons * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. - * @param value Alignment relative to anchor component + * @param alignment Alignment relative to anchor component * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetBottom( @@ -3012,7 +3816,7 @@ void OH_ArkUI_AlignmentRuleOption_SetBottom( * * @param option Alignment rule information of subcomponents in the relative container. * @param id The id value of the anchor component. -* @param value Alignment relative to the anchor component. +* @param alignment Alignment relative to the anchor component. * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetCenterVertical( @@ -3031,7 +3835,7 @@ void OH_ArkUI_AlignmentRuleOption_SetBiasHorizontal(ArkUI_AlignmentRuleOption* o * @brief Set the vertical offset parameter of the component under the anchor point constraint. * * @param option Alignment rule information of subcomponents in the relative container. - * @param horizontal bias value in the vertical direction. + * @param vertical bias value in the vertical direction. * @since 12 */ void OH_ArkUI_AlignmentRuleOption_SetBiasVertical(ArkUI_AlignmentRuleOption* option, float vertical); @@ -3174,7 +3978,7 @@ ArkUI_ListItemSwipeActionItem* OH_ArkUI_ListItemSwipeActionItem_Create(); /** * @brief Destroy the ListitemSwipeActionItem instance. * -* @param option List Item SwipeActionItem instance to be destroyed. +* @param item List Item SwipeActionItem instance to be destroyed. * @since 12 */ void OH_ArkUI_ListItemSwipeActionItem_Dispose(ArkUI_ListItemSwipeActionItem* item); @@ -3182,8 +3986,8 @@ void OH_ArkUI_ListItemSwipeActionItem_Dispose(ArkUI_ListItemSwipeActionItem* ite /** * @brief Set the layout content of ListItem SwipeActionItem. * -* @param option List Item SwipeActionItem instance. -* @param builder Layout information. +* @param item List Item SwipeActionItem instance. +* @param node Layout information. * @since 12 */ void OH_ArkUI_ListItemSwipeActionItem_SetContent(ArkUI_ListItemSwipeActionItem* item, ArkUI_NodeHandle node); @@ -3191,7 +3995,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetContent(ArkUI_ListItemSwipeActionItem* /** * @brief Set the threshold for long-distance sliding deletion distance of components. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @param distance Component long-distance sliding deletion distance threshold. * @since 12 */ @@ -3200,7 +4004,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetActionAreaDistance(ArkUI_ListItemSwipeA /** * @brief Obtain the threshold for long-distance sliding deletion distance of components. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @return Component long-distance sliding deletion distance threshold. If -1.0f is returned, the return fails. * The possible cause of the failure is that the item parameter is abnormal, such as a null pointer. * @since 12 @@ -3210,7 +4014,7 @@ float OH_ArkUI_ListItemSwipeActionItem_GetActionAreaDistance(ArkUI_ListItemSwipe /** * @brief Set the event to be called when a sliding entry enters the deletion area. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @param callback Callback Events. * @since 12 */ @@ -3219,7 +4023,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnEnterActionArea(ArkUI_ListItemSwipeAc /** * @brief Set the event triggered when a sliding entry enters the deletion area. * - * @param option List Item SwipeActionItem instance. + * @param item List Item SwipeActionItem instance. * @param userData User defined data. * @param callback Callback Events. * @since 12 @@ -3230,7 +4034,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnEnterActionAreaWithUserData(ArkUI_Lis /** * @brief Set the event to be called when a component enters the long-range deletion area and deletes a ListItem. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @param callback Callback Events. * @since 12 */ @@ -3239,7 +4043,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnAction(ArkUI_ListItemSwipeActionItem* /** * @brief Set the event triggered when a component enters the long-range deletion area and deletes a ListItem. * - * @param option List Item SwipeActionItem instance. + * @param item List Item SwipeActionItem instance. * @param userData User defined data. * @param callback Callback Events. * @since 12 @@ -3250,7 +4054,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnActionWithUserData(ArkUI_ListItemSwip /** * @brief Set the event to be called when a sliding entry exits the deletion area. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @param callback Callback Events. * @since 12 */ @@ -3259,7 +4063,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnExitActionArea(ArkUI_ListItemSwipeAct /** * @brief Set the event triggered when a sliding entry exits the deletion area. * - * @param option List Item SwipeActionItem instance. + * @param item List Item SwipeActionItem instance. * @param userData User defined data. * @param callback Callback Events. * @since 12 @@ -3270,7 +4074,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnExitActionAreaWithUserData(ArkUI_List /** * @brief Set the event triggered when the sliding state of a list item changes. * -* @param option List Item SwipeActionItem instance. +* @param item List Item SwipeActionItem instance. * @param callback Callback Events. * swipeActionState The changed state. * @since 12 @@ -3281,7 +4085,7 @@ void OH_ArkUI_ListItemSwipeActionItem_SetOnStateChange(ArkUI_ListItemSwipeAction /** * @brief Set the event triggered when the sliding state of a list item changes. * - * @param option List Item SwipeActionItem instance. + * @param item List Item SwipeActionItem instance. * @param userData User defined data. * @param callback Callback Events. * swipeActionState The changed state. @@ -3312,7 +4116,7 @@ void OH_ArkUI_ListItemSwipeActionOption_Dispose(ArkUI_ListItemSwipeActionOption* * of the ListItem SwipeActionItem. * * @param option List Item SwipeActionItem instance. -* @param builder Layout information. +* @param item Layout information. * @since 12 */ void OH_ArkUI_ListItemSwipeActionOption_SetStart(ArkUI_ListItemSwipeActionOption* option, @@ -3323,7 +4127,7 @@ void OH_ArkUI_ListItemSwipeActionOption_SetStart(ArkUI_ListItemSwipeActionOption * of the ListItem SwipeActionItem. * * @param option List Item SwipeActionItem instance. -* @param builder Layout information. +* @param item Layout information. * @since 12 */ void OH_ArkUI_ListItemSwipeActionOption_SetEnd(ArkUI_ListItemSwipeActionOption* option, @@ -3493,7 +4297,7 @@ ArkUI_CustomSpanMetrics* OH_ArkUI_CustomSpanMetrics_Create(); /** * @brief Disposes of measurement metrics of this custom span. * - * @param info The CustomSpanMetrics instance to be destroyed. + * @param metrics The CustomSpanMetrics instance to be destroyed. * @since 12 */ void OH_ArkUI_CustomSpanMetrics_Dispose(ArkUI_CustomSpanMetrics* metrics); @@ -3796,7 +4600,7 @@ ArkUI_AccessibilityValue* OH_ArkUI_AccessibilityValue_Create(void); /** * @brief Dispose accessibility value. * -* @param state accessibility value object. +* @param value accessibility value object. * @since 12 */ void OH_ArkUI_AccessibilityValue_Dispose(ArkUI_AccessibilityValue* value); @@ -3858,6 +4662,63 @@ void OH_ArkUI_AccessibilityValue_SetCurrent(ArkUI_AccessibilityValue* value, int */ int32_t OH_ArkUI_AccessibilityValue_GetCurrent(ArkUI_AccessibilityValue* value); +/** + * @brief Set accessibility minimum value. + * + * @param value accessibility value object. + * @param rangeMin minimum value based on range components, The default value is -1. + * @since 18 +*/ +void OH_ArkUI_AccessibilityValue_SetRangeMin(ArkUI_AccessibilityValue* value, int32_t rangeMin); + +/** + * @brief Get accessibility minimum value. + * + * @param value accessibility value object. + * @return minimum value based on range components, The default value is -1. + * If the function parameter is abnormal, return -1. + * @since 18 +*/ +int32_t OH_ArkUI_AccessibilityValue_GetRangeMin(ArkUI_AccessibilityValue* value); + +/** + * @brief Set accessibility maximum value. + * + * @param value accessibility value object. + * @param rangeMax maximum value based on range components, The default value is -1. + * @since 18 +*/ +void OH_ArkUI_AccessibilityValue_SetRangeMax(ArkUI_AccessibilityValue* value, int32_t rangeMax); + +/** + * @brief Get accessibility maximum value. + * + * @param value accessibility value object. + * @return maximum value based on range components, The default value is -1. + * If the function parameter is abnormal, return -1. + * @since 18 +*/ +int32_t OH_ArkUI_AccessibilityValue_GetRangeMax(ArkUI_AccessibilityValue* value); + +/** + * @brief Set accessibility current value. + * + * @param value accessibility value object. + * @param rangeCurrent value based on range components, The default value is -1. + * @since 18 +*/ +void OH_ArkUI_AccessibilityValue_SetRangeCurrent(ArkUI_AccessibilityValue* value, int32_t rangeCurrent); + +/** + * @brief Get accessibility current value. + * + * @param value accessibility value object. + * @return current value based on range components, The default value is -1. + * If the function parameter is abnormal, return -1. + * @since 18 +*/ +int32_t OH_ArkUI_AccessibilityValue_GetRangeCurrent(ArkUI_AccessibilityValue* value); + /** * @brief Set accessibility text value. * @@ -3876,6 +4737,382 @@ void OH_ArkUI_AccessibilityValue_SetText(ArkUI_AccessibilityValue* value, const * @since 12 */ const char* OH_ArkUI_AccessibilityValue_GetText(ArkUI_AccessibilityValue* value); + +/** + * @brief Destroy the instance of Customs Property. + * + * @param handle The instance of Customs Property to be destroyed. + * @since 14 + */ +void OH_ArkUI_CustomProperty_Destroy(ArkUI_CustomProperty* handle); + +/** + * @brief Get custom attribute value information. + * + * @param handle Custom attribute object pointer. + * @return Customize the value information within the attribute structure. + * @since 14 + */ +const char* OH_ArkUI_CustomProperty_GetStringValue(ArkUI_CustomProperty* handle); + +/** + * @brief Get window name from HostWindowInfo. + * + * @param info HostWindowInfo object pointer. + * @return Window name in HostWindowInfo. + * @since 15 + */ +const char* OH_ArkUI_HostWindowInfo_GetName(ArkUI_HostWindowInfo* info); + +/** + * @brief Destroy the instance of HostWindowInfo. + * + * @param info Instance of HostWindowInfo to be destroyed. + * @since 15 + */ +void OH_ArkUI_HostWindowInfo_Destroy(ArkUI_HostWindowInfo* info); + +/** + * @brief Destroy ActiveChildenInfo instance. + * + * @param handle ActiveChild instance to be destroyed. + * @since 14 + */ +void OH_ArkUI_ActiveChildrenInfo_Destroy(ArkUI_ActiveChildrenInfo* handle); + +/** + * @brief Retrieve the child nodes of ActiveChildenInfo with the structure index. + * + * @param handle The ActiveChildenInfo instance for obtaining information. + * @param index The index of child nodes. + * @return The child node pointer corresponding to the index. Return nullptr in case of exception. + * @since 14 + */ +ArkUI_NodeHandle OH_ArkUI_ActiveChildrenInfo_GetNodeByIndex(ArkUI_ActiveChildrenInfo* handle, int32_t index); + +/** + * @brief Retrieve the number of nodes within the structure of ActiveChildenInfo. + * + * @param handle The ActiveChildenInfo instance for obtaining information. + * @return Number of child nodes. Default value: 0. + * @since 14 + */ +int32_t OH_ArkUI_ActiveChildrenInfo_GetCount(ArkUI_ActiveChildrenInfo* handle); + +/** + * @brief Create linear progress indicator style information. + * + * @return Returns a ProgressLinearStyleOption instance. + *
If the result returns nullptr, there may be out of memory. + * @since 15 + */ +ArkUI_ProgressLinearStyleOption* OH_ArkUI_ProgressLinearStyleOption_Create(void); + +/** + * @brief Destroy linear progress indicator style information. + * + * @param option Linear progress indicator style information. + * @since 15 + */ +void OH_ArkUI_ProgressLinearStyleOption_Destroy(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Set whether the scan effect is enabled. + * + * @param option Linear progress indicator style information. + * @param enabled Whether to enable the scan effect. Default value: false. + * @since 15 + */ +void OH_ArkUI_ProgressLinearStyleOption_SetScanEffectEnabled(ArkUI_ProgressLinearStyleOption* option, bool enabled); + +/** + * @brief Set whether smoothing effect is enabled. + * + * @param option Linear progress indicator style information. + * @param enabled Whether to enable the smooth effect. When this effect is enabled, the progress change to + * the set value takes place gradually. Otherwise, it takes place immediately. Default value: true. + * @since 15 + */ +void OH_ArkUI_ProgressLinearStyleOption_SetSmoothEffectEnabled(ArkUI_ProgressLinearStyleOption* option, bool enabled); + +/** + * @brief Set linear progress indicator stroke width. + * + * @param option Linear progress indicator style information. + * @param strokeWidth Stroke width of the progress indicator. It cannot be set in percentage. + * Default value: 4.0vp. + * @since 15 + */ +void OH_ArkUI_ProgressLinearStyleOption_SetStrokeWidth(ArkUI_ProgressLinearStyleOption* option, float strokeWidth); + +/** + * @brief Set linear progress indicator stroke radius. + * + * @param option Linear progress indicator style information. + * @param strokeRadius Rounded corner radius of the progress indicator. Value range: [0, strokeWidth/2]. + * Default value: strokeWidth/2. + * @since 15 + */ +void OH_ArkUI_ProgressLinearStyleOption_SetStrokeRadius(ArkUI_ProgressLinearStyleOption* option, float strokeRadius); + +/** + * @brief Get whether scan effect is enable. + * + * @param option Linear progress indicator style information. + * @return Whether to enable the scan effect. + * @since 15 + */ +bool OH_ArkUI_ProgressLinearStyleOption_GetScanEffectEnabled(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Get whether smoothing effect is enabled. + * + * @param option Linear progress indicator style information. + * @return Whether to enable the smooth effect. + * @since 15 + */ +bool OH_ArkUI_ProgressLinearStyleOption_GetSmoothEffectEnabled(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Get linear progress indicator stroke width. + * + * @param option Linear progress indicator style information. + * @return Stroke width of the progress indicator. + * @since 15 + */ +float OH_ArkUI_ProgressLinearStyleOption_GetStrokeWidth(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Get linear progress indicator stroke radius. + * + * @param option Linear progress indicator style information. + * @return Rounded corner radius of the progress indicator. + * @since 15 + */ +float OH_ArkUI_ProgressLinearStyleOption_GetStrokeRadius(ArkUI_ProgressLinearStyleOption* option); + +/** + * @brief Creates an option for taking snapshot, the returned value must be released through + * {@link OH_ArkUI_DestroySnapshotOptions} when it's not used anymore. + * + * @return Returns the pointer to the created snapshot options object.If the object returns a null pointer, + * it indicates a creation failure, and the reason for the failure may be that the address space is full. + * @since 15 + */ +ArkUI_SnapshotOptions* OH_ArkUI_CreateSnapshotOptions(); + +/** + * @brief Dispose a snapshot option object. + * + * @param snapshotOptions Indicates the pointer to the snapshot option. + * @since 15 + */ +void OH_ArkUI_DestroySnapshotOptions(ArkUI_SnapshotOptions* snapshotOptions); + +/** + * @brief Config the snapshot option with scale. + * + * @param snapshotOptions Indicates the pointer to the snapshot option. + * @param scale Indicates the scale property to take the snapshot. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_SnapshotOptions_SetScale(ArkUI_SnapshotOptions* snapshotOptions, float scale); + +/** + * @brief Create a cross-language option instance. + * + * @return Returns a cross-language option instance. If the result is a null pointer, it may be out of memory. + * @since 15 + */ +ArkUI_CrossLanguageOption* OH_ArkUI_CrossLanguageOption_Create(void); + +/** + * @brief Destroy the cross-language option instance. + * + * @param option The cross-language option instance. + * @since 15 + */ +void OH_ArkUI_CrossLanguageOption_Destroy(ArkUI_CrossLanguageOption* option); + +/** + * @brief Enable the attribute setting in the cross-language option. + * + * @param option The cross-language option. + * @param enabled The attribute setting in the cross-language option. + * Default value: false. + * @since 15 + */ +void OH_ArkUI_CrossLanguageOption_SetAttributeSettingStatus(ArkUI_CrossLanguageOption* option, bool enabled); + +/** + * @brief Get the attribute setting enable of the cross-language option. + * + * @param option The cross-language option. + * @return The attribute setting enable of the cross-language option. + * @since 15 + */ +bool OH_ArkUI_CrossLanguageOption_GetAttributeSettingStatus(ArkUI_CrossLanguageOption* option); + +/** + * @brief Defines the parameters for visible area change events. + * + * @since 18 + */ +typedef struct ArkUI_VisibleAreaEventOptions ArkUI_VisibleAreaEventOptions; + +/** +* @brief Creates an instance of visible area change event parameters +* +* @return Returns the created instance of visible area change event parameters. +* @since 18 +*/ +ArkUI_VisibleAreaEventOptions* OH_ArkUI_VisibleAreaEventOptions_Create(); + +/** +* @brief Disposes of an instance of visible area change event parameters. +* +* @param option Instance to be destroyed. +* @since 18 +*/ +void OH_ArkUI_VisibleAreaEventOptions_Dispose(ArkUI_VisibleAreaEventOptions* option); + +/** +* @brief Sets the threshold ratios for visible area changes. +* +* @param option Instance of visible area change event parameters. +* @param value Array of threshold ratios. Each element represents the ratio of the visible area of a component to +* its total area. The visible area is calculated within the parent component's bounds; any area outside the parent +* component is not considered. Each value must be within the [0.0, 1.0] range. +* Values outside this range will be handled as 0.0 or 1.0. +* @param size Size of the threshold array. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* If an error code is returned, it may be due to a failure in parameter validation; +* the parameter must not be null. +* @since 18 +*/ +int32_t OH_ArkUI_VisibleAreaEventOptions_SetRatios(ArkUI_VisibleAreaEventOptions* option, float* value, int32_t size); + +/** +* @brief Sets the expected update interval for visible area changes. +* +* @param option Instance of visible area change event parameters. +* @param value Expected update interval, in ms. Default value: 1000. +* @return Returns the result code. +* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. +* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. +* If an error code is returned, it may be due to a failure in parameter validation; +* the parameter must not be null. +* @since 18 +*/ +int32_t OH_ArkUI_VisibleAreaEventOptions_SetExpectedUpdateInterval( + ArkUI_VisibleAreaEventOptions *option, int32_t value); + +/** + * @brief Obtains the threshold ratios for visible area changes. + * + * @param option Instance of visible area change event parameters. + * @param value Array of threshold ratios. + * @param size Size of the threshold array. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the provided buffer size is insufficient. + * If an error code is returned, it may be due to a failure in parameter validation; + * the parameter must not be null. + * @since 18 + */ +int32_t OH_ArkUI_VisibleAreaEventOptions_GetRatios(ArkUI_VisibleAreaEventOptions* option, float* value, int32_t* size); + +/** + * @brief Obtains the expected update interval for visible area changes. + * + * @param option Instance of visible area change event parameters. + * @return Returns the expected update interval, in ms. Default value: 1000. + * @since 18 + */ +int32_t OH_ArkUI_VisibleAreaEventOptions_GetExpectedUpdateInterval(ArkUI_VisibleAreaEventOptions* option); + +/** + *@brief Creates a TextPickerRangeContent instance. + * + *@param length The length of the picker array. + *@return Returns a TextPickerRangeContent instance. + *@since 18 + */ +ArkUI_TextPickerRangeContentArray* OH_ArkUI_TextPickerRangeContentArray_Create(int32_t length); + +/** + *@brief Sets the icon of items in a text picker ranges. + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@param icon Icon addreass. + *@param index The index position of the value to be obtained. + *@since 18 + */ +void OH_ArkUI_TextPickerRangeContentArray_SetIconAtIndex( + ArkUI_TextPickerRangeContentArray* handle, char* icon, int32_t index); + +/** + *@brief Sets the text of items in a text picker ranges + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@param text Text content + *@param index The index position of the value to be obtained. + *@since 18 + */ +void OH_ArkUI_TextPickerRangeContentArray_SetTextAtIndex( + ArkUI_TextPickerRangeContentArray* handle, char* text, int32_t index); + +/** + *@brief Destroy the TextPickerRangeContent instance. + * + *@param handle The TextPickerRangeContent instance for obtaining information. + *@since 18 + */ +void OH_ArkUI_TextPickerRangeContentArray_Destroy(ArkUI_TextPickerRangeContentArray* handle); + +/** + *@brief Creates a TextCascadePickerRangeContent instance. + * + *@param length The length of the picker array. + *@return Returns a TextCascadePickerRangeContent instance. + *@since 18 + */ +ArkUI_TextCascadePickerRangeContentArray* OH_ArkUI_TextCascadePickerRangeContentArray_Create(int32_t length); + +/** + *@brief Sets the text of items in a multi text picker ranges. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@param text text content + *@param index The index position of the value to be obtained. + *@since 18 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_SetTextAtIndex( + ArkUI_TextCascadePickerRangeContentArray* handle, char* text, int32_t index); + +/** + *@brief Sets the childs info of items in a multi text picker ranges. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@param child The child instance. + *@param index The index position of the value to be obtained. + *@since 18 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_SetChildAtIndex( + ArkUI_TextCascadePickerRangeContentArray* handle, ArkUI_TextCascadePickerRangeContentArray* child, int32_t index); + +/** + *@brief Destroy the TextCascadePickerRangeContent instance. + * + *@param handle The TextCascadePickerRangeContent instance for obtaining information. + *@since 18 + */ +void OH_ArkUI_TextCascadePickerRangeContentArray_Destroy(ArkUI_TextCascadePickerRangeContentArray* handle); #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_xcomponent_key_event.h b/arkui/ace_engine/native/native_xcomponent_key_event.h index 3bde2de13b4c047e86402eafe95b7fcdc1b11869..f4b178cc1bee02a0da56631ca8b9a139d5f7fa2f 100644 --- a/arkui/ace_engine/native/native_xcomponent_key_event.h +++ b/arkui/ace_engine/native/native_xcomponent_key_event.h @@ -16,13 +16,19 @@ /** * @addtogroup OH_NativeXComponent Native XComponent * @{ + * + * @brief Describes the key event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES. + * + * @since 10 + * @version 1.0 */ /** * @file native_xcomponent_key_event.h * * @brief Declares enums for key event of Native XComponent. - * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full * @kit ArkUI * @since 10 * @version 1.0 @@ -390,3 +396,4 @@ typedef enum { }; #endif #endif // _NATIVE_INTERFACE_XCOMPONENT_KEY_EVENT_H_ +/** @} */ \ No newline at end of file diff --git a/arkui/ace_engine/native/styled_string.h b/arkui/ace_engine/native/styled_string.h index cb537a6c6000eea2ef226d369cfad59a87d2c64a..b3f2db163fc23d816641f647f8b0f8076193ced8 100644 --- a/arkui/ace_engine/native/styled_string.h +++ b/arkui/ace_engine/native/styled_string.h @@ -39,6 +39,7 @@ #include "native_drawing/drawing_text_declaration.h" #include "native_drawing/drawing_text_typography.h" +#include "native_type.h" #ifdef __cplusplus extern "C" { @@ -118,6 +119,62 @@ OH_Drawing_Typography* OH_ArkUI_StyledString_CreateTypography(ArkUI_StyledString */ void OH_ArkUI_StyledString_AddPlaceholder(ArkUI_StyledString* handle, OH_Drawing_PlaceholderSpan* placeholder); +/** + * @brief Creates an ArkUI_StyledString_Descriptor object. + * + * @return Returns the pointer to the ArkUI_StyledString_Descriptor object created. + * @since 14 + */ +ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_Create(void); + +/** + * @brief Destroys an ArkUI_StyledString_Descriptor object and reclaims the memory occupied by the object. + * + * @param descriptor Pointer to an ArkUI_StyledString_Descriptor object. + * @since 14 + */ +void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* descriptor); + +/** + * @brief Converts styled string information into HTML. + * + * @param descriptor Pointer to an ArkUI_StyledString_Descriptor object. + * @return Returns the pointer to the resulting HTML string. This pointer is managed internally and should be destroyed + * by calling OH_ArkUI_StyledString_Descriptor_Destroy() when no longer needed to free the memory. + * @since 14 + */ +const char* OH_ArkUI_ConvertToHtml(ArkUI_StyledString_Descriptor* descriptor); + +/** + * @brief Deserializes a byte array containing styled string information into a styled string. + * + * @param buffer Byte array to be deserialized. + * @param bufferSize Length of the byte array. + * @param descriptor Pointer to an ArkUI_StyledString_Descriptor object. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 14 + */ +int32_t OH_ArkUI_UnmarshallStyledStringDescriptor( + uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor); + +/** + * @brief Serializes the styled string information into a byte array. + * + * @param buffer Byte array where the serialized data will be stored. + * @param bufferSize Length of the byte array. + * @param descriptor Pointer to an ArkUI_StyledString_Descriptor object. + * @param resultSize Actual length of the byte array. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_INVALID_STYLED_STRING} if the styled string is invalid. + * @since 14 + */ +int32_t OH_ArkUI_MarshallStyledStringDescriptor( + uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor, size_t* resultSize); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/ui_input_event.h b/arkui/ace_engine/native/ui_input_event.h index c9373cf0e3e219c4c91eed6bdf251d9e95548fc1..37497b2315d3a27099a8fbddd2551d8fb622b934 100644 --- a/arkui/ace_engine/native/ui_input_event.h +++ b/arkui/ace_engine/native/ui_input_event.h @@ -36,6 +36,7 @@ #ifndef _ARKUI_UI_INPUT_EVENT_H_ #define _ARKUI_UI_INPUT_EVENT_H_ +#include "native_type.h" #include #ifdef __cplusplus @@ -158,6 +159,10 @@ enum { UI_MOUSE_EVENT_ACTION_RELEASE = 2, /** Move. */ UI_MOUSE_EVENT_ACTION_MOVE = 3, + /** Cancel. + * @since 18 + */ + UI_MOUSE_EVENT_ACTION_CANCEL = 13, }; /** @@ -196,6 +201,62 @@ typedef enum { ARKUI_MODIFIER_KEY_FN = 1 << 3, } ArkUI_ModifierKeyName; +/** + * @brief Defines an enum for the axis types for focus axis events. + * + * @since 15 + */ +enum { + /** ABS_X. */ + UI_FOCUS_AXIS_EVENT_ABS_X = 0, + /** ABS_Y. */ + UI_FOCUS_AXIS_EVENT_ABS_Y = 1, + /** ABS_Z. */ + UI_FOCUS_AXIS_EVENT_ABS_Z = 2, + /** ABS_RZ. */ + UI_FOCUS_AXIS_EVENT_ABS_RZ = 3, + /** ABS_GAS. */ + UI_FOCUS_AXIS_EVENT_ABS_GAS = 4, + /** ABS_BRAKE. */ + UI_FOCUS_AXIS_EVENT_ABS_BRAKE = 5, + /** ABS_HAT0X. */ + UI_FOCUS_AXIS_EVENT_ABS_HAT0X = 6, + /** ABS_HAT0Y. */ + UI_FOCUS_AXIS_EVENT_ABS_HAT0Y = 7, +}; + +/** + * @brief Defines whether the touch event is from the left or right hand. + * + * @since 15 + */ +typedef enum { + /** Unknown. */ + ARKUI_EVENT_HAND_NONE = 0, + /** Left hand. */ + ARKUI_EVENT_HAND_LEFT = 1, + /** Right hand. */ + ARKUI_EVENT_HAND_RIGHT = 2, +} ArkUI_InteractionHand; + +/** + * @brief Enumerates the action types for axis events. + * + * @since 15 + */ +enum { + /** The axis event is abnormal. */ + UI_AXIS_EVENT_ACTION_NONE = 0, + /** The axis event begins. */ + UI_AXIS_EVENT_ACTION_BEGIN = 1, + /** The axis event is updated. */ + UI_AXIS_EVENT_ACTION_UPDATE = 2, + /** The axis event ends. */ + UI_AXIS_EVENT_ACTION_END = 3, + /** The axis event is canceled. */ + UI_AXIS_EVENT_ACTION_CANCEL = 4, +}; + /** * @brief Obtains the type of this UI input event. * @@ -262,6 +323,18 @@ uint32_t OH_ArkUI_PointerEvent_GetPointerCount(const ArkUI_UIInputEvent* event); */ int32_t OH_ArkUI_PointerEvent_GetPointerId(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); +/** + * @brief Obtains the ID of the touch pointer that triggers the current touch event. + * + * @param event Indicates the pointer to the current UI input event. + * @param pointerIndex Indicates the index of the target touch point in the multi-touch data list. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_GetChangedPointerId(const ArkUI_UIInputEvent* event, uint32_t* pointerIndex); + /** * @brief Obtains the X coordinate relative to the upper left corner of the current component from a directional * input event (such as a touch event, mouse event, or axis event). @@ -432,6 +505,18 @@ float OH_ArkUI_PointerEvent_GetTiltX(const ArkUI_UIInputEvent* event, uint32_t p */ float OH_ArkUI_PointerEvent_GetTiltY(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); +/** + * @brief Obtains the rotation angle of the stylus around the z-axis from a UI input event. + * + * @param event Pointer to the UI input event. + * @param rollAngle Rotation angle of the stylus around the z-axis. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_PointerEvent_GetRollAngle(const ArkUI_UIInputEvent* event, double* rollAngle); + /** * @brief Obtains the width of the touch area from a directional input event (for example, a touch event). * @@ -452,6 +537,32 @@ float OH_ArkUI_PointerEvent_GetTouchAreaWidth(const ArkUI_UIInputEvent* event, u */ float OH_ArkUI_PointerEvent_GetTouchAreaHeight(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); +/** + * @brief Obtains whether the current touch event is from the left or right hand. + * + * @param event Pointer to the current UI input event. + * @param hand Whether the touch point is from the left or right hand. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_GetInteractionHand(const ArkUI_UIInputEvent *event, ArkUI_InteractionHand *hand); + +/** + * @brief Obtains whether the current touch event is from the left or right hand. + * + * @param event Pointer to the current UI input event. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @param hand Whether the touch point is from the left or right hand. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_GetInteractionHandByIndex( + const ArkUI_UIInputEvent *event, int32_t pointerIndex, ArkUI_InteractionHand *hand); + /** * @brief Obtains the number of historical events from a directional input event (such as a touch event, mouse event, * or axis event). @@ -674,6 +785,15 @@ double OH_ArkUI_AxisEvent_GetHorizontalAxisValue(const ArkUI_UIInputEvent* event */ double OH_ArkUI_AxisEvent_GetPinchAxisScaleValue(const ArkUI_UIInputEvent* event); +/** + * @brief Obtains the action type of the current axis event. + * + * @param event Indicates the pointer to the current UI input event. + * @return Returns the action type of the current axis event. + * @since 15 + */ +int32_t OH_ArkUI_AxisEvent_GetAxisAction(const ArkUI_UIInputEvent* event); + /** * @brief Sets how the component behaves during hit testing. * @@ -716,6 +836,331 @@ int32_t OH_ArkUI_MouseEvent_GetMouseAction(const ArkUI_UIInputEvent* event); */ int32_t OH_ArkUI_PointerEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); +/** + * @brief Obtains the ID of device that triggers UI input event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the device ID. + * @since 14 + */ +int32_t OH_ArkUI_UIInputEvent_GetDeviceId(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains all keys that are pressed from UI input event. Only supports key events currently. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param pressedKeyCodes Array of all keys that are pressed. You need to allocate the memory space. + * @param length Length of the passed pressedKeyCodes array (when used as an input parameter); + * number of the keys pressed (when used as an output parameter). + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_NOT_ENOUGH} if the giving buffer is not enough. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 14 + */ +int32_t OH_ArkUI_UIInputEvent_GetPressedKeys( + const ArkUI_UIInputEvent* event, int32_t* pressedKeyCodes, int32_t* length); + +/** + * @brief Obtains the axis value of a focus axis event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param axis Axis type of the focus axis event. + * @return Returns the axis value of the focus axis event; returns 0.0 if any parameter error occurs. + * @since 15 + */ +double OH_ArkUI_FocusAxisEvent_GetAxisValue(const ArkUI_UIInputEvent* event, int32_t axis); + +/** + * @brief Sets whether to prevent a focus axis event from bubbling up. + * + * @param event Indicates the pointer to the current UI input event. + * @param stopPropagation Indicates whether to stop event propagation. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_FocusAxisEvent_SetStopPropagation(const ArkUI_UIInputEvent* event, bool stopPropagation); + +/** +* @brief Obtains the width of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the width of the component hit by the event; returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetWidth(const ArkUI_UIInputEvent* event); + +/** +* @brief Obtains the height of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the height of the component hit by the event; returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetHeight(const ArkUI_UIInputEvent* event); + +/** +* @brief Obtains the X coordinate of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the X coordinate of the component hit by the event; returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetPositionX(const ArkUI_UIInputEvent* event); + +/** +* @brief Obtains the Y coordinate of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the Y coordinate of the component hit by the event; +* returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetPositionY(const ArkUI_UIInputEvent* event); + +/** +* @brief Obtains the global X coordinate of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the global X coordinate of the component hit by the event; +* returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionX(const ArkUI_UIInputEvent* event); + +/** +* @brief Obtains the global Y coordinate of the component hit by an event. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns the global Y coordinate of the component hit by the event; +* returns 0.0f if any parameter error occurs. +* @since 18 +*/ +float OH_ArkUI_UIInputEvent_GetEventTargetGlobalPositionY(const ArkUI_UIInputEvent* event); + +/** +* @brief Checks whether the cursor is hovering over this component. +* +* @param event Pointer to an ArkUI_UIInputEvent object. +* @return Returns true if the cursor is hovering over the current component. +* Returns false if the cursor is not hovering over the current component. +* @since 18 +*/ +bool OH_ArkUI_HoverEvent_IsHovered(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the state of the modifier keys in a UI input event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param keys Pointer to a variable where the current combination of pressed modifier keys will be returned. + * The application can use bitwise operations to determine the state of each modifier key. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_UIInputEvent_GetModifierKeyStates(const ArkUI_UIInputEvent* event, uint64_t* keys); + +/** + * @brief Obtains the press time of a specific touch point. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @return Returns the press time of the specific touch point; returns 0 if any parameter error occurs. + * @since 15 + */ +int64_t OH_ArkUI_PointerEvent_GetPressedTimeByIndex(const ArkUI_UIInputEvent* event, uint32_t pointerIndex); + +/** + * @brief Obtains the x-axis offset of the mouse pointer position relative to the position in the previously reported + * mouse event. This value may be less than the difference between the two reported X coordinates when the mouse pointer + * is near the screen edge. + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the x-axis offset of the mouse pointer position relative to the position in the previously reported + * mouse event; returns 0.0f if any parameter error occurs. + * @since 15 + */ +float OH_ArkUI_MouseEvent_GetRawDeltaX(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the y-axis offset of the mouse pointer position relative to the position in the previously reported + * mouse event. This value may be less than the difference between the two reported Y coordinates when the mouse pointer + * is near the screen edge. + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the y-axis offset of the mouse pointer position relative to the position in the previously reported + * mouse event; returns 0.0f if any parameter error occurs. + * @since 15 + */ +float OH_ArkUI_MouseEvent_GetRawDeltaY(const ArkUI_UIInputEvent* event); + +/** + * @brief Obtains the pressed buttons from a mouse event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param pressedButtons Array of the pressed buttons. An int array must be created beforehand to store the pressed + * buttons. + * @param length Length of the passed pressedButtons array (when used as an input parameter); + * number of the buttons pressed (when used as an output parameter). + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR} if the given buffer size is insufficient. + * @since 15 + */ +int32_t OH_ArkUI_MouseEvent_GetPressedButtons( + const ArkUI_UIInputEvent* event, int32_t* pressedButtons, int32_t* length); + +/** + * @brief Obtains the ID of the screen where the UI input event occurs. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the screen ID; returns 0 if any parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_UIInputEvent_GetTargetDisplayId(const ArkUI_UIInputEvent* event); + +/** + * @brief Sets whether to enable axis event propagation. + * + * @param event Pointer to the UI input event. + * @param propagation Whether to enable event propagation. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 18 + */ +int32_t OH_ArkUI_AxisEvent_SetPropagation(const ArkUI_UIInputEvent* event, bool propagation); + +/** + * @brief Obtains the scroll step configuration of the mouse wheel axis event. + * + * @param event Pointer to the UI input event. + * @return Returns the scroll step configuration of the mouse wheel axis event. + * @since 18 + */ +int32_t OH_ArkUI_AxisEvent_GetScrollStep(const ArkUI_UIInputEvent* event); + +/** + * @brief Creates a cloned event pointer based on an event pointer. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param clonedEvent Pointer to the cloned ArkUI_UIInputEvent object. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_CreateClonedEvent(const ArkUI_UIInputEvent* event, ArkUI_UIInputEvent** clonedEvent); + +/** + * @brief Destroys a cloned event pointer. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_DestroyClonedEvent(const ArkUI_UIInputEvent* event); + +/** + * @brief Sets the X and Y coordinates of a cloned event relative to the upper left corner of the current component. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param x X coordinate of the event relative to the upper left corner of the current component. + * @param y Y coordinate of the event relative to the upper left corner of the current component. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPosition(const ArkUI_UIInputEvent* event, float x, float y); + +/** + * @brief Sets the X and Y coordinates of a specific contact point of a cloned event relative to the upper left corner + * of the current component. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param x X coordinate of the event relative to the upper left corner of the current component. + * @param y Y coordinate of the event relative to the upper left corner of the current component. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventLocalPositionByIndex( + const ArkUI_UIInputEvent* event, float x, float y, int32_t pointerIndex); + +/** + * @brief Sets the action type of a cloned event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param actionType Action type of the cloned event. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventActionType(const ArkUI_UIInputEvent* event, int32_t actionType); + +/** + * @brief Sets the touch point ID of a cloned pointer event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param fingerId ID of the touch point that triggers the event. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventChangedFingerId(const ArkUI_UIInputEvent* event, int32_t fingerId); + +/** + * @brief Sets the touch point ID of a specific contact point of a cloned event. + * + * @param event Pointer to an ArkUI_UIInputEvent object. + * @param fingerId Touch point ID of the specific contact point. + * @param pointerIndex Index of the target touch point in the multi-touch data list. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_SetClonedEventFingerIdByIndex( + const ArkUI_UIInputEvent* event, int32_t fingerId, int32_t pointerIndex); + +/** + * @brief Posts a cloned event to a specific node. + * + * @param node Target node. + * @param event Pointer to an ArkUI_UIInputEvent object. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * Returns {@link ARKUI_ERROR_CODE_NON_CLONED_POINTER_EVENT} if the input event pointer is not a + * cloned event pointer. + * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_COMPONENT_STATUS_ABNORMAL} + * if the component status abnormal. + * Returns {@link ARKUI_ERROR_CODE_POST_CLONED_NO_COMPONENT_HIT_TO_RESPOND_TO_THE_EVENT} + * if no component hit to response to the event. + * @since 15 + */ +int32_t OH_ArkUI_PointerEvent_PostClonedEvent(ArkUI_NodeHandle node, const ArkUI_UIInputEvent* event); + #ifdef __cplusplus }; #endif diff --git a/arkui/display_manager/BUILD.gn b/arkui/display_manager/BUILD.gn index bfdc284acda20515b269782ea6ddcaebf769b548..ba052e0a375ab34f32e1e43c3952fcf931ad1bd3 100644 --- a/arkui/display_manager/BUILD.gn +++ b/arkui/display_manager/BUILD.gn @@ -17,6 +17,7 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("display_manager_header") { dest_dir = "$ndk_headers_out_dir/window_manager" sources = [ + "oh_display_capture.h", "oh_display_info.h", "oh_display_manager.h", ] @@ -28,6 +29,7 @@ ohos_ndk_library("native_display_manager") { ndk_description_file = "./libdm.ndk.json" system_capability = "SystemCapability.Window.SessionManager" system_capability_headers = [ + "oh_display_capture.h", "oh_display_info.h", "oh_display_manager.h", ] diff --git a/arkui/display_manager/libdm.ndk.json b/arkui/display_manager/libdm.ndk.json index 5efd5356188e93a41c7d2873114918b8a8747932..c86ff6a93d8d24d1d5f2f63ebdd5d8da7feca174 100644 --- a/arkui/display_manager/libdm.ndk.json +++ b/arkui/display_manager/libdm.ndk.json @@ -78,5 +78,29 @@ { "first_instroduced":"12", "name":"OH_NativeDisplayManager_UnregisterDisplayChangeListener" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_CreatePrimaryDisplay" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_CreateDisplayById" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_DestroyDisplay" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_CreateAllDisplays" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_DestroyAllDisplays" + }, + { + "first_instroduced":"14", + "name":"OH_NativeDisplayManager_CaptureScreenPixelmap" } ] \ No newline at end of file diff --git a/arkui/display_manager/oh_display_capture.h b/arkui/display_manager/oh_display_capture.h new file mode 100644 index 0000000000000000000000000000000000000000..0e150db686cd5c4cf64fb5b12b8904352725c7ff --- /dev/null +++ b/arkui/display_manager/oh_display_capture.h @@ -0,0 +1,70 @@ +/* + * 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 OH_DisplayCapture + * @{ + * + * @brief Defines the data structures for the C APIs of the display module. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 14 + * @version 1.0 + */ + +/** + * @file oh_display_capture.h + * + * @brief Defines the data structures for the C APIs of the display capture. + * + * @kit ArkUI + * @library libnative_display_manager.so + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 14 + * @version 1.0 + */ + +#ifndef OH_NATIVE_DISPLAY_CAPTURE_H +#define OH_NATIVE_DISPLAY_CAPTURE_H + +#include "multimedia/image_framework/image/pixelmap_native.h" +#include "oh_display_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Capture a screen pixelmap of the specified display. + * + * @permission {@code ohos.permission.CUSTOM_SCREEN_CAPTURE} + * @param displayId The ID of the display to be captured. + * @param pixelMap The output pixel map of the captured display. + * @return { @link DISPLAY_MANAGER_OK } If the operation is successful. + * { @link DISPLAY_MANAGER_ERROR_NO_PERMISSION } If no permission. + * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. + * { @link DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED } If device not support. + * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CaptureScreenPixelmap(uint32_t displayId, + OH_PixelmapNative **pixelMap); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // OH_NATIVE_DISPLAY_CAPTURE_H diff --git a/arkui/display_manager/oh_display_info.h b/arkui/display_manager/oh_display_info.h index 3b61758845a8af4f163934a599c10274284c99c8..82b38a098a0f8cb1d432206cead97a07f1bbaa4a 100644 --- a/arkui/display_manager/oh_display_info.h +++ b/arkui/display_manager/oh_display_info.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_NATIVE_DISPLAY_INFO_H -#define OH_NATIVE_DISPLAY_INFO_H - /** * @addtogroup OH_DisplayInfo * @{ @@ -39,12 +36,23 @@ * @version 1.0 */ + +#ifndef OH_NATIVE_DISPLAY_INFO_H +#define OH_NATIVE_DISPLAY_INFO_H + + #include "stdint.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief display name length + * @since 14 + */ +#define OH_DISPLAY_NAME_LENGTH 32 + /** * @brief Enumerates rotations. * @@ -197,6 +205,145 @@ typedef struct { NativeDisplayManager_WaterfallDisplayAreaRects waterfallDisplayAreaRects; } NativeDisplayManager_CutoutInfo; +/** + * @brief Enumerates of the display state. + * + * @since 14 + * @version 1.0 + */ +typedef enum { + /** display state unknown */ + DISPLAY_MANAGER_DISPLAY_STATE_UNKNOWN = 0, + + /** display state off */ + DISPLAY_MANAGER_DISPLAY_STATE_OFF = 1, + + /** display state on */ + DISPLAY_MANAGER_DISPLAY_STATE_ON = 2, + + /** display state doze */ + DISPLAY_MANAGER_DISPLAY_STATE_DOZE = 3, + + /** display state doze suspend */ + DISPLAY_MANAGER_DISPLAY_STATE_DOZE_SUSPEND = 4, + + /** display state vr */ + DISPLAY_MANAGER_DISPLAY_STATE_VR = 5, + + /** display state on suspend */ + DISPLAY_MANAGER_DISPLAY_STATE_ON_SUSPEND = 6, +} NativeDisplayManager_DisplayState; + +/** + * @brief Defines the display hdr structure. + * + * @since 14 + * @version 1.0 + */ +typedef struct { + /** hdrFormat length */ + uint32_t hdrFormatLength; + + /** hdrFormat pointer */ + uint32_t *hdrFormats; +} NativeDisplayManager_DisplayHdrFormat; + +/** + * @brief Defines the display color space structure. + * + * @since 14 + * @version 1.0 + */ +typedef struct { + /** color space length */ + uint32_t colorSpaceLength; + + /** color space pointer */ + uint32_t *colorSpaces; +} NativeDisplayManager_DisplayColorSpace; + +/** + * @brief Defines the display structure. + * + * @since 14 + * @version 1.0 + */ +typedef struct { + /** display id */ + uint32_t id; + + /** display name */ + char name[OH_DISPLAY_NAME_LENGTH + 1]; + + /** display is alive */ + bool isAlive; + + /** display width */ + int32_t width; + + /** display height */ + int32_t height; + + /** display physical width */ + int32_t physicalWidth; + + /** display physical height */ + int32_t physicalHeight; + + /** display refresh rate */ + uint32_t refreshRate; + + /** display available width */ + uint32_t availableWidth; + + /** display available height */ + uint32_t availableHeight; + + /** display density dpi */ + float densityDPI; + + /** display density pixels */ + float densityPixels; + + /** display scale density */ + float scaledDensity; + + /** display xdpi*/ + float xDPI; + + /** display ydpi */ + float yDPI; + + /** display rotation */ + NativeDisplayManager_Rotation rotation; + + /** display state */ + NativeDisplayManager_DisplayState state; + + /** display orientation */ + NativeDisplayManager_Orientation orientation; + + /** display hdr format */ + NativeDisplayManager_DisplayHdrFormat *hdrFormat; + + /** display color space */ + NativeDisplayManager_DisplayColorSpace *colorSpace; +} NativeDisplayManager_DisplayInfo; + +/** + * @brief Defines the displays structure. + * + * @since 14 + * @version 1.0 + */ +typedef struct { + /** displays length */ + uint32_t displaysLength; + + /** displays pointer */ + NativeDisplayManager_DisplayInfo *displaysInfo; +} NativeDisplayManager_DisplaysInfo; + #ifdef __cplusplus } #endif diff --git a/arkui/display_manager/oh_display_manager.h b/arkui/display_manager/oh_display_manager.h index a3b9f3444d7d260e3468ad680c15a941ebf3dc60..7f8e45c2b2c36a941c732a87c3a013c50db0eea8 100644 --- a/arkui/display_manager/oh_display_manager.h +++ b/arkui/display_manager/oh_display_manager.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_NATIVE_DISPLAY_MANAGER_H -#define OH_NATIVE_DISPLAY_MANAGER_H - /** * @addtogroup OH_DisplayManager * @{ @@ -33,12 +30,16 @@ * @brief Defines the data structures for the C APIs of the display module. * * @kit ArkUI - * @library libnative_display_manager.so. + * @library libnative_display_manager.so * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 12 * @version 1.0 */ +#ifndef OH_NATIVE_DISPLAY_MANAGER_H +#define OH_NATIVE_DISPLAY_MANAGER_H + + #include "oh_display_info.h" #ifdef __cplusplus @@ -48,7 +49,7 @@ extern "C" { /** * @brief Obtain the default display Id. * - * @param { *displayId } Indicates the pointer to an uint64_t object. + * @param displayId Indicates the pointer to an uint64_t object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -60,7 +61,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayId(uint6 /** * @brief Obtain the default display width. * - * @param { *displayWidth } Indicates the pointer to an int32_t object. + * @param displayWidth Indicates the pointer to an int32_t object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -72,7 +73,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayWidth(in /** * @brief Obtain the default display height. * - * @param { *displayHeight } Indicates the pointer to an int32_t object. + * @param displayHeight Indicates the pointer to an int32_t object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -84,7 +85,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayHeight(i /** * @brief Obtain the default display rotation. * - * @param { *displayRotation } Indicates the pointer to an NativeDisplayManager_Rotation object. + * @param displayRotation Indicates the pointer to an NativeDisplayManager_Rotation object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -97,7 +98,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRotation /** * @brief Obtain the default display orientation. * - * @param { *displayOrientation } Indicates the pointer to an NativeDisplayManager_Orientation object. + * @param displayOrientation Indicates the pointer to an NativeDisplayManager_Orientation object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -110,7 +111,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayOrientat /** * @brief Obtain the default display virtualPixels. * - * @param { *virtualPixels } Indicates the pointer to an float object. + * @param virtualPixels Indicates the pointer to an float object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -122,7 +123,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayVirtualP /** * @brief Obtain the default display refreshRate. * - * @param { *refreshRate } Indicates the pointer to an uint32_t object. + * @param refreshRate Indicates the pointer to an uint32_t object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -134,7 +135,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayRefreshR /** * @brief Obtain the default display densityDpi. * - * @param { *densityDpi } Indicates the pointer to an int32_t object. + * @param densityDpi Indicates the pointer to an int32_t object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -146,7 +147,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityD /** * @brief Obtain the default display densityPixels. * - * @param { *densityPixels } Indicates the pointer to an float object. + * @param densityPixels Indicates the pointer to an float object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -158,7 +159,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityP /** * @brief Obtain the default display scaledDensity. * - * @param { *scaledDensity } Indicates the pointer to an float object. + * @param scaledDensity Indicates the pointer to an float object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -170,7 +171,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayScaledDe /** * @brief Obtain the default display xDpi. * - * @param { *xDpi } Indicates the pointer to an float object. + * @param xDpi Indicates the pointer to an float object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -182,7 +183,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityX /** * @brief Obtain the default display yDpi. * - * @param { *yDpi } Indicates the pointer to an float object. + * @param yDpi Indicates the pointer to an float object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -194,7 +195,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetDefaultDisplayDensityY /** * @brief Create the cutout info of the device. * - * @param { **cutoutInfo } Indicates the pointer to an NativeDisplayManager_CutoutInfo object. + * @param cutoutInfo Indicates the pointer to an NativeDisplayManager_CutoutInfo object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -207,7 +208,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDefaultDisplayCutou /** * @brief Destroy an NativeDisplayManager_CutoutInfo object and reclaims the memory occupied by the object. * - * @param { **cutoutInfo } Indicates the pointer to an NativeDisplayManager_CutoutInfo object. + * @param cutoutInfo Indicates the pointer to an NativeDisplayManager_CutoutInfo object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * @syscap SystemCapability.WindowManager.WindowManager.Core @@ -228,7 +229,7 @@ bool OH_NativeDisplayManager_IsFoldable(); /** * @brief Get the display mode of the foldable device. * - * @param { *displayMode } Indicates the pointer to an NativeDisplayManager_FoldDisplayMode object. + * @param displayMode Indicates the pointer to an NativeDisplayManager_FoldDisplayMode object. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED } device not support. @@ -241,7 +242,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_GetFoldDisplayMode( /** * @brief the callback function type when display change. * - * @param { *displayId } change display id. + * @param displayId change display id. * @syscap SystemCapability.Window.SessionManager * @since 12 */ @@ -250,8 +251,8 @@ typedef void (*OH_NativeDisplayManager_DisplayChangeCallback)(uint64_t displayId /** * @brief Register the callback for display change listener. * - * @param { displayChangeCallback } display change callback. - * @param { *listenerIndex } Indicates the pointer to an uint32_t object. used in unregister call. + * @param displayChangeCallback display change callback. + * @param listenerIndex Indicates the pointer to an uint32_t object. used in unregister call. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -264,7 +265,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterDisplayChangeList /** * @brief Unregister the callback for display changes listener. * - * @param { listenerIndex } display changed listener index. + * @param listenerIndex display changed listener index. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. @@ -276,7 +277,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterDisplayChangeLi /** * @brief the callback function type when display fold change. * - * @param { displayMode } current fold display mode. + * @param displayMode current fold display mode. * @syscap SystemCapability.Window.SessionManager * @since 12 */ @@ -286,8 +287,8 @@ typedef void (*OH_NativeDisplayManager_FoldDisplayModeChangeCallback)( /** * @brief Register the callback for display mode change listener. * - * @param { displayModeChangeCallback } display mode change callback. - * @param { *listenerIndex } Indicates the pointer to an uint32_t object. used in unregister call. + * @param displayModeChangeCallback display mode change callback. + * @param listenerIndex Indicates the pointer to an uint32_t object. used in unregister call. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED } device not support. @@ -301,7 +302,7 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeCh /** * @brief Unregister the callback for display mode change listener. * - * @param { listenerIndex } display mode change listener index. + * @param listenerIndex display mode change listener index. * @return { @link DISPLAY_MANAGER_OK } If the operation is successful * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. * { @link DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED } device not support. @@ -311,6 +312,64 @@ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_RegisterFoldDisplayModeCh */ NativeDisplayManager_ErrorCode OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener(uint32_t listenerIndex); +/** + * @brief Create all displays. + * + * @param allDisplays Output parameter for all displays information. + * @return { @link DISPLAY_MANAGER_OK } If the operation is successful. + * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. + * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateAllDisplays( + NativeDisplayManager_DisplaysInfo **allDisplays); + +/** + * @brief Destroy all displays. + * + * @param allDisplays all displays to be free. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +void OH_NativeDisplayManager_DestroyAllDisplays(NativeDisplayManager_DisplaysInfo *allDisplays); + +/** + * @brief Create display information by display id. + * + * @param displayId The display id. + * @param displayInfo The pointer to the display information. + * @return { @link DISPLAY_MANAGER_OK } If the operation is successful. + * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. + * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreateDisplayById(uint32_t displayId, + NativeDisplayManager_DisplayInfo **displayInfo); + +/** + * @brief Destroy the display information. + * + * @param displayInfo the target display to be free. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +void OH_NativeDisplayManager_DestroyDisplay(NativeDisplayManager_DisplayInfo *displayInfo); + +/** + * @brief Create a primary display. + * + * @param displayInfo The information of the created display. + * @return { @link DISPLAY_MANAGER_OK } If the operation is successful. + * { @link DISPLAY_MANAGER_ERROR_INVALID_PARAM } If Parameter error. + * { @link DISPLAY_MANAGER_ERROR_SYSTEM_ABNORMAL } If display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager.Core + * @since 14 + */ +NativeDisplayManager_ErrorCode OH_NativeDisplayManager_CreatePrimaryDisplay( + NativeDisplayManager_DisplayInfo **displayInfo); + #ifdef __cplusplus } #endif diff --git a/arkui/napi/common.h b/arkui/napi/common.h index e5e5c8d5e219b6dd8929c702c469186742d31c7d..50f8ee3279e2d1cd3471a51b09f2eac5fb6f4adc 100644 --- a/arkui/napi/common.h +++ b/arkui/napi/common.h @@ -13,6 +13,28 @@ * limitations under the License. */ +/** + * @addtogroup ArkTS_Napi_NativeModule + * @{ + * + * + * @brief Provides native api of ArkTS native module. + * + * @since 10 + */ + +/** + * @file common.h + * + * @brief Defines common enum types of ArkTS native module. + * + * @kit ArkTS + * @library libace_napi.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Napi + * @since 10 + * @version 1.0 + */ + #ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H #define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_COMMON_H @@ -67,4 +89,5 @@ typedef enum { napi_priority_idle = 3, } napi_task_priority; -#endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */ \ No newline at end of file +/** @} */ +#endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */ diff --git a/arkui/napi/libnapi.ndk.json b/arkui/napi/libnapi.ndk.json index c63dfda6babfcb6d8311cf33a593d0cc659c7e88..04e3cc6d4824ab762c9ae1baddff5036dff0d61b 100644 --- a/arkui/napi/libnapi.ndk.json +++ b/arkui/napi/libnapi.ndk.json @@ -238,5 +238,9 @@ { "first_introduced": "12", "name": "napi_fatal_exception" + }, + { + "first_introduced": "18", + "name": "napi_wrap_enhance" } ] diff --git a/arkui/napi/native_api.h b/arkui/napi/native_api.h index a45ce8476fc01722462abbd8444fdf8bdbcd1433..c1dd962f8acbcc1955df6dfd7c64abaf9a727415 100644 --- a/arkui/napi/native_api.h +++ b/arkui/napi/native_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -13,35 +13,56 @@ * limitations under the License. */ +/** + * @addtogroup ArkTS_Napi_NativeModule + * @{ + * + * + * @brief Provides native api of ArkTS native module. + * + * @since 10 + */ + +/** + * @file native_api.h + * + * @brief Defines native api of ArkTS native module. + * + * @kit ArkTS + * @library libace_napi.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Napi + * @since 10 + * @version 1.0 + */ + #ifndef FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H #define FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H #ifndef NAPI_VERSION #define NAPI_VERSION 8 -#endif +#endif // NAPI_VERSION #ifndef NAPI_EXPERIMENTAL #define NAPI_EXPERIMENTAL -#endif +#endif // NAPI_EXPERIMENTAL #include "common.h" #include "node_api.h" #ifdef NAPI_TEST -#ifdef _WIN32 +#ifdef _WIN32 // WIN32 #define NAPI_INNER_EXTERN __declspec(dllexport) -#else +#else // NON-WIN32 #define NAPI_INNER_EXTERN __attribute__((visibility("default"))) -#endif -#else +#endif // _WIN32 + +#else // NAPI_TEST #ifdef _WIN32 #define NAPI_INNER_EXTERN __declspec(deprecated) #else #define NAPI_INNER_EXTERN __attribute__((__deprecated__)) +#endif // __WIN32 #endif -#endif - -NAPI_EXTERN napi_status napi_fatal_exception(napi_env env, napi_value err); NAPI_EXTERN napi_status napi_create_string_utf16(napi_env env, const char16_t* str, @@ -67,21 +88,21 @@ NAPI_INNER_EXTERN napi_status napi_adjust_external_memory(napi_env env, int64_t change_in_bytes, int64_t* adjusted_value); - #ifdef __cplusplus extern "C" { #endif /** * @brief Native detach callback of napi_coerce_to_native_binding_object that can be used to - * detach the js object and the native object. + * detach the ArkTS object and the native object. * * @since 11 */ typedef void* (*napi_native_binding_detach_callback)(napi_env env, void* native_object, void* hint); + /** * @brief Native attach callback of napi_coerce_to_native_binding_object that can be used to - * bind the js object and the native object. + * bind the ArkTS object and the native object. * * @since 11 */ @@ -89,68 +110,218 @@ typedef napi_value (*napi_native_binding_attach_callback)(napi_env env, void* na NAPI_EXTERN napi_status napi_run_script_path(napi_env env, const char* path, napi_value* result); NAPI_EXTERN napi_status napi_queue_async_work_with_qos(napi_env env, napi_async_work work, napi_qos_t qos); -NAPI_EXTERN napi_status napi_load_module(napi_env env, const char* path, napi_value* result); /** - * @brief The module is loaded through the NAPI. By default, the default object is exported from the module. + * @brief Loads an .abc file as a module. This API returns the namespace of the module. + * @param env Current running virtual machine context. + * @param path Path of the .abc file or name of the module to load. + * @param result Result of the module object. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_load_module(napi_env env, + const char* path, + napi_value* result); + +/** + * @brief Associates data with the currently running environment. * * @param env Current running virtual machine context. - * @param path Path name of the module to be loaded, like @ohos.hilog. - * @param module_info Path names of bundle and module, like com.example.application/entry. - * @param result Result of loading a module, which is an exported object of the module. + * @param data Data item to bind with the 'env'. + * @param finalize_cb Optional native callback that will be triggered when 'env' is destroyed or this interface + * repeatedly calls. + * @param finalize_hint Optional contextual hint that is passed to the finalize callback. + * * @return Returns the function execution status. - * @since 12 -*/ -NAPI_EXTERN napi_status napi_load_module_with_info(napi_env env, - const char* path, - const char* module_info, - napi_value* result); -NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, void** data); + * @since 11 + */ NAPI_EXTERN napi_status napi_set_instance_data(napi_env env, void* data, napi_finalize finalize_cb, void* finalize_hint); -NAPI_EXTERN napi_status napi_remove_env_cleanup_hook(napi_env env, void (*fun)(void* arg), void* arg); -NAPI_EXTERN napi_status napi_add_env_cleanup_hook(napi_env env, void (*fun)(void* arg), void* arg); -NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle); + +/** + * @brief Retrieves the data that was previously associated with the currently running environment. + * + * @param env Current running virtual machine context. + * @param data Data item is bound with the 'env'. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_get_instance_data(napi_env env, + void** data); + +/** + * @brief Registers a clean-up hook for releasing resources when the environment exits. + * + * @param env Current running virtual machine context. + * @param fun Function pointer which will be triggered when environment is destroy. + * @param arg The argument is passed to the function pointer 'fun'. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_add_env_cleanup_hook(napi_env env, + void (*fun)(void* arg), + void* arg); + +/** + * @brief Unregisters the clean-up hook. + * + * @param env Current running virtual machine context. + * @param fun Function pointer which will be triggered when environment is destroy. + * @param arg The argument is passed to the function pointer 'fun'. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_remove_env_cleanup_hook(napi_env env, + void (*fun)(void* arg), + void* arg); + +/** + * @brief Registers an asynchronous clean-up hook for releasing resources when the environment exits. + * + * @param env Current running virtual machine context. + * @param hook The function pointer to call at environment teardown. + * @param arg The pointer to pass to `hook` when it gets called. + * @param remove_handle Optional handle that refers to the asynchronous cleanup. + * + * @return Returns the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_add_async_cleanup_hook(napi_env env, napi_async_cleanup_hook hook, void* arg, napi_async_cleanup_hook_handle* remove_handle); -NAPI_EXTERN napi_status napi_async_destroy(napi_env env, - napi_async_context async_context); + +/** + * @brief Unregisters the asynchronous clean-up hook. + * + * @param remove_handle Optional handle that refers to the asynchronous cleanup. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle); + +/** + * @brief Creates an asynchronous context. The capabilities related to 'async_hook' are not supported currently. + * + * @param env Current running virtual machine context. + * @param async_resource Object associated with the async work that will be passed to possible 'async_hook'. + * @param async_resource_name Identifier for the kind of resource that is being provided for diagnostic information + * exposed by the async_hooks API. + * @param result The initialized async context. + * + * @return Returns the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_async_init(napi_env env, napi_value async_resource, napi_value async_resource_name, napi_async_context* result); -NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, napi_callback_scope scope); + +/** + * @brief Destroys the previously created asynchronous context. The capabilities related to 'async_hook' are not + * supported currently. + * + * @param env Current running virtual machine context. + * @param async_context The async context to be destroyed. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_async_destroy(napi_env env, + napi_async_context async_context); + +/** + * @brief Opens a callback scope. The capabilities related to 'async_hook' are not supported currently. + * @param env Current running virtual machine context. + * @param resource_object The resource object to be passed to possible 'async_hook'. + * @param context The context environment for the async operation. + * @param result The generated callback scope. + * + * @return Returns the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_open_callback_scope(napi_env env, napi_value resource_object, napi_async_context context, napi_callback_scope* result); -NAPI_EXTERN napi_status node_api_get_module_file_name(napi_env env, const char** result); -// Create JSObject with initial properties given by descriptors, note that property key must be String, -// and must can not convert to element_index, also all keys must not duplicate. + +/** + * @brief Closes the callback scope. The capabilities related to 'async_hook' are not supported currently. + * + * @param env Current running virtual machine context. + * @param scope The callback scope to be closed. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env, + napi_callback_scope scope); + +/** + * @brief Obtains the absolute path of the location, from which the addon is loaded. + * + * @param env Current running virtual machine context. + * @param result The absolute path of the location of the loaded addon. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status node_api_get_module_file_name(napi_env env, + const char** result); + +/** + * @brief Create ArkTS Object with initial properties given by descriptors, note that property key must be String, and + * must can not convert to element_index, also all keys must not duplicate. + * + * @param env Current running virtual machine context. + * @param result The created ArkTS object. + * @param property_count Number of the property descriptors. + * @param properties Array of property descriptors which are expected to be applied to the ArkTS object. + * + * @return Returns the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_create_object_with_properties(napi_env env, napi_value* result, size_t property_count, const napi_property_descriptor* properties); -// Create JSObject with initial properties given by keys and values, note that property key must be String, -// and must can not convert to element_index, also all keys must not duplicate. + +/** + * @brief Create ArkTS Object with initial properties given by keys and values, note that property key must be String, + * and must can not convert to element_index, also all keys must not duplicate. + * + * @param env Current running virtual machine context. + * @param result The absolute path of the location of the loaded addon. + * @param property_count Number of the propertied which needs to be applied on the ArkTS object. + * @param keys Array of the keys of the properties. + * @param values Array of the values of the properties. + * + * @return Returns the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_create_object_with_named_properties(napi_env env, napi_value* result, size_t property_count, const char** keys, const napi_value* values); + /** - * @brief This API sets native properties to a object and converts this js object to native binding object. + * @brief This API sets native properties to a object and converts this ArkTS object to native binding object. + * + * @param env Current running virtual machine context. + * @param js_object The JavaScript value to coerce. + * @param detach_cb Native callback that can be used to detach the ArkTS object and the native object. + * @param attach_cb Native callback that can be used to bind the ArkTS object and the native object. + * @param native_object User-provided native instance to pass to thr detach callback and attach callback. + * @param hint Optional hint to pass to the detach callback and attach callback. * - * @param[in] env Current running virtual machine context. - * @param[in] js_object The JavaScript value to coerce. - * @param[in] detach_cb Native callback that can be used to detach the js object and the native object. - * @param[in] attach_cb Native callback that can be used to bind the js object and the native object. - * @param[in] native_object User-provided native instance to pass to thr detach callback and attach callback. - * @param[in] hint Optional hint to pass to the detach callback and attach callback. * @return Return the function execution status. * @since 11 */ @@ -160,16 +331,50 @@ NAPI_EXTERN napi_status napi_coerce_to_native_binding_object(napi_env env, napi_native_binding_attach_callback attach_cb, void* native_object, void* hint); + +/** + * @brief Adds a 'napi_finalize' callback, which will be called when the ArkTS object is garbage-collected. + * + * @param env Current running virtual machine context. + * @param js_object The ArkTS object value. + * @param native_object Native object to bind with the ArkTS object. + * @param finalize_cb Native callback that can be used to free the native object when the ArkTS object is + garbage-collected. + * @param finalize_hint Optional contextual hint that is passed to the finalize callback. + * @param result Optional reference of the ArkTS object. + * + * @return Return the function execution status. + * @since 11 + */ NAPI_EXTERN napi_status napi_add_finalizer(napi_env env, napi_value js_object, void* native_object, napi_finalize finalize_cb, void* finalize_hint, napi_ref* result); + +/** + * @brief The module is loaded through the NAPI. By default, the default object is exported from the module. + * + * @param env Current running virtual machine context. + * @param path Path name of the module to be loaded, like @ohos.hilog. + * @param module_info Path names of bundle and module, like com.example.application/entry. + * @param result Result of loading a module, which is an exported object of the module. + * + * @return Returns the function execution status. + * @since 12 + */ +NAPI_EXTERN napi_status napi_load_module_with_info(napi_env env, + const char* path, + const char* module_info, + napi_value* result); + /** * @brief Create the ark runtime. * * @param env Indicates the ark runtime environment. + * + * @return Return the function execution status. * @since 12 */ NAPI_EXTERN napi_status napi_create_ark_runtime(napi_env* env); @@ -178,23 +383,26 @@ NAPI_EXTERN napi_status napi_create_ark_runtime(napi_env* env); * @brief Destroy the ark runtime. * * @param env Indicates the ark runtime environment. + * + * @return Return the function execution status. * @since 12 */ NAPI_EXTERN napi_status napi_destroy_ark_runtime(napi_env* env); -/* +/** * @brief Defines a sendable class. * - * @param env: The environment that the API is invoked under. - * @param utf8name: Name of the ArkTS constructor function. - * @param length: The length of the utf8name in bytes, or NAPI_AUTO_LENGTH if it is null-terminated. - * @param constructor: Callback function that handles constructing instances of the class. - * @param data: Optional data to be passed to the constructor callback as the data property of the callback info. - * @param property_count: Number of items in the properties array argument. - * @param properties: Array of property descriptors describing static and instance data properties, accessors, and - * methods on the class. See napi_property_descriptor. - * @param parent: A napi_value representing the Superclass. - * @param result: A napi_value representing the constructor function for the class. + * @param env The environment that the API is invoked under. + * @param utf8name Name of the ArkTS constructor function. + * @param length The length of the utf8name in bytes, or NAPI_AUTO_LENGTH if it is null-terminated. + * @param constructor Callback function that handles constructing instances of the class. + * @param data Optional data to be passed to the constructor callback as the data property of the callback info. + * @param property_count Number of items in the properties array argument. + * @param properties Array of property descriptors describing static and instance data properties, accessors, and + * methods on the class. See napi_property_descriptor. + * @param parent A napi_value representing the Superclass. + * @param result A napi_value representing the constructor function for the class. + * * @return Return the function execution status. * @since 12 */ @@ -214,116 +422,178 @@ NAPI_EXTERN napi_status napi_define_sendable_class(napi_env env, * @param env The environment that the API is invoked under. * @param value The napi_value to be checked. * @param result Boolean value that is set to true if napi_value is sendable, false otherwise. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_is_sendable(napi_env env, napi_value value, bool* result); +NAPI_EXTERN napi_status napi_is_sendable(napi_env env, + napi_value value, + bool* result); + /** * @brief Defines a sendable object. * * @param env The environment that the API is invoked under. * @param property_count The count of object properties. * @param properties Object properties. + * @param result The created sendable object. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_create_sendable_object_with_properties(napi_env env, size_t property_count, +NAPI_EXTERN napi_status napi_create_sendable_object_with_properties(napi_env env, + size_t property_count, const napi_property_descriptor* properties, napi_value* result); +/** + * @brief Wraps a native instance in a ArkTS object. + * @param env The environment that the API is invoked under. + * @param js_object The ArkTS object that will be the wrapper for the native object. + * @param native_object The native instance that will be wrapped in the ArkTS object. + * @param finalize_cb Optional native callback that can be used to free the native instance when the ArkTS object + * has been garbage-collected. + * @param async_finalizer A bool value to determine that finalize_cb execute async or not. + * @param finalize_hint Optional contextual hint that is passed to the finalize callback. + * @param native_binding_size The size of native binding. + * @param result Optional reference to the wrapped object. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executedd successfully.\n + * {@link napi_invalid_arg } If the param env, js_object or native_object is nullptr.\n + * {@link napi_object_expected } If the param js_object is not an ArkTS Object or Function.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occured in execution.\n + * @since 18 + */ +NAPI_EXTERN napi_status napi_wrap_enhance(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + bool async_finalizer, + void* finalize_hint, + size_t native_binding_size, + napi_ref* result); + /** * @brief Wraps a native instance in a ArkTS object. * * @param env The environment that the API is invoked under. * @param js_object The ArkTS object that will be the wrapper for the native object. * @param native_object The native instance that will be wrapped in the ArkTS object. - * @param finalize_lib Optional native callback that can be used to free the native instance when the ArkTS object + * @param finalize_cb Optional native callback that can be used to free the native instance when the ArkTS object * has been garbage-collected. * @param finalize_hint Optional contextual hint that is passed to the finalize callback. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_wrap_sendable(napi_env env, napi_value js_object, void* native_object, - napi_finalize finalize_cb, void* finalize_hint); +NAPI_EXTERN napi_status napi_wrap_sendable(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint); + /** * @brief Wraps a native instance in a ArkTS object. * * @param env The environment that the API is invoked under. * @param js_object The ArkTS object that will be the wrapper for the native object. * @param native_object The native instance that will be wrapped in the ArkTS object. - * @param finalize_lib Optional native callback that can be used to free the native instance when the ArkTS object - * has been garbage-collected. + * @param finalize_cb Optional native callback that can be used to free the native instance when the ArkTS object + * has been garbage-collected. * @param finalize_hint Optional contextual hint that is passed to the finalize callback. * @param native_binding_size The size of native binding. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_wrap_sendable_with_size(napi_env env, napi_value js_object, void* native_object, - napi_finalize finalize_cb, void* finalize_hint, +NAPI_EXTERN napi_status napi_wrap_sendable_with_size(napi_env env, + napi_value js_object, + void* native_object, + napi_finalize finalize_cb, + void* finalize_hint, size_t native_binding_size); + /** * @brief Retrieves a native instance that was previously wrapped in a ArkTS object. * * @param env The environment that the API is invoked under. * @param js_object The object associated with the native instance. * @param result Pointer to the wrapped native instance. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_unwrap_sendable(napi_env env, napi_value js_object, void** result); +NAPI_EXTERN napi_status napi_unwrap_sendable(napi_env env, + napi_value js_object, + void** result); + /** * @brief Retrieves a native instance that was previously wrapped in a ArkTS object and removes the wrapping. * * @param env The environment that the API is invoked under. * @param js_object The object associated with the native instance. * @param result Pointer to the wrapped native instance. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_remove_wrap_sendable(napi_env env, napi_value js_object, void** result); -/* +NAPI_EXTERN napi_status napi_remove_wrap_sendable(napi_env env, + napi_value js_object, + void** result); + +/** * @brief Create a sendable array. * - * @param env: The environment that the API is invoked under. - * @param result: A napi_value representing a sendable array. + * @param env The environment that the API is invoked under. + * @param result A napi_value representing a sendable array. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_create_sendable_array(napi_env env, napi_value* result); +NAPI_EXTERN napi_status napi_create_sendable_array(napi_env env, + napi_value* result); -/* +/** * @brief Create a sendable array with length. * - * @param env: The environment that the API is invoked under. - * @param length: The initial length of the sendable array. - * @param result: A napi_value representing a sendable array. + * @param env The environment that the API is invoked under. + * @param length The initial length of the sendable array. + * @param result A napi_value representing a sendable array. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_create_sendable_array_with_length(napi_env env, size_t length, napi_value* result); +NAPI_EXTERN napi_status napi_create_sendable_array_with_length(napi_env env, + size_t length, + napi_value* result); -/* +/** * @brief Create a sendable arraybuffer. * - * @param env: The environment that the API is invoked under. - * @param byte_length: The length in bytes of the sendable arraybuffer to create. - * @param data: Pointer to the underlying byte buffer of the sendable arraybuffer. - * @param result: A napi_value representing a sendable arraybuffer. + * @param env The environment that the API is invoked under. + * @param byte_length The length in bytes of the sendable arraybuffer to create. + * @param data Pointer to the underlying byte buffer of the sendable arraybuffer. + * @param result A napi_value representing a sendable arraybuffer. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_create_sendable_arraybuffer(napi_env env, size_t byte_length, - void** data, napi_value* result); +NAPI_EXTERN napi_status napi_create_sendable_arraybuffer(napi_env env, + size_t byte_length, + void** data, + napi_value* result); -/* +/** * @brief Create a sendable typedarray. * - * @param env: The environment that the API is invoked under. - * @param type: Scalar datatype of the elements within the sendable typedarray. - * @param length: Number of elements in the typedarray. - * @param arraybuffer: Sendable arraybuffer underlying the sendable typedarray. - * @param byte_offset: The byte offset within the sendable arraybuffer from - * which to start projecting the sendable typedarray. - * @param result: A napi_value representing a sendable typedarray. + * @param env The environment that the API is invoked under. + * @param type Scalar datatype of the elements within the sendable typedarray. + * @param length Number of elements in the typedarray. + * @param arraybuffer Sendable arraybuffer underlying the sendable typedarray. + * @param byte_offset The byte offset within the sendable arraybuffer from which to start projecting the + * sendable typedarray. + * @param result A napi_value representing a sendable typedarray. + * * @return Return the function execution status. * @since 12 */ @@ -341,10 +611,12 @@ NAPI_EXTERN napi_status napi_create_sendable_typedarray(napi_env env, * * @param env Current running virtual machine context. * @param mode Indicates the running mode of the native event loop. + * * @return Return the function execution status. * @since 12 */ -NAPI_EXTERN napi_status napi_run_event_loop(napi_env env, napi_event_mode mode); +NAPI_EXTERN napi_status napi_run_event_loop(napi_env env, + napi_event_mode mode); /** * @brief Stop the event loop in current thread. @@ -352,22 +624,24 @@ NAPI_EXTERN napi_status napi_run_event_loop(napi_env env, napi_event_mode mode); * Support to stop the running event loop in current native thread. * * @param env Current running virtual machine context. + * * @return Return the function execution status. * @since 12 */ NAPI_EXTERN napi_status napi_stop_event_loop(napi_env env); /** - * @brief Serialize a JS object. + * @brief Serialize a ArkTS object. * * @param env Current running virtual machine context. - * @param object The JavaScript value to serialize. + * @param object The ArkTS object to serialize. * @param transfer_list List of data to transfer in transfer mode. * @param clone_list List of Sendable data to transfer in clone mode. - * @param result Serialization result of the JS object. + * @param result Serialization result of the ArkTS object. + * * @return Returns the function execution status. * @since 12 -*/ + */ NAPI_EXTERN napi_status napi_serialize(napi_env env, napi_value object, napi_value transfer_list, @@ -380,20 +654,25 @@ NAPI_EXTERN napi_status napi_serialize(napi_env env, * @param env Current running virtual machine context. * @param buffer Data to deserialize. * @param object ArkTS object obtained by deserialization. + * * @return Returns the function execution status. * @since 12 -*/ -NAPI_EXTERN napi_status napi_deserialize(napi_env env, void* buffer, napi_value* object); + */ +NAPI_EXTERN napi_status napi_deserialize(napi_env env, + void* buffer, + napi_value* object); /** * @brief Delete serialization data. * * @param env Current running virtual machine context. * @param buffer Data to delete. + * * @return Returns the function execution status. * @since 12 -*/ -NAPI_EXTERN napi_status napi_delete_serialization_data(napi_env env, void* buffer); + */ +NAPI_EXTERN napi_status napi_delete_serialization_data(napi_env env, + void* buffer); /** * @brief Dispatch a task with specified priority from a native thread to an ArkTS thread, the task will execute @@ -405,6 +684,7 @@ NAPI_EXTERN napi_status napi_delete_serialization_data(napi_env env, void* buffe * @param isTail Indicates the way of the task dispatched into the native event queue. When "isTail" is true, * the task will be dispatched to the tail of the native event queue. Conversely, when "isTail" is false, the * tasks will be dispatched to the head of the native event queue. + * * @return Return the function execution status. * @since 12 */ @@ -412,7 +692,955 @@ NAPI_EXTERN napi_status napi_call_threadsafe_function_with_priority(napi_threads void *data, napi_task_priority priority, bool isTail); + +/** + * @brief Throws UncaughtException to ArkTS. + * @param env Current running virtual machine context. + * @param err Error object which is passed to 'UncaughtException'. + * + * @return Returns the function execution status. + * @since 12 + */ +NAPI_EXTERN napi_status napi_fatal_exception(napi_env env, + napi_value err); + +/** + * @brief Allows a ArkTS function to be called in the asynchronous context. The capabilities related to 'async_hook' + * are not supported currently. + * @param env Current running virtual machine context. + * @param async_context The context environment for the async operation. + * @param recv The 'this' pointer of the function. + * @param func ArkTS function to be called. + * @param argc Size of the argument array which is passed to 'func'. + * @param argv Argument array. + * @param result Result returned by the ArkTS function. + * + * @return Returns the function execution status. + * @since 11 + */ +NAPI_EXTERN napi_status napi_make_callback(napi_env env, + napi_async_context async_context, + napi_value recv, + napi_value func, + size_t argc, + const napi_value* argv, + napi_value* result); + +/** + * @brief Creates an ArkTS ArrayBuffer object of the specified size. + * + * @param env Current running virtual machine context. + * @param length Bytes size of the underlying arraybuffer. + * @param data Raw pointer to the underlying arraybuffer. + * @param result Created ArkTS ArrayBuffer object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, data or result is nullptr, or length is larger than 2097152, + * or length is less than zero.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_buffer(napi_env env, + size_t length, + void** data, + napi_value* result); + +/** + * @brief Creates a deferred object and an ArkTS promise. + * @param env Current running virtual machine context. + * @param deferred The created deferred object which will be passed to 'napi_resolve_deferred()' or + * 'napi_reject_deferred()' to resolve or reject the promise. + * @param promise The ArkTS promise which is associated with the deferred object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, deferred or resolution is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * {@link napi_generic_failure } If create promise failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_promise(napi_env env, + napi_deferred* deferred, + napi_value* promise); + +/** + * @brief Resolves a promise by way of the deferred object associated. + * @param env Current running virtual machine context. + * @param deferred The deferred object which is utilized to resolve the promise. + * @param resolution The resolution value used to resolve the promise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, deferred or resolution is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_resolve_deferred(napi_env env, + napi_deferred deferred, + napi_value resolution); + +/** + * @brief Rejects a promise by way of the deferred object associated. + * @param env Current running virtual machine context. + * @param deferred The deferred object which is utilized to reject the promise. + * @param rejection The rejection value used to reject the promise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, deferred or rejection is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_reject_deferred(napi_env env, + napi_deferred deferred, + napi_value rejection); + +/** + * @brief Checks whether the given 'napi_value' is a promise object. + * @param env Current running virtual machine context. + * @param value The 'napi_value' to be checked. + * @param is_promise Boolean value that is set to true if the 'value' is a promise object, false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or is_promise is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_is_promise(napi_env env, + napi_value value, + bool* is_promise); + +/** + * @brief Obtains the current libuv loop instance. + * @param env Current running virtual machine context. + * @param loop Libuv event loop. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or loop is nullptr.\n + * {@link napi_generic_failure } If env is invalid.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, + struct uv_loop_s** loop); + +/** + * @brief Creates a thread-safe function. + * @param env Current running virtual machine context. + * @param func ArkTS function to be called. + * @param async_resource An optional Object associated with the async work that will be passed to possible + * 'async_hooks'. + * @param async_resource_name An ArkTS string to provide an identifier for the kind of resource that is being + * provided for diagnostic information exposed by the `async_hooks` interface. + * @param max_queue_size Maximum size of the event queue in the thread-safe function. + * @param initial_thread_count Initial thread count of the thread-safe function. + * @param thread_finalize_data Data passed to the finalize callback. + * @param thread_finalize_cb Finalize callback function which will be triggered when the thread-safe function is + * released. + * @param context Optional data is passed to 'call_js_cb'. + * @param call_js_cb Callback function which will be triggered after 'napi_call_threadsafe_function()' is called. + * @param result The created thread-safe function. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, async_resource_name or result is nullptr; max_queue_size is less than 0;\n + * initial_thread_count is greater than 128 or less than 0; func and call_js_cb are\n + * nullptr at same time.\n + * {@link napi_generic_failure } If create thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_threadsafe_function(napi_env env, + napi_value func, + napi_value async_resource, + napi_value async_resource_name, + size_t max_queue_size, + size_t initial_thread_count, + void* thread_finalize_data, + napi_finalize thread_finalize_cb, + void* context, + napi_threadsafe_function_call_js call_js_cb, + napi_threadsafe_function* result); + +/** + * @brief Obtains the context of a thread-safe function. + * @param func The created thread-safe function. + * @param result Pointer pointer to the context of the thread-safe function. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If func or result is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_threadsafe_function_context(napi_threadsafe_function func, + void** result); + +/** + * @brief Calls a thread-safe function. + * @param func The created thread-safe function. + * @param data Data passed to the callback function 'call_js_cb' which is registered by calling + * 'napi_create_threadsafe_function()'. + * @param is_blocking If true, this function blocks until the event queue is not full. If false, return directly. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If func is nullptr.\n + * {@link napi_queue_full } If event queue is full.\n + * {@link napi_closing } If the thread-safe function is closing.\n + * {@link napi_generic_failure } If call thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_call_threadsafe_function(napi_threadsafe_function func, + void* data, + napi_threadsafe_function_call_mode is_blocking); + +/** + * @brief Acquires a thread-safe function. + * @param func The created thread-safe function. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If func is nullptr.\n + * {@link napi_generic_failure } If acquire thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_acquire_threadsafe_function(napi_threadsafe_function func); + +/** + * @brief Releases a thread-safe function. + * @param func The created thread-safe function. + * @param mode Value of mode can be either 'napi_tsfn_release' to indicate that no more calls should be made + * to the thread-safe function from current thread or 'napi_tsfn_abort' to indicate that the queue + * of the thread-safe function will be closed and 'napi_closing' will be return when calling + * 'napi_call_threadsafe_function()' under the circumstance. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If func is nullptr.\n + * {@link napi_generic_failure } If release thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_release_threadsafe_function(napi_threadsafe_function func, + napi_threadsafe_function_release_mode mode); + +/** + * @brief Indicates that the event loop running on the main thread may exit before the thread-safe function + * is destroyed. + * @param env Current running virtual machine context. + * @param func The created thread-safe function. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or func is nullptr.\n + * {@link napi_generic_failure } If unref thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_unref_threadsafe_function(napi_env env, + napi_threadsafe_function func); + +/** + * @brief Indicates that the event loop running on the main thread should not exit until the thread-safe + * function is destroyed. + * @param env Current running virtual machine context. + * @param func The created thread-safe function. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or func is nullptr.\n + * {@link napi_generic_failure } If ref thread-safe function failed.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_ref_threadsafe_function(napi_env env, + napi_threadsafe_function func); + +/** + * @brief Creates an ArkTS 'Date' object from C double data + * @param env Current running virtual machine context. + * @param time ArkTS time value in milliseconds format since 01 January, 1970 UTC. + * @param result Created ArkTS data object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_date(napi_env env, + double time, + napi_value* result); + +/** + * @brief Checks whether the given ArkTS value is a 'Date' object. You can use this API to check the type + * of the parameter passed from ArkTS. + * @param env Current running virtual machine context. + * @param value ArkTS data object. + * @param is_date Boolean value that is set to true if the 'value' is a 'Date' object, false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or is_date is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_is_date(napi_env env, + napi_value value, + bool* is_date); + +/** + * @brief Obtains the C equivalent of the given ArkTS 'Date' object. + * + * @param env Current running virtual machine context. + * @param value ArkTS data object. + * @param result C time value in milliseconds format since 01 January, 1970 UTC. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * {@link napi_date_expected } If the 'value' is not a 'Date' object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_date_value(napi_env env, + napi_value value, + double* result); + +/** + * @brief Creates a ArkTS BigInt from C int64 data. + * + * @param env Current running virtual machine context. + * @param value C int64 data. + * @param result Created ArkTS BigInt object from C int64 data. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_bigint_int64(napi_env env, + int64_t value, + napi_value* result); + +/** + * @brief Creates a ArkTS BigInt from C int64 data. + * + * @param env Current running virtual machine context. + * @param value C int64 data. + * @param result Created ArkTS BigInt object from C int64 data. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_bigint_uint64(napi_env env, + uint64_t value, + napi_value* result); + +/** + * @brief Creates a single ArkTS BigInt from a C uint64 array. + * + * @param env Current running virtual machine context. + * @param sign_bit Sign bit of the BigInt. If sign_bit is 0, the BigInt is positive, otherwise it is negative. + * @param word_count The size of the words array. + * @param words C uint64 array in little-endian 64-bit format. + * @param result Created ArkTS BigInt object from C int64 array. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, words or result is nullptr or word_count is larger than 2147483647.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_bigint_words(napi_env env, + int sign_bit, + size_t word_count, + const uint64_t* words, + napi_value* result); + +/** + * @brief Obtains a signed 64-bit integer from an ArkTS BigInt object. + * + * @param env Current running virtual machine context. + * @param value ArkTS BigInt object. + * @param result Pointer points to the location where store the C signed 64-bit integer value. + * @param lossless Indicates whether the conversion is lossless. If lossless is true, the conversion is lossless, + * false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value, result or lossless is nullptr or word_count is larger than\n + * 2147483647.\n + * {@link napi_bigint_expected } If the 'value' is not an ArkTS bigint object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_value_bigint_int64(napi_env env, + napi_value value, + int64_t* result, + bool* lossless); + +/** + * @brief Obtains an unsigned 64-bit integer from an ArkTS BigInt object. + * + * @param env Current running virtual machine context. + * @param value ArkTS BigInt object. + * @param result Pointer points to the location where store the C unsigned 64-bit integer value. + * @param lossless Indicates whether the conversion is lossless. If lossless is true, the conversion is lossless, + * false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value, result or lossless is nullptr or word_count is larger than\n + * 2147483647.\n + * {@link napi_bigint_expected } If the 'value' is not an ArkTS bigint object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_value_bigint_uint64(napi_env env, + napi_value value, + uint64_t* result, + bool* lossless); + +/** + * @brief Obtains the underlying 64-bit unsigned (uint64) byte data from an ArkTS BigInt object. + * + * @param env Current running virtual machine context. + * @param value ArkTS BigInt object. + * @param sign_bit Sign bit of the BigInt. If sign_bit is 0, the BigInt is positive, otherwise it is negative. + * @param word_count The size of the words array. + * @param words C uint64 array in little-endian 64-bit format. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or word_count is nullptr or word_count is larger than 2147483647.\n + * {@link napi_bigint_expected } If the 'value' is not an ArkTS bigint object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_value_bigint_words(napi_env env, + napi_value value, + int* sign_bit, + size_t* word_count, + uint64_t* words); + +/** + * @brief Creates an ArkTS ArrayBuffer object of the specified size and initializes it with the given data. + * + * @param env Current running virtual machine context.n + * @param length Bytes size of the given data. + * @param data Given data. + * @param finalize_cb Optional native callback that can be used to free the given data when the ArkTS ArrayBuffer + * object has been garbage-collected. + * @param finalize_hint Optional contextual hint that is passed to the finalize callback. + * @param result Created ArkTS ArrayBuffer object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, data or result is nullptr, or length is larger than 2097152, + * or length is less than or equal to zero.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_external_buffer(napi_env env, + size_t length, + void* data, + napi_finalize finalize_cb, + void* finalize_hint, + napi_value* result); + +/** + * @brief Creates an ArkTS ArrayBuffer object of the specified size and initializes it with the given data. + * + * @param env Current running virtual machine context. + * @param length Bytes size of the given data. + * @param data Given data. + * @param result_data Raw pointer to the underlying arraybuffer. + * @param result Created ArkTS ArrayBuffer object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, data or result is nullptr, or length is larger than 2097152, + * or length is less than or equal to zero.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_create_buffer_copy(napi_env env, + size_t length, + const void* data, + void** result_data, + napi_value* result); + +/** + * @brief Checks whether the given ArkTS value is a 'ArrayBuffer' object. + * + * @param env Current running virtual machine context. + * @param value ArkTS ArrayBuffer object. + * @param result Boolean value that is set to true if the 'value' is a 'ArrayBuffer' object, false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_is_buffer(napi_env env, + napi_value value, + bool* result); + +/** + * @brief Obtains the underlying data of 'ArrayBuffer' and its length. + * + * @param env Current running virtual machine context. + * @param value ArkTS ArrayBuffer object. + * @param data Raw pointer to the underlying arraybuffer. + * @param length Bytes size of the underlying arraybuffer. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * {@link napi_arraybuffer_expected } If the 'value' is not an ArkTS array buffer object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_buffer_info(napi_env env, + napi_value value, + void** data, + size_t* length); + +/** + * @brief Freezes an ArkTS object. Once an object is frozen, its properties are immutable. + * + * @param env Current running virtual machine context. + * @param object The given ArkTS object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or object is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_object_freeze(napi_env env, + napi_value object); + +/** + * @brief Seals an ArkTS object. Once an object is sealed, its properties cannot be added or deleted, but property + * values can be modified. + * + * @param env Current running virtual machine context. + * @param object The given ArkTS object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or object is nullptr.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_object_seal(napi_env env, + napi_value object); + +/** + * @brief Detaches the underlying data from an 'ArrayBuffer' object. After the data is detached, you + * can operate the data in C/C++. + * + * @param env Current running virtual machine context. + * @param arraybuffer ArkTS ArrayBuffer object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or arraybuffer is nullptr, if 'arraybuffer' is not an ArrayBuffer object.\n + * {@link napi_object_expected } If the 'arraybuffer' is not an ArkTS object.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env, + napi_value arraybuffer); + +/** + * @brief Checks whether the given 'ArrayBuffer' has been detached. + * + * @param env Current running virtual machine context. + * @param value ArkTS ArrayBuffer object. + * @param result Boolean value that is set to true if the 'value' has been detached, false otherwise. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env, + napi_value value, + bool* result); + +/** + * @brief Obtains the names of all properties of an ArkTS object. + * + * @param env Current running virtual machine context. + * @param object ArkTS object. + * @param key_mode Key collection mode. If key_mode is napi_key_include_prototypes, the result includes properties on + * prototypes. If key_mode is napi_key_own_only, the result includes only properties directly on own + * object. + * @param key_filter Which properties to be collected. + * @param key_conversion Key conversion mode. If key_conversion is napi_key_keep_numbers, the numbered property keys + * will keep number type. If key_conversion is napi_key_numbers_to_strings, the numbered property + * keys will be convert to string type. + * @param result An array of ArkTS object that represent the property names of the object. + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, object or result is nullptr;\n + * key_mode is not enumeration value of napi_key_collection_mode;\n + * key_conversion is not enumeration value of napi_key_conversion.\n + * {@link napi_pending_exception } If a ArkTS exception existed when the function was called.\n + * {@link napi_object_expected } If object is not object type and function type.\n + * @since 10 + */ +NAPI_EXTERN napi_status napi_get_all_property_names(napi_env env, + napi_value object, + napi_key_collection_mode key_mode, + napi_key_filter key_filter, + napi_key_conversion key_conversion, + napi_value* result); + +/** + * @brief Registers a native module. + * + * @param mod Native module of type 'napi_module' to be registered. + * @since 10 +*/ +NAPI_EXTERN void napi_module_register(napi_module* mod); + +/** + * @brief Obtains the napi_extended_error_info struct, which contains the latest error information. + * + * @param env Current running virtual machine context. + * @param result The error info about the error. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_get_last_error_info(napi_env env, + const napi_extended_error_info** result); + +/** + * @brief Throws a ArkTS error. + * @param env Current running virtual machine context. + * @param error The ArkTS error to be thrown. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or error is nullptr, or error is not an error object.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_throw(napi_env env, napi_value error); + +/** + * @brief Throws a ArkTS Error with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg C string representing the text to be associated with the error. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or msg is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_throw_error(napi_env env, + const char* code, + const char* msg); + +/** + * @brief Throws a ArkTS TypeError with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg C string representing the text to be associated with the error. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or msg is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_throw_type_error(napi_env env, + const char* code, + const char* msg); + +/** + * @brief Throws a ArkTS RangeError with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg C string representing the text to be associated with the error. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or msg is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_throw_range_error(napi_env env, + const char* code, + const char* msg); + +/** + * @brief Checks whether a 'napi_value' is an error object. + * @param env Current running virtual machine context. + * @param value The value to check + * @param result Boolean value that is set to true if the value represents an error object, false otherwise. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_is_error(napi_env env, + napi_value value, + bool* result); + +/** + * @brief Creates a ArkTS Error with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg napi_value representing the EcmaScript string to be associated with the error. + * @param result napi_value representing the error created. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, msg or result is nullptr, code is not string and number type or msg is + * not a string type.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_create_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); + +/** + * @brief Creates a ArkTS TypeError with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg napi_value representing the EcmaScript string to be associated with the error. + * @param result napi_value representing the error created. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, msg or result is nullptr, code is not string and number type or msg is + * not a string type.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_create_type_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); + +/** + * @brief Creates a ArkTS RangeError with text information. + * @param env Current running virtual machine context. + * @param code Optional error code to set on the error. + * @param msg napi_value representing the EcmaScript string to be associated with the error. + * @param result napi_value representing the error created. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, msg or result is nullptr, code is not string and number type or msg is + * not a string type.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_create_range_error(napi_env env, + napi_value code, + napi_value msg, + napi_value* result); + +/** + * @brief Checks whether an exception occurs. + * @param env Current running virtual machine context. + * @param result Boolean value that is true if there is a pending exception. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_is_exception_pending(napi_env env, bool* result); + +/** + * @brief Obtains and clears the latest exception. + * @param env Current running virtual machine context. + * @param result The exception if there is a pending exception; otherwise return a null value. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_get_and_clear_last_exception(napi_env env, + napi_value* result); + +/** + * @brief Raises a fatal error to terminate the process immediately. + * @param location Optional location for the error occurrence. + * @param location_len The byte length of the location, or NAPI_AUTO_LENGTH if it is terminated by a null character. + * @param message The message associated with the error. + * @param message_len The byte length of the message, or NAPI_AUTO_LENGTH if it is terminated by a null character. + * + * @since 10 +*/ +NAPI_EXTERN NAPI_NO_RETURN void napi_fatal_error(const char* location, + size_t location_len, + const char* message, + size_t message_len); + +/** + * @brief Opens a scope. + * @param env Current running virtual machine context. + * @param result napi_value representing the new scope. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_open_handle_scope(napi_env env, + napi_handle_scope* result); + +/** + * @brief Closes the scope passed in. After the scope is closed, all references declared in it are closed. + * @param env Current running virtual machine context. + * @param scope The scope to close. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or scope is nullptr.\n + * {@link napi_handle_scope_mismatch } If there is no scope still existed.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_close_handle_scope(napi_env env, + napi_handle_scope scope); + +/** + * @brief Opens an escapable handle scope from which the declared values can be returned to the outer scope. + * @param env Current running virtual machine context. + * @param result The new scope. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_open_escapable_handle_scope(napi_env env, + napi_escapable_handle_scope* result); + +/** + * @brief Closes the escapable handle scope passed in. + * @param env Current running virtual machine context. + * @param scope The scope to close. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or scope is nullptr.\n + * {@link napi_handle_scope_mismatch } If there is no scope still existed.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_close_escapable_handle_scope(napi_env env, + napi_escapable_handle_scope scope); + +/** + * @brief Promotes the handle to the input ArkTS object so that it is valid for the lifespan of its outer scope. + * @param env Current running virtual machine context. + * @param scope Current scope. + * @param escapee The ArkTS object to be escaped. + * @param result The handle to the escaped object in the outer scope. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, scope, escapee or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_escape_handle(napi_env env, + napi_escapable_handle_scope scope, + napi_value escapee, + napi_value* result); + +/** + * @brief Creates a reference for an object to extend its lifespan. The caller needs to manage the reference lifespan. + * @param env Current running virtual machine context. + * @param value The napi_value that is being referenced. + * @param initial_refcount The initial count for the new reference. + * @param result napi_ref pointing to the new reference. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, value or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_create_reference(napi_env env, + napi_value value, + uint32_t initial_refcount, + napi_ref* result); + +/** + * @brief Deletes the reference passed in. + * @param env Current running virtual machine context. + * @param ref The napi_ref to be deleted. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or ref is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_delete_reference(napi_env env, napi_ref ref); + +/** + * @brief Increments the reference count for the reference passed in and returns the count. + * @param env Current running virtual machine context. + * @param ref The napi_ref whose reference count will be incremented. + * @param result The new reference count. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or ref is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_reference_ref(napi_env env, + napi_ref ref, + uint32_t* result); + +/** + * @brief Decrements the reference count for the reference passed in and returns the count. + * @param env Current running virtual machine context. + * @param ref The napi_ref whose reference count will be decremented. + * @param result The new reference count. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env or ref is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_reference_unref(napi_env env, + napi_ref ref, + uint32_t* result); + +/** + * @brief Obtains the ArkTS Object associated with the reference. + * @param env Current running virtual machine context. + * @param ref The napi_ref of the value being requested. + * @param result The napi_value referenced by the napi_ref. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If env, ref or result is nullptr.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_get_reference_value(napi_env env, + napi_ref ref, + napi_value* result); + +/** + * @brief Check if the given ArkTS Object has the named own property or not. + * @param env Current running virtual machine context. + * @param object The ArkTS object. + * @param key The name of the property to check. + * @param result Whether the own property exists on the object or not. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n + * {@link napi_invalid_arg } If the param env, object, key and(or) result is nullptr.\n + * {@link napi_object_expected } If the param object is not an ArkTS Object.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_has_own_property(napi_env env, + napi_value object, + napi_value key, + bool* result); + +/** + * @brief Defines an ArkTS class, including constructor function and properties. + * @param env Current running virtual machine context. + * @param utf8name Name of the ArkTS constructor function. + * @param length The length of the utf8name in bytes, or NAPI_AUTO_LENGTH if it is null-terminated. + * @param constructor Callback function that handles constructing instances of the class. + * @param data Optional data to be passed to the constructor callback as the data property of the callback info. + * @param property_count Number of items in the properties array argument. + * @param properties Array of property descriptors. + * @param result A napi_value representing the constructor function for the class. + * + * @return Returns the function execution status. + * {@link napi_ok } If the function executed successfully.\n execution.\n + * {@link napi_invalid_arg } If the param env, utf8name and(or) result is nullptr. If napi_property_descriptor + * is nullptr but property_count greater than 0.\n + * {@link napi_function_expected } If the param func is not an ArkTS Function.\n + * {@link napi_pending_exception } If have uncaught exception, or exception occurs in execution.\n + * @since 10 +*/ +NAPI_EXTERN napi_status napi_define_class(napi_env env, + const char* utf8name, + size_t length, + napi_callback constructor, + void* data, + size_t property_count, + const napi_property_descriptor* properties, + napi_value* result); #ifdef __cplusplus } #endif +/** @} */ #endif /* FOUNDATION_ACE_NAPI_INTERFACES_KITS_NAPI_NATIVE_API_H */ diff --git a/arkui/window_manager/BUILD.gn b/arkui/window_manager/BUILD.gn index fa532b65017def139d685eae756b4726a29973d6..b06760b56a14bb48a868a75b3480c241c5af6322 100644 --- a/arkui/window_manager/BUILD.gn +++ b/arkui/window_manager/BUILD.gn @@ -21,6 +21,7 @@ ohos_ndk_library("native_window_manager") { output_extension = "so" system_capability = "SystemCapability.Window.SessionManager" system_capability_headers = [ + "oh_window.h", "oh_window_comm.h", "oh_window_event_filter.h", ] @@ -29,6 +30,7 @@ ohos_ndk_library("native_window_manager") { ohos_ndk_headers("window_manager_header") { dest_dir = "$ndk_headers_out_dir/window_manager" sources = [ + "oh_window.h", "oh_window_comm.h", "oh_window_event_filter.h", ] diff --git a/arkui/window_manager/libwm.ndk.json b/arkui/window_manager/libwm.ndk.json index 3ed362ce4eab5ea3605853f9a5eded6cca11cc5f..0563eba01b9356a9dfa51d828789fc40b54d268c 100644 --- a/arkui/window_manager/libwm.ndk.json +++ b/arkui/window_manager/libwm.ndk.json @@ -6,5 +6,77 @@ { "first_instroduced":"12", "name":"OH_NativeWindowManager_UnregisterKeyEventFilter" + }, + { + "first_instroduced":"15", + "name":"OH_NativeWindowManager_RegisterMouseEventFilter" + }, + { + "first_instroduced":"15", + "name":"OH_NativeWindowManager_UnregisterMouseEventFilter" + }, + { + "first_instroduced":"15", + "name":"OH_NativeWindowManager_RegisterTouchEventFilter" + }, + { + "first_instroduced":"15", + "name":"OH_NativeWindowManager_UnregisterTouchEventFilter" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_ShowWindow" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_IsWindowShown" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowStatusBarEnabled" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowStatusBarColor" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowNavigationBarEnabled" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_GetWindowAvoidArea" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowBackgroundColor" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowBrightness" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowKeepScreenOn" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowPrivacyMode" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_GetWindowProperties" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_Snapshot" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowTouchable" + }, + { + "first_instroduced":"15", + "name":"OH_WindowManager_SetWindowFocusable" } ] \ No newline at end of file diff --git a/arkui/window_manager/oh_window.h b/arkui/window_manager/oh_window.h new file mode 100644 index 0000000000000000000000000000000000000000..c747b7b2b7b315a4bc747112fb28c1887f7f3c5c --- /dev/null +++ b/arkui/window_manager/oh_window.h @@ -0,0 +1,255 @@ +/* + * 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 WindowManager + * @{ + * + * @brief Provides abilities of window on the native side. + * @since 15 + */ + +/** + * @file oh_window.h + * + * @brief Declares APIs for window + * + * @library libnative_window_manager.so + * @kit ArkUI + * @syscap SystemCapability.Window.SessionManager + * @since 15 + */ +#ifndef OH_WINDOW_H +#define OH_WINDOW_H + +#include "stdbool.h" +#include "stdint.h" + +#include "oh_window_comm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Set whether to show status bar. + * + * @param windowId WindowId when window is created. + * @param enabled If true, the status bar is displayed. If false, the status bar is hidden. + * @param enableAnimation If true, the status bar is displayed and hidden with animation. + * If false, the status bar is displayed and hidden with no animation. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowStatusBarEnabled(int32_t windowId, bool enabled, bool enableAnimation); + +/** + * @brief Set status bar content color. + * + * @param windowId WindowId when window is created. + * @param color The color value to set, the format is ARGB. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowStatusBarColor(int32_t windowId, int32_t color); + +/** + * @brief Set whether to show navigation bar. + * + * @param windowId WindowId when window is created. + * @param enabled If true, the navigation bar is displayed. If false, the navigation bar is hidden. + * @param enableAnimation If true, the navigation bar is displayed and hidden with animation. + * If false, the navigation bar is displayed and hidden with no animation. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED} capability not supported. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowNavigationBarEnabled(int32_t windowId, bool enabled, bool enableAnimation); + +/** + * @brief Get the avoid area + * + * @param windowId WindowId when window is created. + * @param type Type of the avoid area. + * @param avoidArea Indicates the pointer to a WindowManager_AvoidArea object. + * @return Returns the result code. + * {@link OK} the function call is successful, return avoid area ptr in avoidArea. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_GetWindowAvoidArea( + int32_t windowId, WindowManager_AvoidAreaType type, WindowManager_AvoidArea* avoidArea); + +/** + * @brief Checks whether the window is displayed. + * + * @param windowId WindowId when window is created. + * @param isShow Whether the window is displayed. The value true means that the window is displayed, and false means the opposite. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * @since 15 + */ +int32_t OH_WindowManager_IsWindowShown(int32_t windowId, bool* isShow); + +/** + * @brief Show window. + * + * @param windowId WindowId when window is created. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_ShowWindow(int32_t windowId); + +/** + * @brief Set window touchable + * + * @param windowId WindowId when window is created. + * @param isTouchable Indicates whether the specified window can be touched. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowTouchable(int32_t windowId, bool isTouchable); + +/** + * @brief Set focusable property of window. + * + * @param windowId WindowId when window is created. + * @param isFocusable Window can be focused or not. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowFocusable(int32_t windowId, bool isFocusable); + +/** + * @brief Sets the background color of window. + * + * @param windowId WindowId when window is created. + * @param color the specified color. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowBackgroundColor(int32_t windowId, const char* color); + +/** + * @brief Sets the brightness of window. + * + * @param windowId WindowId when window is created. + * @param brightness the specified brightness value. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowBrightness(int32_t windowId, float brightness); + +/** + * @brief Sets whether keep screen on or not. + * + * @param windowId WindowId when window is created. + * @param isKeepScreenOn keep screen on if true, or not if false. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowKeepScreenOn(int32_t windowId, bool isKeepScreenOn); + +/** + * @brief Sets whether is private mode or not. + * + * @permission {@code ohos.permission.PRIVACY_WINDOW} + * @param windowId WindowId when window is created. + * @param isPrivacy In private mode if true, or not if false. + * @return Returns the result code. + * {@link OK} the function call is successful. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * {@link WINDOW_MANAGER_ERRORCODE_NO_PERMISSION} permission verification failed. + * @since 15 + */ +int32_t OH_WindowManager_SetWindowPrivacyMode(int32_t windowId, bool isPrivacy); + +/** + * @brief Get the properties of current window. + * + * @param windowId WindowId when window is created. + * @param windowProperties Properties of current window. + * @return Returns the result code. + * {@link OK} the function call is successful, return window properties ptr in windowProperties. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * @since 15 + */ +int32_t OH_WindowManager_GetWindowProperties( + int32_t windowId, WindowManager_WindowProperties* windowProperties); + +/** + * @brief Obtains snapshot of window. + * + * @param windowId windowId when window is created. + * @param pixelMap snapshot of window. + * @return Returns the result code. + * {@link OK} the function call is successful, return pixel map ptr in pixelMap. + * {@link WINDOW_MANAGER_ERRORCODE_INVALID_PARAM} parameter error. + * {@link WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL} this window state is abnormal. + * {@link WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL} the window manager service works abnormally. + * @since 15 + */ +int32_t OH_WindowManager_Snapshot(int32_t windowId, OH_PixelmapNative* pixelMap); + +#ifdef __cplusplus +} +#endif + +#endif // OH_WINDOW_H +/** @} */ \ No newline at end of file diff --git a/arkui/window_manager/oh_window_comm.h b/arkui/window_manager/oh_window_comm.h index f2e3a08d5dc7915fc08fb7921df516ead2311734..d015371a54cd8ad17a4bebfdeb62bc8d5eb57e4a 100644 --- a/arkui/window_manager/oh_window_comm.h +++ b/arkui/window_manager/oh_window_comm.h @@ -13,13 +13,12 @@ * limitations under the License. */ - /** - * @addtogroup WindowManager_NativeModule + * @addtogroup WindowManager * @{ * * - * @brief Provides abilities of windowManager on the native side, such as key event + * @brief Provides abilities of windowManager on the native side, such as key event * filtration. * * @since 12 @@ -44,6 +43,13 @@ extern "C" { #endif +/** + * @brief The native pixel map information defined by Image Kit. + * + * @since 15 + */ +typedef struct OH_PixelmapNative; + /** * @brief Enumerates the result types of the wm interface * @@ -52,12 +58,142 @@ extern "C" { typedef enum { /** succ. */ OK = 0, + /** + * @error No permission. + * + * @since 15 + */ + WINDOW_MANAGER_ERRORCODE_NO_PERMISSION = 201, + /** + * @error Param is invalid. + * + * @since 15 + */ + WINDOW_MANAGER_ERRORCODE_INVALID_PARAM = 401, + /** + * @error Device not support. + * + * @since 15 + */ + WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED = 801, /** window id is invaild. */ INVAILD_WINDOW_ID = 1000, /** failed. */ SERVICE_ERROR = 2000, + /** + * @error Window state is abnormal. + * + * @since 15 + */ + WINDOW_MANAGER_ERRORCODE_STATE_ABNORMAL = 1300002, + /** + * @error Window manager service works abnormally. + * + * @since 15 + */ + WINDOW_MANAGER_ERRORCODE_SYSTEM_ABNORMAL = 1300003, } WindowManager_ErrorCode; +/** + * @brief Enumerates the avoid area types. + * + * @since 15 + */ +typedef enum { + /** System. */ + WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM = 0, + /** Cutout. */ + WINDOW_MANAGER_AVOID_AREA_TYPE_CUTOUT = 1, + /** System gesture. */ + WINDOW_MANAGER_AVOID_AREA_TYPE_SYSTEM_GESTURE = 2, + /** Keyboard. */ + WINDOW_MANAGER_AVOID_AREA_TYPE_KEYBOARD = 3, + /** Navigation indicator. */ + WINDOW_MANAGER_AVOID_AREA_TYPE_NAVIGATION_INDICATOR = 4, +} WindowManager_AvoidAreaType; + +/** + * @brief The type of a window + * + * @since 15 + */ +typedef enum { + /** Sub window. */ + WINDOW_MANAGER_WINDOW_TYPE_APP = 0, + /** Main window. */ + WINDOW_MANAGER_WINDOW_TYPE_MAIN = 1, + /** Float. */ + WINDOW_MANAGER_WINDOW_TYPE_FLOAT = 8, + /** Dialog. */ + WINDOW_MANAGER_WINDOW_TYPE_DIALOG = 16, +} WindowManager_WindowType; + +/** + * @brief Defines the window rect data structure. + * + * @since 15 + */ +typedef struct { + /** X-axis of the window. */ + int32_t posX; + /** Y-axis of the window. */ + int32_t posY; + /** Width of the window. */ + uint32_t width; + /** Height of the window. */ + uint32_t height; +} WindowManager_Rect; + +/** + * @brief Properties of window + * + * @since 15 +*/ +typedef struct { + /** The position and size of the window. */ + WindowManager_Rect windowRect; + /** The position relative to the window and size of drawable area. */ + WindowManager_Rect drawableRect; + /** Window type. */ + WindowManager_WindowType type; + /** Whether the window is displayed in full screen mode. The default value is false. */ + bool isFullScreen; + /** Whether the window layout is full screen mode. The default value is false. */ + bool isLayoutFullScreen; + /** Whether the window can gain focus. The default value is true. */ + bool focusable; + /** Whether the window is touchable. The default value is false. */ + bool touchable; + /** Brightness value of window. */ + float brightness; + /** Whether keep screen on. */ + bool isKeepScreenOn; + /** Whether make window in privacy mode or not. */ + bool isPrivacyMode; + /** Whether is transparent or not. */ + bool isTransparent; + /** Window id. */ + uint32_t id; + /** Display id. */ + uint32_t displayId; +} WindowManager_WindowProperties; + +/** + * @brief Defines the avoid area data structure. + * + * @since 15 + */ +typedef struct { + /** Top rect of the avoid area. */ + WindowManager_Rect topRect; + /** Left rect of the avoid area. */ + WindowManager_Rect leftRect; + /** Right rect of the avoid area. */ + WindowManager_Rect rightRect; + /** Bottom rect of the avoid area. */ + WindowManager_Rect bottomRect; +} WindowManager_AvoidArea; + #ifdef __cplusplus } #endif diff --git a/arkui/window_manager/oh_window_event_filter.h b/arkui/window_manager/oh_window_event_filter.h index 783e8c5c2013c3ca3496c70e6be6e62c29fd2505..56a726525a3322483274c0bbd46cb412c830ad6c 100644 --- a/arkui/window_manager/oh_window_event_filter.h +++ b/arkui/window_manager/oh_window_event_filter.h @@ -12,15 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef INCLUDE_OH_WINDOW_EVENT_FILTER_H -#define INCLUDE_OH_WINDOW_EVENT_FILTER_H - /** * @addtogroup WindowManager_NativeModule * @{ * - * * @brief Provides abilities of windowManager on the native side, such as key event * filtration. * @@ -37,6 +33,10 @@ * @kit ArkUI * @since 12 */ + +#ifndef INCLUDE_OH_WINDOW_EVENT_FILTER_H +#define INCLUDE_OH_WINDOW_EVENT_FILTER_H + #include "stdbool.h" #include "stdint.h" #include "oh_window_comm.h" @@ -75,8 +75,79 @@ WindowManager_ErrorCode OH_NativeWindowManager_RegisterKeyEventFilter(int32_t wi */ WindowManager_ErrorCode OH_NativeWindowManager_UnregisterKeyEventFilter(int32_t windowId); +/** + * @brief the callback function type when mouseEvent was filter + * @param mouseEvent multimodal mouseEvent + * @since 15 + */ +typedef bool (*OH_NativeWindowManager_MouseEventFilter)(Input_MouseEvent* mouseEvent); + +/** + * @brief Registers a filter callback for the window, the callback is called when the + * window is dispatched to the event + * + * @param windowId windowId when window is created + * @param mouseEventFilter mouse event callback, called when the window is dispatched + * to the event + * @return Returns the status code of the execution. + * Returns {@link OK} if the operation is successful. + * Returns {@link INVAILD_WINDOW_ID} if the window id is invalid. + * Returns {@link SERVICE_ERROR} if the window manager service error occurs. + * @since 15 + */ +WindowManager_ErrorCode OH_NativeWindowManager_RegisterMouseEventFilter(int32_t windowId, + OH_NativeWindowManager_MouseEventFilter mouseEventFilter); + +/** + * @brief clear callback for the window + * + * @param windowId windowId when window is created + * @return Returns the status code of the execution. + * Returns {@link OK} if the operation is successful. + * Returns {@link INVAILD_WINDOW_ID} if the window id is invalid. + * Returns {@link SERVICE_ERROR} if the window manager service error occurs. + * @since 15 + */ +WindowManager_ErrorCode OH_NativeWindowManager_UnregisterMouseEventFilter(int32_t windowId); + +/** + * @brief the callback function type when touchEvent was filter + * @param touchEvent multimodal touchEvent + * @since 15 + */ +typedef bool (*OH_NativeWindowManager_TouchEventFilter)(Input_TouchEvent* touchEvent); + +/** + * @brief Registers a filter callback for the window, the callback is called when the + * window is dispatched to the event + * + * @param windowId windowId when window is created + * @param touchEventFilter touch event callback, called when the window is dispatched + * to the event + * @return Returns the status code of the execution. + * Returns {@link OK} if the operation is successful. + * Returns {@link INVAILD_WINDOW_ID} if the window id is invalid. + * Returns {@link SERVICE_ERROR} if the window manager service error occurs. + * @since 15 + */ +WindowManager_ErrorCode OH_NativeWindowManager_RegisterTouchEventFilter(int32_t windowId, + OH_NativeWindowManager_TouchEventFilter touchEventFilter); + +/** + * @brief clear callback for the window + * + * @param windowId windowId when window is created + * @return Returns the status code of the execution. + * Returns {@link OK} if the operation is successful. + * Returns {@link INVAILD_WINDOW_ID} if the window id is invalid. + * Returns {@link SERVICE_ERROR} if the window manager service error occurs. + * @since 15 + */ +WindowManager_ErrorCode OH_NativeWindowManager_UnregisterTouchEventFilter(int32_t windowId); + #ifdef __cplusplus } #endif -#endif // INCLUDE_OH_WINDOW_EVENT_FILTER_H \ No newline at end of file +#endif // INCLUDE_OH_WINDOW_EVENT_FILTER_H +/** @} */ \ No newline at end of file diff --git a/backgroundtasks/transient/include/transient_task_api.h b/backgroundtasks/transient/include/transient_task_api.h index 74b467dc61fe50f384fecec1d9969bc1f485773e..874e6473412e80b3b68cfffa268e78dde2c27ecc 100644 --- a/backgroundtasks/transient/include/transient_task_api.h +++ b/backgroundtasks/transient/include/transient_task_api.h @@ -13,13 +13,6 @@ * limitations under the License. */ -#ifndef OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H -#define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H - -#include - -#include "transient_task_type.h" - /** * @addtogroup TransientTask * @{ @@ -41,6 +34,13 @@ * @since 13 */ +#ifndef OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H +#define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_API_H + +#include + +#include "transient_task_type.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/backgroundtasks/transient/include/transient_task_type.h b/backgroundtasks/transient/include/transient_task_type.h index 6ddd4dbfa738319da8785a6db3ab25d0822cc4a7..7a19adf75c8050b3d4c23f5eec1dc1a8ab00b183 100644 --- a/backgroundtasks/transient/include/transient_task_type.h +++ b/backgroundtasks/transient/include/transient_task_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_TYPE_H -#define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_TYPE_H - /** * @addtogroup TransientTask * @{ @@ -36,6 +33,9 @@ * @since 11 */ +#ifndef OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_TYPE_H +#define OHOS_BACKGROUOND_TASK_MANAGER_TRANSIENT_TASK_TYPE_H + #include #ifdef __cplusplus diff --git a/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h b/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h index 2cc076408560ac4b5c248b480ab3760879a53bbd..04bb5d3311b50786aa49d24727f99e080f525837 100644 --- a/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h +++ b/bundlemanager/bundle_framework/bundle/include/native_interface_bundle.h @@ -145,6 +145,20 @@ char* OH_NativeBundle_GetAppIdentifier(); * @since 13 */ OH_NativeBundle_ElementName OH_NativeBundle_GetMainElementName(); + +/** + * @brief Obtains the compatible device type of the current application. + * After utilizing this interface, to prevent memory leaks, + * it is necessary to manually release the pointer returned by the interface. + * + * @return Returns the newly created string that indicates the compatible device type, + * if the returned object is NULL, it indicates creation failure. + * The possible cause of failure could be that the application address space is full, + * leading to space allocation failure. + * @since 14 + * @version 1.0 + */ +char* OH_NativeBundle_GetCompatibleDeviceType(); #ifdef __cplusplus }; #endif diff --git a/bundlemanager/bundle_framework/bundle/libbundle.ndk.json b/bundlemanager/bundle_framework/bundle/libbundle.ndk.json index a9db17ede55a4bedd17b04a0584461c3da418284..f61863508c87306870bff6432339dbc5376b451a 100644 --- a/bundlemanager/bundle_framework/bundle/libbundle.ndk.json +++ b/bundlemanager/bundle_framework/bundle/libbundle.ndk.json @@ -14,5 +14,9 @@ { "first_introduced": "13", "name": "OH_NativeBundle_GetMainElementName" + }, + { + "first_introduced": "14", + "name": "OH_NativeBundle_GetCompatibleDeviceType" } ] diff --git a/commonlibrary/memory_utils/libpurgeablemem/purgeable_memory.h b/commonlibrary/memory_utils/libpurgeablemem/purgeable_memory.h index a228044348e33e324aa8c5df8dbb9378534face3..2f9cb9ef27fb060dbad46176e0ec8e501949f74e 100644 --- a/commonlibrary/memory_utils/libpurgeablemem/purgeable_memory.h +++ b/commonlibrary/memory_utils/libpurgeablemem/purgeable_memory.h @@ -15,6 +15,7 @@ /** * @addtogroup memory + * @{ * * @brief provides memory management capabilities * @@ -32,6 +33,9 @@ * provides features include create, begin read ,end read, begin write, end write, rebuild, and so on. * when using, it is necessary to link libpurgeable_memory_ndk.z.so * + * @library libpurgeablemem.z.so + * @syscap SystemCapability.Kernel.Memory + * @kit KernelEnhanceKit * @since 10 * @version 1.0 */ @@ -203,4 +207,5 @@ bool OH_PurgeableMemory_AppendModify(OH_PurgeableMemory *purgObj, #ifdef __cplusplus } #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEMORY_H */ \ No newline at end of file +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEMORY_H */ +/** @} */ \ No newline at end of file diff --git a/distributeddatamgr/pasteboard/include/oh_pasteboard.h b/distributeddatamgr/pasteboard/include/oh_pasteboard.h index 6ac4336a2ea12718a9f32eb906be09da2507a100..c4b9c2f665ae927ed454d993448f0a0058e37e6e 100644 --- a/distributeddatamgr/pasteboard/include/oh_pasteboard.h +++ b/distributeddatamgr/pasteboard/include/oh_pasteboard.h @@ -63,6 +63,60 @@ typedef enum Pasteboard_NotifyType { NOTIFY_REMOTE_DATA_CHANGE = 2 } Pasteboard_NotifyType; +/** + * @brief Enumerates the types of file confilct options when getting data from the Pastedboard. + * + * @since 15 + */ +typedef enum Pasteboard_FileConflictOptions { + /** + * @brief Overwrite when destUir has file with same name. + */ + PASTEBOARD_OVERWRITE = 0, + /** + * @brief Skip when destUir has file with same name. + */ + PASTEBOARD_SKIP = 1 +} Pasteboard_FileConflictOptions; + +/** + * @brief Enumerates the types of progress indicator when getting data from the Pastedboard. + * + * @since 15 + */ +typedef enum Pasteboard_ProgressIndicator { + /** + * @brief Getting data without system default progress indicator. + */ + PASTEBOARD_NONE = 0, + /** + * @brief Getting data with system default progress indicator. + */ + PASTEBOARD_DEFAULT = 1 +} Pasteboard_ProgressIndicator; + +/** + * @brief Represents the Pasteboard progress information. + * + * @since 15 + */ +typedef struct Pasteboard_ProgressInfo Pasteboard_ProgressInfo; + +/** + * @brief Defines the callback function used to return the progress information when getting PasteData. + * + * @param progressInfo The progress information notified to Application. + * @since 15 + */ +typedef void (*OH_Pasteboard_ProgressListener)(Pasteboard_ProgressInfo* progressInfo); + +/** + * @brief Represents the pasteboard get data parameters when getting data from Pasteboard. + * + * @since 15 + */ +typedef struct Pasteboard_GetDataParams Pasteboard_GetDataParams; + /** * @brief Defines the callback function used to return the Pasteboard data changed. * @@ -267,6 +321,124 @@ int OH_Pasteboard_SetData(OH_Pasteboard* pasteboard, OH_UdmfData* data); * @since 13 */ int OH_Pasteboard_ClearData(OH_Pasteboard* pasteboard); + +/** + * @brief Obtains all MIME types of Pasteboard data. + * + * @param pasteboard Pointer to the {@link OH_Pasteboard} instance. + * @param count Poniter to the count of MIME types. + * @return Returns char array of MIME types in the Pasteboard. + * Returns nullptr if the operation is failed. + * @see OH_Pasteboard. + * @since 14 + */ +char **OH_Pasteboard_GetMimeTypes(OH_Pasteboard *pasteboard, unsigned int *count); + +/** + * @brief Gets the number of Pasteboard data changes. + * + * @param pasteboard Pointer to the {@link OH_Pasteboard} instance. + * @return the number of Pasteboard data changes. + * Returns 0 means initial value or invalid value.In this case, no action is required. + * @since 18 + */ +uint32_t OH_Pasteboard_GetChangeCount(OH_Pasteboard *pasteboard); + +/** + * @brief Create a pointer to the instance of the {@link Pasteboard_GetDataParams}. + * + * @return If the operation is successful, a pointer to the instance of the {@link Pasteboard_GetDataParams} + * structure is returned. If the operation is failed, nullptr is returned. + * @see Pasteboard_GetDataParams + * @since 15 + */ +Pasteboard_GetDataParams *OH_Pasteboard_GetDataParams_Create(void); + +/** + * @brief Destroy a pointer that points to an instance of {@link Pasteboard_GetDataParams}. + * + * @param params Represents a pointer to an instance of {@link Pasteboard_GetDataParams}. + * @see Pasteboard_GetDataParams + * @since 15 + */ +void OH_Pasteboard_GetDataParams_Destroy(Pasteboard_GetDataParams* params); + +/** + * @brief Set the progress indicator to the {@link Pasteboard_GetDataParams}. + * + * @param params Represents a pointer to an instance of {@link Pasteboard_GetDataParams}. + * @param progressIndicator Represents to the progress indicator. + * @see Pasteboard_GetDataParams Pasteboard_ProgressIndicator + * @since 15 + */ +void OH_Pasteboard_GetDataParams_SetProgressIndicator(Pasteboard_GetDataParams* params, + Pasteboard_ProgressIndicator progressIndicator); + +/** + * @brief Set the destination uri to the {@link Pasteboard_GetDataParams}. + * + * @param params Represents a pointer to an instance of {@link Pasteboard_GetDataParams}. + * @param destUri Pointer to a destination uri. + * @param destUriLen Indicates the length of destination uri. + * @see Pasteboard_GetDataParams + * @since 15 + */ +void OH_Pasteboard_GetDataParams_SetDestUri(Pasteboard_GetDataParams* params, const char* destUri, uint32_t destUriLen); + +/** + * @brief Set the file conflict options to the {@link Pasteboard_GetDataParams}. + * + * @param params Represents a pointer to an instance of {@link Pasteboard_GetDataParams}. + * @param option Represents to the file conflict options. + * @see Pasteboard_GetDataParams Pasteboard_FileConflictOptions + * @since 15 + */ +void OH_Pasteboard_GetDataParams_SetFileConflictOptions(Pasteboard_GetDataParams* params, + Pasteboard_FileConflictOptions option); + +/** + * @brief Set the progress indicator to the {@link Pasteboard_GetDataParams}. + * + * @param params Represents a pointer to an instance of {@link Pasteboard_GetDataParams}. + * @param listener Represents to the data progress listener. + * @see Pasteboard_GetDataParams OH_Pasteboard_ProgressListener + * @since 15 + */ +void OH_Pasteboard_GetDataParams_SetProgressListener(Pasteboard_GetDataParams* params, + const OH_Pasteboard_ProgressListener listener); + +/** + * @brief Get the progress from the {@link Pasteboard_ProgressInfo}. + * + * @param progressInfo Represents a pointer to an instance of {@link Pasteboard_ProgressInfo}. + * @return Returns the progress. + * @see Pasteboard_ProgressInfo + * @since 15 + */ +int OH_Pasteboard_ProgressInfo_GetProgress(Pasteboard_ProgressInfo* progressInfo); + +/** + * @brief Defines the cancel function used to cancel the progress when getting PasteData. + * + * @param params Pointer to indicates the {@link Pasteboard_GetDataParams}. + * @see Pasteboard_GetDataParams. + * @since 15 + */ +void OH_Pasteboard_ProgressCancel(Pasteboard_GetDataParams* params); + +/** + * @brief Obtains data from the Pasteboard with system progress indicator. + * + * @permission ohos.permission.READ_PASTEBOARD + * @param pasteboard Pointer to the {@link OH_Pasteboard} instance. + * @param params Pointer to indicates the {@link OH_Pasteboard_GetDataParams}. + * @param status The status code of the execution. For details, see {@link PASTEBOARD_Errcode}. + * @return Returns the pointer to the {@link OH_PasteData} instance. + * @see OH_Pasteboard OH_PasteData PASTEBOARD_ErrCode. + * @since 15 + */ +OH_UdmfData* OH_Pasteboard_GetDataWithProgress(OH_Pasteboard* pasteboard, Pasteboard_GetDataParams* params, + int* status); #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/pasteboard/include/oh_pasteboard_err_code.h b/distributeddatamgr/pasteboard/include/oh_pasteboard_err_code.h index 36f30f1a99c8eaf96f8ab3c255a9a473548e226e..8dba41d2a0cdd3f05a8bcc560328afbef9cafd1e 100644 --- a/distributeddatamgr/pasteboard/include/oh_pasteboard_err_code.h +++ b/distributeddatamgr/pasteboard/include/oh_pasteboard_err_code.h @@ -74,6 +74,26 @@ typedef enum PASTEBOARD_ErrCode { * @error Another copy is in progress. */ ERR_BUSY = 12900003, + /** + * @error Copy file failed. + * @since 15 + */ + ERR_PASTEBOARD_COPY_FILE_ERROR = 12900007, + /** + * @error Failed to start progress. + * @since 15 + */ + ERR_PASTEBOARD_PROGRESS_START_ERROR = 12900008, + /** + * @error Progress exits abnormally. + * @since 15 + */ + ERR_PASTEBOARD_PROGRESS_ABNORMAL = 12900009, + /** + * @error Get Data failed. + * @since 15 + */ + ERR_PASTEBOARD_GET_DATA_FAILED = 12900010, } PASTEBOARD_ErrCode; #ifdef __cplusplus }; diff --git a/distributeddatamgr/pasteboard/libpasteboard.ndk.json b/distributeddatamgr/pasteboard/libpasteboard.ndk.json index 829a3ba45fac1adec83078b3db8e7538fdbd5a4e..6b21588f7a09e99974704c28f796615d4787f460 100644 --- a/distributeddatamgr/pasteboard/libpasteboard.ndk.json +++ b/distributeddatamgr/pasteboard/libpasteboard.ndk.json @@ -54,5 +54,50 @@ { "first_introduced": "13", "name": "OH_Pasteboard_ClearData" + }, + { + "first_introduced": "14", + "name": "OH_Pasteboard_GetMimeTypes" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_Create" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_SetProgressIndicator" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_SetDestUri" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_SetFileConflictOptions" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataParams_SetProgressListener" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_ProgressInfo_GetProgress" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_ProgressCancel" + }, + { + "first_introduced": "15", + "name": "OH_Pasteboard_GetDataWithProgress" + }, + { + "first_introduced": "18", + "name": "OH_Pasteboard_GetChangeCount" + } ] \ No newline at end of file diff --git a/distributeddatamgr/preferences/include/oh_preferences.h b/distributeddatamgr/preferences/include/oh_preferences.h index c3a56fd957325706b955d94fa3568c5d8a7d1824..dc6c2821735a4733d15c9873256f03c5a61a9b0f 100644 --- a/distributeddatamgr/preferences/include/oh_preferences.h +++ b/distributeddatamgr/preferences/include/oh_preferences.h @@ -89,7 +89,6 @@ OH_Preferences *OH_Preferences_Open(OH_PreferencesOption *option, int *errCode); * @brief Closes a Preferences object. * * @param preference Pointer to the {@Link OH_Preferences} instance to close. - * @param option Pointer to an {@Link OH_PreferencesOption} instance. * @return Returns the status code of the execution. For details, see {@Link OH_Preferences_ErrCode}. * {@link PREFERENCES_OK} indicates the operation is successful. * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. @@ -264,6 +263,18 @@ int OH_Preferences_RegisterDataObserver(OH_Preferences *preference, void *contex int OH_Preferences_UnregisterDataObserver(OH_Preferences *preference, void *context, OH_PreferencesDataObserver observer, const char *keys[], uint32_t keyCount); +/** + * @brief Check if a type is supported or not. + * + * @param type the storage type of {@Link Preferences_StorageType}. + * @param isSupported Pointer to the Boolean value obtained. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} indicates the operation is successful. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @since 18 + */ +int OH_Preferences_IsStorageTypeSupported(Preferences_StorageType type, bool *isSupported); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/preferences/include/oh_preferences_err_code.h b/distributeddatamgr/preferences/include/oh_preferences_err_code.h index 5b77219b9d9647f416e18126d8014747b23ddf24..90a2c6818099095b5978f7d067f3c8f66f19e5b2 100644 --- a/distributeddatamgr/preferences/include/oh_preferences_err_code.h +++ b/distributeddatamgr/preferences/include/oh_preferences_err_code.h @@ -73,5 +73,5 @@ typedef enum OH_Preferences_ErrCode { #ifdef __cplusplus }; #endif - +/** @} */ #endif // OH_PREFERENCES_ERR_CODE_H diff --git a/distributeddatamgr/preferences/include/oh_preferences_option.h b/distributeddatamgr/preferences/include/oh_preferences_option.h index a8a25af9f55287456e3595803981a3c727390acf..efeb5161a66ca77a1b5fc978ff54b7bad113669a 100644 --- a/distributeddatamgr/preferences/include/oh_preferences_option.h +++ b/distributeddatamgr/preferences/include/oh_preferences_option.h @@ -52,6 +52,18 @@ extern "C" { */ typedef struct OH_PreferencesOption OH_PreferencesOption; +/** + * @brief Enumerates the preferences storage types. + * + * @since 18 + */ +typedef enum Preferences_StorageType { + /** XML storage*/ + PREFERENCES_STORAGE_XML = 0, + /** GSKV storage */ + PREFERENCES_STORAGE_GSKV +} Preferences_StorageType; + /** * @brief Creates an {@Link OH_PreferencesOption} instance. * @@ -101,6 +113,19 @@ int OH_PreferencesOption_SetBundleName(OH_PreferencesOption *option, const char */ int OH_PreferencesOption_SetDataGroupId(OH_PreferencesOption *option, const char *dataGroupId); +/** + * @brief Sets the storage type in an {@Link OH_PreferencesOption} instance. + * + * @param option Represents a pointer to an {@link OH_PreferencesOption} instance. + * @param type Represents preferences storage type. + * @return Returns the status code of the execution. + * {@link PREFERENCES_OK} success. + * {@link PREFERENCES_ERROR_INVALID_PARAM} indicates invalid args are passed in. + * @see OH_PreferencesOption. + * @since 18 + */ +int OH_PreferencesOption_SetStorageType(OH_PreferencesOption *option, Preferences_StorageType type); + /** * @brief Destroys an {@Link OH_PreferencesOption} instance. * @@ -115,4 +140,5 @@ int OH_PreferencesOption_Destroy(OH_PreferencesOption *option); #ifdef __cplusplus }; #endif +/** @} */ #endif // OH_PREFERENCES_OPTION_H \ No newline at end of file diff --git a/distributeddatamgr/preferences/include/oh_preferences_value.h b/distributeddatamgr/preferences/include/oh_preferences_value.h index 945e28fc62980fe1de55cd342a2f1eb33e3d2bb7..5be471f187269ef8f1dc587217e49c3998364db9 100644 --- a/distributeddatamgr/preferences/include/oh_preferences_value.h +++ b/distributeddatamgr/preferences/include/oh_preferences_value.h @@ -172,4 +172,5 @@ int OH_PreferencesValue_GetString(const OH_PreferencesValue *object, char **valu #ifdef __cplusplus }; #endif +/** @} */ #endif // OH_PREFERENCES_VALUE_H \ No newline at end of file diff --git a/distributeddatamgr/relational_store/BUILD.gn b/distributeddatamgr/relational_store/BUILD.gn index a720869f7ad9535b58e3c9104cfef3166c6d54e1..560c94d4d153579497dd4bea9a91509e5015cec4 100644 --- a/distributeddatamgr/relational_store/BUILD.gn +++ b/distributeddatamgr/relational_store/BUILD.gn @@ -20,6 +20,8 @@ ohos_ndk_headers("native_rdb_ndk_header") { sources = [ "./include/oh_cursor.h", "./include/oh_predicates.h", + "./include/oh_rdb_transaction.h", + "./include/oh_rdb_types.h", "./include/oh_value_object.h", "./include/oh_values_bucket.h", "./include/relational_store.h", @@ -29,7 +31,12 @@ ohos_ndk_headers("native_rdb_ndk_header") { ohos_ndk_headers("data_ndk_header") { dest_dir = "$ndk_headers_out_dir/database/data/" - sources = [ "./include/data_asset.h" ] + sources = [ + "./include/data_asset.h", + "./include/oh_data_value.h", + "./include/oh_data_values.h", + "./include/oh_data_values_buckets.h", + ] } ohos_ndk_library("libnative_rdb_ndk") { @@ -40,8 +47,13 @@ ohos_ndk_library("libnative_rdb_ndk") { min_compact_version = "11" system_capability_headers = [ "$ndk_headers_out_dir/database/data/data_asset.h", + "$ndk_headers_out_dir/database/data/oh_data_value.h", + "$ndk_headers_out_dir/database/data/oh_data_values.h", + "$ndk_headers_out_dir/database/data/oh_data_values_buckets.h", "$ndk_headers_out_dir/database/rdb/oh_cursor.h", "$ndk_headers_out_dir/database/rdb/oh_predicates.h", + "$ndk_headers_out_dir/database/rdb/oh_rdb_transaction.h", + "$ndk_headers_out_dir/database/rdb/oh_rdb_types.h", "$ndk_headers_out_dir/database/rdb/oh_value_object.h", "$ndk_headers_out_dir/database/rdb/oh_values_bucket.h", "$ndk_headers_out_dir/database/rdb/relational_store.h", diff --git a/distributeddatamgr/relational_store/include/data_asset.h b/distributeddatamgr/relational_store/include/data_asset.h index a8bc9e16a83b3eb8ae17e0e73785b7ec72ede2f3..f791cbc9e815b1358fd4bb3b4054f1576b808521 100644 --- a/distributeddatamgr/relational_store/include/data_asset.h +++ b/distributeddatamgr/relational_store/include/data_asset.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef DATA_ASSET_H -#define DATA_ASSET_H /** * @addtogroup RDB * @{ @@ -32,11 +30,20 @@ * * @brief Provides the data type of asset. * @kit ArkData - * @library libnative_rdb_ndk.z.so + * @library libnative_rdb_ndk.so * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 11 */ + +#ifndef DATA_ASSET_H +#define DATA_ASSET_H + +#ifdef __cplusplus #include +#else +#include +#endif + #include #ifdef __cplusplus extern "C" { @@ -350,4 +357,7 @@ int OH_Data_Asset_DestroyMultiple(Data_Asset **assets, uint32_t count); #ifdef __cplusplus }; #endif + +/** @} */ + #endif // DATA_ASSET_H diff --git a/distributeddatamgr/relational_store/include/oh_cursor.h b/distributeddatamgr/relational_store/include/oh_cursor.h index 30d208ab446635eee502b76bc7b4b04ac8e1fe70..5f907b44b6e224a1f1043372380159d05487a442 100644 --- a/distributeddatamgr/relational_store/include/oh_cursor.h +++ b/distributeddatamgr/relational_store/include/oh_cursor.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_CURSOR_H -#define OH_CURSOR_H - /** * @addtogroup RDB * @{ @@ -25,7 +22,6 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ @@ -35,56 +31,36 @@ * @brief Provides functions and enumerations related to the resultSet. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef OH_CURSOR_H +#define OH_CURSOR_H + +#ifdef __cplusplus #include +#else +#include +#endif + #include #include #include "database/data/data_asset.h" +#include "database/data/oh_data_value.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief Indicates the column type. + * @brief Define the OH_Cursor structure type. + * + * Provides methods for accessing a database result set generated by query the database. * * @since 10 */ -typedef enum OH_ColumnType { - /** - * Indicates the column type is NULL. - */ - TYPE_NULL = 0, - /** - * Indicates the column type is INT64. - */ - TYPE_INT64, - /** - * Indicates the column type is REAL. - */ - TYPE_REAL, - /** - * Indicates the column type is TEXT. - */ - TYPE_TEXT, - /** - * Indicates the column type is BLOB. - */ - TYPE_BLOB, - /** - * Indicates the column type is {@link Data_Asset}. - * - * @since 11 - */ - TYPE_ASSET, - /** - * Indicates the column type is array of {@link Data_Asset}. - * - * @since 11 - */ - TYPE_ASSETS -} OH_ColumnType; +typedef struct OH_Cursor OH_Cursor; /** * @brief Define the OH_Cursor structure type. @@ -93,7 +69,7 @@ typedef enum OH_ColumnType { * * @since 10 */ -typedef struct OH_Cursor { +struct OH_Cursor { /** * The id used to uniquely identify the OH_Cursor struct. */ @@ -286,10 +262,64 @@ typedef struct OH_Cursor { * @since 11 */ int (*getAssets)(OH_Cursor *cursor, int32_t columnIndex, Data_Asset **value, uint32_t *length); -} OH_Cursor; +}; + +/** + * @brief Get float array data size of the requested column from OH_Cursor object. + * + * @param cursor Represents a pointer to an instance of OH_Cursor. + * @param columnIndex Indicates the zero-based column index. + * @param length Represents the size of float array. It is an output parameter. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_STEP_RESULT_CLOSED} the result set has been closed. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @since 18 + */ +int OH_Cursor_GetFloatVectorCount(OH_Cursor *cursor, int32_t columnIndex, size_t *length); + +/** + * @brief Obtains the value of the requested column as a float array. + * + * @param cursor Represents a pointer to an instance of OH_Cursor. + * @param columnIndex Indicates the zero-based column index. + * @param val Represents a pointer to float array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of val. It can be obtained through the OH_Cursor_GetFloatVectorCount function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_STEP_RESULT_CLOSED} the result set has been closed. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @see OH_Cursor_GetFloatVectorCount. + * @since 18 + */ +int OH_Cursor_GetFloatVector(OH_Cursor *cursor, int32_t columnIndex, float *val, size_t inLen, size_t *outLen); #ifdef __cplusplus }; #endif +/** @} */ + #endif // OH_CURSOR_H diff --git a/distributeddatamgr/relational_store/include/oh_data_value.h b/distributeddatamgr/relational_store/include/oh_data_value.h new file mode 100644 index 0000000000000000000000000000000000000000..202158324aed23d1bbda6c31204b1f37a7fa66b0 --- /dev/null +++ b/distributeddatamgr/relational_store/include/oh_data_value.h @@ -0,0 +1,452 @@ +/* + * 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 RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. + * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations + * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. + * + * @since 10 + */ + +/** + * @file oh_data_value.h + * + * @brief Provides functions and enumerations related to the data value. + * + * @kit ArkData + * @library libnative_rdb_ndk.z.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * + * @since 18 + */ + +#ifndef OH_DATA_VALUE_H +#define OH_DATA_VALUE_H + +#include +#include "database/data/data_asset.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Indicates the column type. + * + * @since 10 + */ +typedef enum OH_ColumnType { + /** + * @brief Indicates the column type is NULL. + * + * @since 10 Moved from oh_cursor.h file. + */ + TYPE_NULL = 0, + /** + * @brief Indicates the column type is INT64. + * + * @since 10 Moved from oh_cursor.h file. + */ + TYPE_INT64, + /** + * @brief Indicates the column type is REAL. + * + * @since 10 Moved from oh_cursor.h file. + */ + TYPE_REAL, + /** + * @brief Indicates the column type is TEXT. + * + * @since 10 Moved from oh_cursor.h file. + */ + TYPE_TEXT, + /** + * @brief Indicates the column type is BLOB. + * + * @since 10 Moved from oh_cursor.h file. + */ + TYPE_BLOB, + /** + * @brief Indicates the column type is {@link Data_Asset}. + * + * @since 11 Moved from oh_cursor.h file. + */ + TYPE_ASSET, + /** + * @brief Indicates the column type is array of {@link Data_Asset}. + * + * @since 11 Moved from oh_cursor.h file. + */ + TYPE_ASSETS, + /** + * @brief Indicates the column type is FLOAT VECTOR. + * + * @since 18 + */ + TYPE_FLOAT_VECTOR, + /** + * @brief Indicates that the column type is a number whose length is greater than 64 bits. + * + * @since 18 + */ + TYPE_UNLIMITED_INT, +} OH_ColumnType; + +/** + * @brief Define the OH_Data_Value structure type. + * + * @since 18 + */ +typedef struct OH_Data_Value OH_Data_Value; + +/** + * @brief Creates an OH_Data_Value instance object. + * + * @return Returns a pointer to OH_Data_Value instance when the execution is successful. + * Otherwise, nullptr is returned. The memory must be released through the OH_Value_Destroy + * interface after the use is complete. + * @see OH_Value_Destroy. + * @since 18 + */ +OH_Data_Value *OH_Value_Create(); + +/** + * @brief Destroys an OH_Data_Value instance object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_Destroy(OH_Data_Value *value); + +/** + * @brief Set empty data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutNull(OH_Data_Value *value); + +/** + * @brief Set integer data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a integer data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutInt(OH_Data_Value *value, int64_t val); + +/** + * @brief Set decimal data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a decimal data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutReal(OH_Data_Value *value, double val); + +/** + * @brief Set string data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a string data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutText(OH_Data_Value *value, const char *val); + +/** + * @brief Set binary data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a binary data. + * @param length Represents the size of binary data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutBlob(OH_Data_Value *value, const unsigned char *val, size_t length); + +/** + * @brief Set Data_Asset data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to an instance of Data_Asset. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutAsset(OH_Data_Value *value, const Data_Asset *val); + +/** + * @brief Set multiple Data_Asset data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to multiple Data_Asset. + * @param length Represents the count of multiple data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutAssets(OH_Data_Value *value, const Data_Asset * const * val, size_t length); + +/** + * @brief Set float array data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to float array. + * @param length Represents the size of float array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutFloatVector(OH_Data_Value *value, const float *val, size_t length); + +/** + * @brief Set an integer of any length data to the OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param sign Represents 0 is positive integer, 1 is negative integer. + * @param trueForm Represents a pointer to integer array. + * @param length Represents the size of integer array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_PutUnlimitedInt(OH_Data_Value *value, int sign, const uint64_t *trueForm, size_t length); + +/** + * @brief Get data type from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param type Represents the parameter of the data type. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_GetType(OH_Data_Value *value, OH_ColumnType *type); + +/** + * @brief Check whether the data is empty from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents empty data flag. It is an output parameter. Ture is empty, false is not empty. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Value_IsNull(OH_Data_Value *value, bool *val); + +/** + * @brief Get integer data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to an integer data. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetInt(OH_Data_Value *value, int64_t *val); + +/** + * @brief Get decimal data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to an decimal data. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetReal(OH_Data_Value *value, double *val); + +/** + * @brief Get string data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to a string data. It is an output parameter. + * The caller does not need to apply for memory and release memory. The life cycle of val follows value. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetText(OH_Data_Value *value, const char **val); + +/** + * @brief Get binary data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to a binary data. It is an output parameter. + * The caller does not need to apply for memory and release memory. The life cycle of val follows value. + * @param length Represents the size of binary array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetBlob(OH_Data_Value *value, const uint8_t **val, size_t *length); + +/** + * @brief Get Data_Asset data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to an instance of Data_Asset. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetAsset(OH_Data_Value *value, Data_Asset *val); + +/** + * @brief Get multiple Data_Asset size from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param length Represents the size of Data_Asset array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetAssetsCount(OH_Data_Value *value, size_t *length); + +/** + * @brief Get multiple Data_Asset data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to Data_Asset array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of val. It can be obtained through the OH_Value_GetAssetsCount function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Value_GetAssetsCount. + * @since 18 + */ +int OH_Value_GetAssets(OH_Data_Value *value, Data_Asset **val, size_t inLen, size_t *outLen); + +/** + * @brief Get float array data size from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param length Represents the size of float array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetFloatVectorCount(OH_Data_Value *value, size_t *length); + +/** + * @brief Get float array from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param val Represents a pointer to float array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of val. It can be obtained through the OH_Value_GetFloatVectorCount function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Value_GetFloatVectorCount. + * @since 18 + */ +int OH_Value_GetFloatVector(OH_Data_Value *value, float *val, size_t inLen, size_t *outLen); + +/** + * @brief Get an integer of any length data size from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param length Represents the size of integer array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Value_GetUnlimitedIntBand(OH_Data_Value *value, size_t *length); + +/** + * @brief Get an integer of any length data from OH_Data_Value object. + * + * @param value Represents a pointer to an instance of OH_Data_Value. + * @param sign Represents 0 is positive integer, 1 is negative integer. It is an output parameter. + * @param trueForm Represents a pointer to integer array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of trueForm. It can be obtained through the OH_Value_GetUnlimitedIntBand function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Value_GetUnlimitedIntBand. + * @since 18 + */ +int OH_Value_GetUnlimitedInt(OH_Data_Value *value, int *sign, uint64_t *trueForm, size_t inLen, size_t *outLen); + +#ifdef __cplusplus +}; +#endif +#endif +/** @} */ \ No newline at end of file diff --git a/distributeddatamgr/relational_store/include/oh_data_values.h b/distributeddatamgr/relational_store/include/oh_data_values.h new file mode 100644 index 0000000000000000000000000000000000000000..a816d39c5e2975616779cf1d431e0705d1ccfd8e --- /dev/null +++ b/distributeddatamgr/relational_store/include/oh_data_values.h @@ -0,0 +1,443 @@ +/* + * 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 RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. + * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations + * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. + * + * @since 10 + */ + +/** + * @file oh_data_values.h + * + * @brief Provides functions and enumerations related to the data values. + * + * @kit ArkData + * @library libnative_rdb_ndk.z.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * + * @since 18 + */ +#ifndef OH_DATA_VALUES_H +#define OH_DATA_VALUES_H +#include + +#include "database/data/data_asset.h" +#include "database/data/oh_data_value.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define the OH_Data_Values structure type. + * + * @since 18 + */ +typedef struct OH_Data_Values OH_Data_Values; + +/** + * @brief Creates an OH_Data_Values instance object. + * + * @return Returns a pointer to OH_Data_Values instance when the execution is successful. + * Otherwise, nullptr is returned. The memory must be released through the OH_Values_Destroy + * interface after the use is complete. + * @see OH_Values_Destroy. + * @since 18 + */ +OH_Data_Values *OH_Values_Create(); + +/** + * @brief Destroys an OH_Data_Values instance object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_Destroy(OH_Data_Values *values); + +/** + * @brief Add OH_Data_Value data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a pointer to an instance of OH_Data_Value. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_Put(OH_Data_Values *values, const OH_Data_Value *val); + +/** + * @brief Add empty data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutNull(OH_Data_Values *values); + +/** + * @brief Add integer data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a integer data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutInt(OH_Data_Values *values, int64_t val); + +/** + * @brief Add decimal data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a decimal data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutReal(OH_Data_Values *values, double val); + +/** + * @brief Add string data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a string data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutText(OH_Data_Values *values, const char *val); + +/** + * @brief Add binary data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a binary data. + * @param length Represents the size of binary data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutBlob(OH_Data_Values *values, const unsigned char *val, size_t length); + +/** + * @brief Add Data_Asset data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a pointer to an instance of Data_Asset. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutAsset(OH_Data_Values *values, const Data_Asset *val); + +/** + * @brief Add multiple Data_Asset data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a pointer to multiple Data_Asset. + * @param length Represents the count of multiple data. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutAssets(OH_Data_Values *values, const Data_Asset * const * val, size_t length); + +/** + * @brief Add float array data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param val Represents a pointer to float array. + * @param length Represents the size of float array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutFloatVector(OH_Data_Values *values, const float *val, size_t length); + +/** + * @brief Add an integer of any length data to the OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param sign Represents 0 is positive integer, 1 is negative integer. + * @param trueForm Represents a pointer to integer array. + * @param length Represents the size of integer array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_PutUnlimitedInt(OH_Data_Values *values, int sign, const uint64_t *trueForm, size_t length); + +/** + * @brief Get data count from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param count Represents the count of data in values. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_Count(OH_Data_Values *values, size_t *count); + +/** + * @brief Get data type from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param type Represents the parameter of the data type. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_GetType(OH_Data_Values *values, int index, OH_ColumnType *type); + +/** + * @brief Get OH_Data_Value data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to an instance of OH_Data_Value. It is an output parameter. + * The caller does not need to apply for memory and release memory. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_Get(OH_Data_Values *values, int index, OH_Data_Value **val); + +/** + * @brief Check whether the data is empty from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents empty data flag. It is an output parameter. Ture is empty, false is not empty. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_Values_IsNull(OH_Data_Values *values, int index, bool *val); + +/** + * @brief Get integer data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to an integer data. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetInt(OH_Data_Values *values, int index, int64_t *val); + +/** + * @brief Get decimal data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to an decimal data. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetReal(OH_Data_Values *values, int index, double *val); + +/** + * @brief Get string data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to a string data. It is an output parameter. + * The caller does not need to apply for memory and release memory. + * The life cycle of val follows the value of index in values. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetText(OH_Data_Values *values, int index, const char **val); + +/** + * @brief Get binary data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to a binary data. It is an output parameter. + * The caller does not need to apply for memory and release memory. + * The life cycle of val follows the value of index in values. + * @param length Represents the size of binary array. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetBlob(OH_Data_Values *values, int index, const uint8_t **val, size_t *length); + +/** + * @brief Get Data_Asset data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to an instance of Data_Asset. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetAsset(OH_Data_Values *values, int index, Data_Asset *val); + +/** + * @brief Get multiple Data_Asset size from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param length Represents the size of Data_Asset array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetAssetsCount(OH_Data_Values *values, int index, size_t *length); + +/** + * @brief Get multiple Data_Asset data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to Data_Asset array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of val. It can be obtained through the OH_Values_GetAssetsCount function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Values_GetAssetsCount. + * @since 18 + */ +int OH_Values_GetAssets(OH_Data_Values *values, int index, Data_Asset **val, size_t inLen, size_t *outLen); + +/** + * @brief Get float array data size from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param length Represents the size of float array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetFloatVectorCount(OH_Data_Values *values, int index, size_t *length); + +/** + * @brief Get float array from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param val Represents a pointer to float array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of val. It can be obtained through the OH_Values_GetFloatVectorCount function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Values_GetFloatVectorCount. + * @since 18 + */ +int OH_Values_GetFloatVector(OH_Data_Values *values, int index, float *val, size_t inLen, size_t *outLen); + +/** + * @brief Get an integer of any length data size from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param length Represents the size of integer array. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @since 18 + */ +int OH_Values_GetUnlimitedIntBand(OH_Data_Values *values, int index, size_t *length); + +/** + * @brief Get an integer of any length data from OH_Data_Values object. + * + * @param values Represents a pointer to an instance of OH_Data_Values. + * @param index Represents the zero-based index of target data in values. + * @param sign Represents 0 is positive integer, 1 is negative integer. It is an output parameter. + * @param trueForm Represents a pointer to integer array. The caller needs to apply for data memory. + * This function only fills data. Otherwise, the execution fails. + * @param inLen Represents the size of trueForm. It can be obtained through the OH_Values_GetUnlimitedIntBand function. + * @param outLen Represents the actual amount of data obtained. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_DATA_TYPE_NULL} the content stored in parameter value is null. + * Returns {@link RDB_E_TYPE_MISMATCH} storage data type mismatch. + * @see OH_Values_GetUnlimitedIntBand. + * @since 18 + */ +int OH_Values_GetUnlimitedInt(OH_Data_Values *values, int index, int *sign, uint64_t *trueForm, size_t inLen, + size_t *outLen); + +#ifdef __cplusplus +}; +#endif +#endif +/** @} */ \ No newline at end of file diff --git a/distributeddatamgr/relational_store/include/oh_data_values_buckets.h b/distributeddatamgr/relational_store/include/oh_data_values_buckets.h new file mode 100644 index 0000000000000000000000000000000000000000..1147fb08a1a5813988099bca67ccff95fac96ead --- /dev/null +++ b/distributeddatamgr/relational_store/include/oh_data_values_buckets.h @@ -0,0 +1,117 @@ +/* + * 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 RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. + * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations + * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. + * + * @since 10 + */ + +/** + * @file oh_data_values_buckets.h + * + * @brief Provides functions and enumerations related to the data value buckets. + * + * @kit ArkData + * @library libnative_rdb_ndk.z.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * + * @since 18 + */ + + +#ifndef OH_VALUES_BUCKETS_H +#define OH_VALUES_BUCKETS_H +#include "database/rdb/oh_values_bucket.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define the OH_Data_VBuckets structure type. + * + * @since 18 + */ +typedef struct OH_Data_VBuckets OH_Data_VBuckets; + +/** + * @brief Creates an OH_Data_VBuckets instance object. + * + * @return Returns a pointer to OH_Data_VBuckets instance when the execution is successful. + * Otherwise, nullptr is returned. The memory must be released through the OH_VBuckets_Destroy + * interface after the use is complete. + * @see OH_VBuckets_Destroy. + * @since 18 + */ +OH_Data_VBuckets *OH_VBuckets_Create(); + +/** + * @brief Destroys an OH_Data_VBuckets instance object. + * + * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_VBuckets_Destroy(OH_Data_VBuckets *buckets); + +/** + * @brief Add an OH_VBucket to OH_Data_VBuckets object. + * + * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. + * @param row Represents a pointer to an instance of OH_VBucket. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_VBuckets_PutRow(OH_Data_VBuckets *buckets, const OH_VBucket *row); + +/** + * @brief Add an OH_Data_VBuckets to OH_Data_VBuckets object. + * + * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. + * @param rows Represents a pointer to an instance of OH_Data_VBuckets. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_VBuckets_PutRows(OH_Data_VBuckets *buckets, const OH_Data_VBuckets *rows); + +/** + * @brief Add an OH_Data_VBuckets to OH_Data_VBuckets object. + * + * @param buckets Represents a pointer to an instance of OH_Data_VBuckets. + * @param count Represents the count of OH_VBucket in OH_Data_VBuckets. It is an output parameter. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_VBuckets_RowCount(OH_Data_VBuckets *buckets, size_t *count); + +#ifdef __cplusplus +}; +#endif +#endif +/** @} */ diff --git a/distributeddatamgr/relational_store/include/oh_predicates.h b/distributeddatamgr/relational_store/include/oh_predicates.h index 71f4964591e50d5751ab93e25c15abbecca018d9..32d4e3e9eb260012d43dacd6778300c283769565 100644 --- a/distributeddatamgr/relational_store/include/oh_predicates.h +++ b/distributeddatamgr/relational_store/include/oh_predicates.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_PREDICATES_H -#define OH_PREDICATES_H - /** * @addtogroup RDB * @{ @@ -25,7 +22,6 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ @@ -35,10 +31,20 @@ * @brief Declared predicate related functions and enumerations. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef OH_PREDICATES_H +#define OH_PREDICATES_H + +#ifdef __cplusplus #include +#else +#include +#endif + #include #include "database/rdb/oh_value_object.h" @@ -67,7 +73,14 @@ typedef enum OH_OrderType { * * @since 10 */ -typedef struct OH_Predicates { +typedef struct OH_Predicates OH_Predicates; + +/** + * @brief Define the OH_Predicates structure type. + * + * @since 10 + */ +struct OH_Predicates { /** * The id used to uniquely identify the OH_Predicates struct. */ @@ -395,10 +408,12 @@ typedef struct OH_Predicates { * @since 10 */ int (*destroy)(OH_Predicates *predicates); -} OH_Predicates; +}; #ifdef __cplusplus }; #endif +/** @} */ + #endif // OH_PREDICATES_H diff --git a/distributeddatamgr/relational_store/include/oh_rdb_transaction.h b/distributeddatamgr/relational_store/include/oh_rdb_transaction.h new file mode 100644 index 0000000000000000000000000000000000000000..aa34f0228ea3a7be3dfa8500cccf0809af3c794b --- /dev/null +++ b/distributeddatamgr/relational_store/include/oh_rdb_transaction.h @@ -0,0 +1,350 @@ +/* + * 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 RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. + * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations + * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. + * + * @since 10 + */ + +/** + * @file oh_rdb_transaction.h + * + * @brief Provides database transaction related functions and enumerations. + * + * @kit ArkData + * @library libnative_rdb_ndk.z.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * + * @since 18 + */ + +#ifndef OH_RDB_TRANSACTION_H +#define OH_RDB_TRANSACTION_H + +#include "database/rdb/oh_cursor.h" +#include "database/rdb/oh_predicates.h" +#include "database/rdb/oh_values_bucket.h" +#include "database/rdb/oh_rdb_types.h" +#include "database/data/oh_data_values.h" +#include "database/data/oh_data_values_buckets.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Indicates relation database transaction type. + * + * @since 18 + */ +typedef enum OH_RDB_TransType { + /** + * @brief Indicates the transaction does not actually start until the database is first accessed. It's a default. + */ + RDB_TRANS_DEFERRED = 0, + /** + * @brief Indicates the database connection to start a new write immediately, without waiting for a write statement. + */ + RDB_TRANS_IMMEDIATE, + /** + * @brief Indicates it is similar to RDB_TRANS_IMMEDIATE in that a write transaction is started immediately. + * RDB_TRANS_EXCLUSIVE and RDB_TRANS_IMMEDIATE are the same in WAL mode, but in other journaling modes, + * EXCLUSIVE prevents other database connections from reading the database while the transaction is underway. + */ + RDB_TRANS_EXCLUSIVE, + /** + * The largest value for rdb transaction type. + */ + RDB_TRANS_BUTT, +} OH_RDB_TransType; + +/** + * @brief Define the OH_RDB_TransOptions structure type. + * + * @since 18 + */ +typedef struct OH_RDB_TransOptions OH_RDB_TransOptions; + +/** + * @brief Define the OH_Rdb_Transaction structure type. + * + * @since 18 + */ +typedef struct OH_Rdb_Transaction OH_Rdb_Transaction; + +/** + * @brief Creates an OH_RDB_TransOptions instance object. + * + * @return Returns a pointer to OH_RDB_TransOptions instance when the execution is successful. + * Otherwise, nullptr is returned. The memory must be released through the OH_RdbTrans_DestroyOptions + * interface after the use is complete. + * @see OH_RdbTrans_DestroyOptions. + * @since 18 + */ +OH_RDB_TransOptions *OH_RdbTrans_CreateOptions(); + +/** + * @brief Destroys an OH_RDB_TransOptions instance object. + * + * @param opitons Represents a pointer to an instance of OH_RDB_TransOptions. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_RdbTrans_DestroyOptions(OH_RDB_TransOptions *opitons); + +/** + * @brief Sets integer data to the opitons object. + * + * @param opitons Represents a pointer to an instance of OH_RDB_TransOptions. + * @param type Represents relation database transaction type. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_RdbTransOption_SetType(OH_RDB_TransOptions *opitons, OH_RDB_TransType type); + +/** + * @brief Commits a transaction of a relational database. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * @since 18 + */ +int OH_RdbTrans_Commit(OH_Rdb_Transaction *trans); + +/** + * @brief Roll back a transaction of a relational database. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * @since 18 + */ +int OH_RdbTrans_Rollback(OH_Rdb_Transaction *trans); + +/** + * @brief Inserts a row of data into the target table. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param table Represents the target table. + * @param row Represents the row data to be inserted into the table. + * @param rowId Represents row line number when insert successfully. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + + * @since 18 + */ +int OH_RdbTrans_Insert(OH_Rdb_Transaction *trans, const char *table, const OH_VBucket *row, int64_t *rowId); + +/** + * @brief Inserts a batch of data into the target table. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param table Represents the target table. + * @param rows Represents the rows data to be inserted into the table. + * @param resolution Represents the resolution when conflict occurs. + * @param changes Represents the number of successful insertions. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * Returns {@link RDB_E_SQLITE_CONSTRAINT} SQLite: Abort due to constraint violation. + * @since 18 + */ +int OH_RdbTrans_BatchInsert(OH_Rdb_Transaction *trans, const char *table, const OH_Data_VBuckets *rows, + Rdb_ConflictResolution resolution, int64_t *changes); + +/** + * @brief Updates data in the database based on specified conditions. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param row Represents the row data to be updated into the table. + * @param predicates Represents the specified update condition by the instance object of OH_Predicates. + * @param changes Represents the number of successful insertions. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @since 18 + */ +int OH_RdbTrans_Update(OH_Rdb_Transaction *trans, const OH_VBucket *row, const OH_Predicates *predicates, + int64_t *changes); + +/** + * @brief Deletes data from the database based on specified conditions + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param predicates Represents the specified update condition by the instance object of OH_Predicates. + * @param changes Represents the number of successfully Deleted. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @since 18 + */ +int OH_RdbTrans_Delete(OH_Rdb_Transaction *trans, const OH_Predicates *predicates, int64_t *changes); + +/** + * @brief Queries data in the database based on specified conditions. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param predicates Represents the specified update condition by the instance object of OH_Predicates. + * @param columns Represents the columns to query. If the value is empty array, the query applies to all columns. + * @param len Represents the number of columns elements. + * @return If the operation is successful, a pointer to the instance of the OH_Cursor structure is returned. + * If database has closed or the database does not respond, nullptr is returned. + * @since 18 + */ +OH_Cursor *OH_RdbTrans_Query(OH_Rdb_Transaction *trans, const OH_Predicates *predicates, const char *columns[], + int len); + +/** + * @brief Queries data in the database based on SQL statement. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param sql Represents the SQL statement to execute. + * @param args Represents a pointer to an instance of OH_Data_Values and it is the selection arguments. + * @return If the operation is successful, a pointer to the instance of the OH_Cursor structure is returned. + * If database has closed or the database does not respond, nullptr is returned. + * @since 18 + */ +OH_Cursor *OH_RdbTrans_QuerySql(OH_Rdb_Transaction *trans, const char *sql, const OH_Data_Values *args); + +/** + * @brief Executes an SQL statement that contains specified parameters. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @param sql Represents the SQL statement to execute. + * @param args Represents the values of the parameters in the SQL statement. + * @param result Represents a pointer to OH_Data_Value instance when the execution is successful. + * The memory must be released through the OH_Value_Destroy interface after the use is complete. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @see OH_Value_Destroy. + * @since 18 + */ +int OH_RdbTrans_Execute(OH_Rdb_Transaction *trans, const char *sql, const OH_Data_Values *args, OH_Data_Value **result); + +/** + * @brief Destroys an OH_Rdb_Transaction instance object. + * + * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * @since 18 + */ +int OH_RdbTrans_Destroy(OH_Rdb_Transaction *trans); + +#ifdef __cplusplus +}; +#endif +#endif // OH_RDB_TRANSACTION_H +/** @} */ diff --git a/distributeddatamgr/relational_store/include/oh_rdb_types.h b/distributeddatamgr/relational_store/include/oh_rdb_types.h new file mode 100644 index 0000000000000000000000000000000000000000..cf0f76bf07bf959828b225b6b355e11bcea4520a --- /dev/null +++ b/distributeddatamgr/relational_store/include/oh_rdb_types.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2025 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 RDB + * @{ + * + * @brief The relational database (RDB) store manages data based on relational models. + * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. + * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations + * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. + * + * @since 10 + */ + +/** + * @file oh_rdb_types.h + * + * @brief Provides type define related to the data value. + * + * @kit ArkData + * @library libnative_rdb_ndk.z.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * + * @since 18 + */ + +#ifndef OH_RDB_TYPES_H +#define OH_RDB_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Describe the security area of the database. + * + * @since 18 + */ +typedef enum Rdb_ConflictResolution { + /** + * @brief Implements no operation when conflict occurs. + */ + RDB_CONFLICT_NONE = 1, + /** + * @brief Implements rollback operation when conflict occurs. + */ + RDB_CONFLICT_ROLLBACK, + /** + * @brief Implements abort operation when conflict occurs. + */ + RDB_CONFLICT_ABORT, + /** + * @brief Implements fail operation when conflict occurs. + */ + RDB_CONFLICT_FAIL, + /** + * @brief Implements ignore operation when conflict occurs. + */ + RDB_CONFLICT_IGNORE, + /** + * @brief Implements replace operation when conflict occurs. + */ + RDB_CONFLICT_REPLACE, +} Rdb_ConflictResolution; + +#ifdef __cplusplus +}; +#endif +#endif +/** @} */ \ No newline at end of file diff --git a/distributeddatamgr/relational_store/include/oh_value_object.h b/distributeddatamgr/relational_store/include/oh_value_object.h index dbe5d0d18a9598c7cf4cd15f12822f2a58141cb5..1c80013f4edb38b42fff1305b8ce33758a2afe82 100644 --- a/distributeddatamgr/relational_store/include/oh_value_object.h +++ b/distributeddatamgr/relational_store/include/oh_value_object.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_VALUE_OBJECT_H -#define OH_VALUE_OBJECT_H - /** * @addtogroup RDB * @{ @@ -25,7 +22,6 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ @@ -35,10 +31,20 @@ * @brief Provides numeric type conversion functions. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef OH_VALUE_OBJECT_H +#define OH_VALUE_OBJECT_H + +#ifdef __cplusplus #include +#else +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -48,7 +54,15 @@ extern "C" { * * @since 10 */ -typedef struct OH_VObject { +typedef struct OH_VObject OH_VObject; + + +/** + * @brief Define the OH_VObject structure type. + * + * @since 10 + */ +struct OH_VObject { /** * The id used to uniquely identify the OH_VObject struct. */ @@ -112,10 +126,12 @@ typedef struct OH_VObject { * @since 10 */ int (*destroy)(OH_VObject *valueObject); -} OH_VObject; +}; #ifdef __cplusplus }; #endif +/** @} */ + #endif // OH_VALUE_OBJECT_H diff --git a/distributeddatamgr/relational_store/include/oh_values_bucket.h b/distributeddatamgr/relational_store/include/oh_values_bucket.h index db822d1de1db6a2a20fa86bdc1b60896d4098374..455e7f97f60ed0d06c0cf64bebd2df4c91c28e5c 100644 --- a/distributeddatamgr/relational_store/include/oh_values_bucket.h +++ b/distributeddatamgr/relational_store/include/oh_values_bucket.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_VALUES_BUCKET_H -#define OH_VALUES_BUCKET_H - /** * @addtogroup RDB * @{ @@ -25,7 +22,6 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ @@ -35,10 +31,20 @@ * @brief Define the type of stored key value pairs. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef OH_VALUES_BUCKET_H +#define OH_VALUES_BUCKET_H + +#ifdef __cplusplus #include +#else +#include +#endif + #include "database/data/data_asset.h" #ifdef __cplusplus extern "C" { @@ -49,7 +55,15 @@ extern "C" { * * @since 10 */ -typedef struct OH_VBucket { +typedef struct OH_VBucket OH_VBucket; + + +/** + * @brief Define the OH_VBucket structure type. + * + * @since 10 + */ +struct OH_VBucket { /** * The id used to uniquely identify the OH_VBucket struct. */ @@ -139,7 +153,7 @@ typedef struct OH_VBucket { * @since 10 */ int (*destroy)(OH_VBucket *bucket); -} OH_VBucket; +}; /** * @brief Put the {@link Data_Asset} * value to this {@link OH_VBucket} object for the given column name. @@ -169,8 +183,41 @@ int OH_VBucket_PutAsset(OH_VBucket *bucket, const char *field, Data_Asset *value * @since 11 */ int OH_VBucket_PutAssets(OH_VBucket *bucket, const char *field, Data_Asset **value, uint32_t count); + +/** + * @brief Put the float vector to the OH_VBucket object. + * + * @param bucket Represents a pointer to an {@link OH_VBucket} instance. + * @param field Represents the name of the column. + * @param vec Represents a pointer to float array. + * @param len Represents the size of float array. + * @return Returns the status code of the execution. + * {@link RDB_OK} - success. + * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. + * @see OH_VBucket. + * @since 18 + */ +int OH_VBucket_PutFloatVector(OH_VBucket *bucket, const char *field, const float *vec, size_t len); + +/** + * @brief Put the an integer of any length to the OH_VBucket object. + * + * @param bucket Represents a pointer to an {@link OH_VBucket} instance. + * @param field Represents the name of the column. + * @param sign Represents 0 is positive integer, 1 is negative integer. + * @param trueForm Represents a pointer to integer array. + * @param len Represents the size of integer array. + * @return Returns the status code of the execution. + * {@link RDB_OK} - success. + * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. + * @see OH_VBucket. + * @since 18 + */ +int OH_VBucket_PutUnlimitedInt(OH_VBucket *bucket, const char *field, int sign, const uint64_t *trueForm, size_t len); #ifdef __cplusplus }; #endif +/** @} */ + #endif // OH_VALUES_BUCKET_H diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index 50ff911643a87759574beeb4d69380df6d1a563f..54d2cc405782a27d4028fe17102aeb47872a0e2d 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef RELATIONAL_STORE_H -#define RELATIONAL_STORE_H - /** * @addtogroup RDB * @{ @@ -25,7 +22,6 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ @@ -35,13 +31,20 @@ * @brief Provides database related functions and enumerations. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef RELATIONAL_STORE_H +#define RELATIONAL_STORE_H + #include "database/rdb/oh_cursor.h" #include "database/rdb/oh_predicates.h" #include "database/rdb/oh_value_object.h" #include "database/rdb/oh_values_bucket.h" +#include "database/rdb/oh_rdb_transaction.h" +#include "database/rdb/oh_rdb_types.h" #ifdef __cplusplus extern "C" { @@ -160,14 +163,14 @@ typedef struct { /** * @brief Define OH_Rdb_ConfigV2 type. * - * @since 13 + * @since 14 */ typedef struct OH_Rdb_ConfigV2 OH_Rdb_ConfigV2; /** * @brief Define Rdb_DBType type. * - * @since 13 + * @since 14 */ typedef enum Rdb_DBType { /** @@ -184,6 +187,26 @@ typedef enum Rdb_DBType { DBTYPE_BUTT = 64, } Rdb_DBType; +/** + * @brief Define Rdb_Tokenizer type. + * + * @since 18 + */ +typedef enum Rdb_Tokenizer { + /** + * @brief Means not using tokenizer. + */ + RDB_NONE_TOKENIZER = 1, + /** + * @brief Means using native icu tokenizer. + */ + RDB_ICU_TOKENIZER = 2, + /** + * @brief Means using self-developed enhance tokenizer. + */ + RDB_CUSTOM_TOKENIZER = 3, +} Rdb_Tokenizer; + /** * @brief Create OH_Rdb_ConfigV2 which is used to open store * @@ -191,7 +214,7 @@ typedef enum Rdb_DBType { * The possible cause is that the address space of the application is full, As a result, the space * cannot be allocated. * @see OH_Rdb_ConfigV2 - * @since 13 + * @since 14 */ OH_Rdb_ConfigV2 *OH_Rdb_CreateConfig(); @@ -203,7 +226,7 @@ OH_Rdb_ConfigV2 *OH_Rdb_CreateConfig(); * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_DestroyConfig(OH_Rdb_ConfigV2 *config); @@ -212,11 +235,11 @@ int OH_Rdb_DestroyConfig(OH_Rdb_ConfigV2 *config); * * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. * Indicates the configuration of the database related to this RDB store. - * @param dataBaseDir Indicates the directory of the database. + * @param databaseDir Indicates the directory of the database. * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetDatabaseDir(OH_Rdb_ConfigV2 *config, const char *databaseDir); @@ -229,7 +252,7 @@ int OH_Rdb_SetDatabaseDir(OH_Rdb_ConfigV2 *config, const char *databaseDir); * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetStoreName(OH_Rdb_ConfigV2 *config, const char *storeName); @@ -242,7 +265,7 @@ int OH_Rdb_SetStoreName(OH_Rdb_ConfigV2 *config, const char *storeName); * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetBundleName(OH_Rdb_ConfigV2 *config, const char *bundleName); @@ -255,7 +278,7 @@ int OH_Rdb_SetBundleName(OH_Rdb_ConfigV2 *config, const char *bundleName); * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetModuleName(OH_Rdb_ConfigV2 *config, const char *moduleName); @@ -264,11 +287,11 @@ int OH_Rdb_SetModuleName(OH_Rdb_ConfigV2 *config, const char *moduleName); * * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. * Indicates the configuration of the database related to this RDB store. - * @param isEncrypt Indicates whether the database is encrypted. + * @param isEncrypted Indicates whether the database is encrypted. * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetEncrypted(OH_Rdb_ConfigV2 *config, bool isEncrypted); @@ -281,7 +304,7 @@ int OH_Rdb_SetEncrypted(OH_Rdb_ConfigV2 *config, bool isEncrypted); * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetSecurityLevel(OH_Rdb_ConfigV2 *config, int securityLevel); @@ -290,10 +313,11 @@ int OH_Rdb_SetSecurityLevel(OH_Rdb_ConfigV2 *config, int securityLevel); * * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. * Indicates the configuration of the database related to this RDB store + * @param area Represents the security area of the database. * @return Returns the status code of the execution. Successful execution returns RDB_OK, * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. - * @since 13 + * @since 14 */ int OH_Rdb_SetArea(OH_Rdb_ConfigV2 *config, int area); @@ -305,15 +329,52 @@ int OH_Rdb_SetArea(OH_Rdb_ConfigV2 *config, int area); * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * {@link RDB_E_NOT_SUPPORTED} - The error code for not support db types. - * @since 13 + * @since 14 */ int OH_Rdb_SetDbType(OH_Rdb_ConfigV2 *config, int dbType); +/** + * @brief Set property tokenizer into config + * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. + * @param tokenizer Indicates the tokenizer {@link Rdb_Tokenizer} of the database + * @return Returns the status code of the execution. Successful execution returns RDB_OK, + * {@link RDB_OK} - success. + * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. + * {@link RDB_E_NOT_SUPPORTED} - The error code for not support tokenizer. + * @since 18 + */ +int OH_Rdb_SetTokenizer(OH_Rdb_ConfigV2 *config, Rdb_Tokenizer tokenizer); + +/** + * @brief Set property persist into config + * + * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. + * Indicates the configuration of the database related to this RDB store. + * @param isPersistent Indicates whether the database need persistence. + * @return Returns the status code of the execution. Successful execution returns RDB_OK, + * {@link RDB_OK} - success. + * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. + * @since 18 + */ +int OH_Rdb_SetPersistent(OH_Rdb_ConfigV2 *config, bool isPersistent); + +/** + * @brief Check if a tokenizer is supported or not. + * + * @param tokenizer the tokenizer type of {@Link Rdb_Tokenizer}. + * @param isSupported Pointer to the Boolean value obtained. + * @return Returns the status code of the execution. + * {@link RDB_OK} indicates the operation is successful. + * {@link RDB_E_INVALID_ARGS} indicates invalid args are passed in. + * @since 18 + */ +int OH_Rdb_IsTokenizerSupported(Rdb_Tokenizer tokenizer, bool *isSupported); + /** * @brief Get support db type list - * @param numType The output parameter, which is used to recieve the length of the support db type array. + * @param typeCount The output parameter, which is used to recieve the length of the support db type array. * @return Return Rdb_DBType array contains supported db type, array length is number of support type - * @since 13 + * @since 14 */ const int *OH_Rdb_GetSupportedDbType(int *typeCount); @@ -380,7 +441,7 @@ OH_Rdb_Store *OH_Rdb_GetOrOpen(const OH_Rdb_Config *config, int *errCode); * If the Config is empty, config.size does not match, or errCode is empty. * Get database path failed.Get RDB Store fail. Nullptr is returned. * @see OH_Rdb_ConfigV2, OH_Rdb_Store. - * @since 13 + * @since 14 */ OH_Rdb_Store *OH_Rdb_CreateOrOpen(const OH_Rdb_ConfigV2 *config, int *errCode); @@ -421,7 +482,7 @@ int OH_Rdb_DeleteStore(const OH_Rdb_Config *config); * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * while failure returns a specific error code. Specific error codes can be referenced {@link OH_Rdb_ErrCode}. * @see OH_Rdb_ErrCode. - * @since 13 + * @since 14 */ int OH_Rdb_DeleteStoreV2(const OH_Rdb_ConfigV2 *config); @@ -440,6 +501,36 @@ int OH_Rdb_DeleteStoreV2(const OH_Rdb_ConfigV2 *config); */ int OH_Rdb_Insert(OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket); +/** + * @brief Inserts a batch of data into the target table. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param table Represents the target table. + * @param rows Represents the rows data to be inserted into the table. + * @param resolution Represents the resolution when conflict occurs. + * @param changes Represents the number of successful insertions. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * Returns {@link RDB_E_SQLITE_CONSTRAINT} SQLite: Abort due to constraint violation. + * @since 18 + */ +int OH_Rdb_BatchInsert(OH_Rdb_Store *store, const char *table, + const OH_Data_VBuckets *rows, Rdb_ConflictResolution resolution, int64_t *changes); + /** * @brief Updates data in the database based on specified conditions. * @@ -500,17 +591,46 @@ OH_Cursor *OH_Rdb_Query(OH_Rdb_Store *store, OH_Predicates *predicates, const ch int OH_Rdb_Execute(OH_Rdb_Store *store, const char *sql); /** - * @brief Write operations are performed using the specified transaction represented by the transaction ID + * @brief Executes an SQL statement. * * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. * @param sql Indicates the SQL statement to execute. + * @param args Represents the values of the parameters in the SQL statement. + * @param result Represents a pointer to OH_Data_Value instance when the execution is successful. + * The memory must be released through the OH_Value_Destroy interface after the use is complete. + * @return Returns the status code of the execution. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. + * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. + * @see OH_Value_Destroy. + * @since 18 + */ +int OH_Rdb_ExecuteV2(OH_Rdb_Store *store, const char *sql, const OH_Data_Values *args, OH_Data_Value **result); + +/** + * @brief Write operations are performed using the specified transaction represented by the transaction ID + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. * @param trxId The transaction ID of the specified transaction, must be greater than 0 + * @param sql Indicates the SQL statement to execute. * @return Returns the status code of the execution. * {@link RDB_OK} - success. * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * {@link RDB_E_NOT_SUPPORTED} - The error code for not supprt. * @see OH_Rdb_Store. - * @since 13 + * @since 14 */ int OH_Rdb_ExecuteByTrxId(OH_Rdb_Store *store, int64_t trxId, const char *sql); @@ -526,6 +646,19 @@ int OH_Rdb_ExecuteByTrxId(OH_Rdb_Store *store, int64_t trxId, const char *sql); */ OH_Cursor *OH_Rdb_ExecuteQuery(OH_Rdb_Store *store, const char *sql); +/** + * @brief Queries data in the database based on an SQL statement. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param sql Indicates the SQL statement to execute. + * @param args Represents a pointer to an instance of OH_Data_Values and it is the selection arguments. + * @return If the query is successful, a pointer to the instance of the @link OH_Cursor} structure is returned. + * If sql statement is invalid or the memory allocate failed, nullptr is returned. + * @see OH_Rdb_Store. + * @since 18 + */ +OH_Cursor *OH_Rdb_ExecuteQueryV2(OH_Rdb_Store *store, const char *sql, const OH_Data_Values *args); + /** * @brief Begins a transaction in EXCLUSIVE mode. * @@ -572,7 +705,7 @@ int OH_Rdb_Commit(OH_Rdb_Store *store); * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * {@link RDB_E_NOT_SUPPORTED} - The error code for not supprt. * @see OH_Rdb_Store. - * @since 13 + * @since 14 */ int OH_Rdb_BeginTransWithTrxId(OH_Rdb_Store *store, int64_t *trxId); @@ -586,7 +719,7 @@ int OH_Rdb_BeginTransWithTrxId(OH_Rdb_Store *store, int64_t *trxId); * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * {@link RDB_E_NOT_SUPPORTED} - The error code for not supprt. * @see OH_Rdb_Store. - * @since 13 + * @since 14 */ int OH_Rdb_RollBackByTrxId(OH_Rdb_Store *store, int64_t trxId); @@ -600,7 +733,7 @@ int OH_Rdb_RollBackByTrxId(OH_Rdb_Store *store, int64_t trxId); * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. * {@link RDB_E_NOT_SUPPORTED} - The error code for not supprt. * @see OH_Rdb_Store. - * @since 13 + * @since 14 */ int OH_Rdb_CommitByTrxId(OH_Rdb_Store *store, int64_t trxId); @@ -1245,8 +1378,37 @@ int OH_Rdb_UnlockRow(OH_Rdb_Store *store, OH_Predicates *predicates); */ OH_Cursor *OH_Rdb_QueryLockedRow( OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length); + +/** + * @brief Creates an OH_Rdb_Transaction instance object. + * + * @param store Represents a pointer to an instance of OH_Rdb_Store. + * @param options Represents a pointer to an instance of OH_RDB_TransOptions. + * @param trans Represents a pointer to OH_Rdb_Transaction instance when the execution is successful. + * Otherwise, nullptr is returned. The memory must be released through the OH_RdbTrans_Destroy + * interface after the use is complete. + * @return Returns the error code. + * Returns {@link RDB_OK} if the execution is successful. + * Returns {@link RDB_E_ERROR} database common error. + * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. + * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. + * Returns {@link RDB_E_DATABASE_BUSY} database does not respond. + * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. + * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. + * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. + * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. + * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. + * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. + * Returns {@link RDB_E_SQLITE_CANT_OPEN} SQLite: Unable to open the database file. + * @see OH_RdbTrans_Destroy. + * @since 18 + */ +int OH_Rdb_CreateTransaction(OH_Rdb_Store *store, const OH_RDB_TransOptions *options, OH_Rdb_Transaction **trans); + #ifdef __cplusplus }; #endif +/** @} */ + #endif // RELATIONAL_STORE_H diff --git a/distributeddatamgr/relational_store/include/relational_store_error_code.h b/distributeddatamgr/relational_store/include/relational_store_error_code.h index 9fc2f6d2d0a56f41c583b2eb61b21e856424c293..c75b849e0a27769b2f621242b7d06217661a2cab 100644 --- a/distributeddatamgr/relational_store/include/relational_store_error_code.h +++ b/distributeddatamgr/relational_store/include/relational_store_error_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef RELATIONAL_STORE_ERRNO_CODE_H -#define RELATIONAL_STORE_ERRNO_CODE_H - /** * @addtogroup RDB * @{ @@ -25,20 +22,23 @@ * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. * - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ - /** * @file relational_store_error_code.h * * @brief Declaration error code information. * * @kit ArkData + * @library libnative_rdb_ndk.so + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 10 */ +#ifndef RELATIONAL_STORE_ERRNO_CODE_H +#define RELATIONAL_STORE_ERRNO_CODE_H + #ifdef __cplusplus extern "C" { #endif @@ -307,11 +307,125 @@ typedef enum OH_Rdb_ErrCode { /** * @brief The error when the connection count is used up. */ - RDB_E_CON_OVER_LIMIT = (E_BASE + 48) + RDB_E_CON_OVER_LIMIT = (E_BASE + 48), + + /** + * @brief Database already closed. + * + * @since 18 + */ + RDB_E_ALREADY_CLOSED = (E_BASE + 50), + + /** + * @brief The database does not respond. + * + * @since 18 + */ + RDB_E_DATABASE_BUSY = (E_BASE + 51), + + /** + * @brief Database corrupted. + * + * @since 18 + */ + RDB_E_SQLITE_CORRUPT = (E_BASE + 52), + + /** + * @brief SQLite: Access permission denied. + * + * @since 18 + */ + RDB_E_SQLITE_PERM = (E_BASE + 53), + + /** + * @brief SQLite: The database file is locked. + * + * @since 18 + */ + RDB_E_SQLITE_BUSY = (E_BASE + 54), + + /** + * @brief SQLite: A table in the database is locked. + * + * @since 18 + */ + RDB_E_SQLITE_LOCKED = (E_BASE + 55), + + /** + * @brief SQLite: The database is out of memory. + * + * @since 18 + */ + RDB_E_SQLITE_NOMEM = (E_BASE + 56), + + /** + * @brief SQLite: Attempt to write a readonly database. + * + * @since 18 + */ + RDB_E_SQLITE_READONLY = (E_BASE + 57), + + /** + * @brief SQLite: Some kind of disk I/O error occurred. + * + * @since 18 + */ + RDB_E_SQLITE_IOERR = (E_BASE + 58), + + /** + * @brief SQLite: The database is full. + * + * @since 18 + */ + RDB_E_SQLITE_FULL = (E_BASE + 59), + + /** + * @brief SQLite: Unable to open the database file. + * + * @since 18 + */ + RDB_E_SQLITE_CANT_OPEN = (E_BASE + 60), + + /** + * @brief SQLite: TEXT or BLOB exceeds size limit. + * + * @since 18 + */ + RDB_E_SQLITE_TOO_BIG = (E_BASE + 61), + + /** + * @brief SQLite: Data type mismatch. + * + * @since 18 + */ + RDB_E_SQLITE_MISMATCH = (E_BASE + 62), + + /** + * @brief Data value type is null. + * + * @since 18 + */ + RDB_E_DATA_TYPE_NULL = (E_BASE + 63), + + /** + * @brief Data value type mismatch. + * + * @since 18 + */ + RDB_E_TYPE_MISMATCH = (E_BASE + 64), + + /** + * @brief Data value type is null. + * + * @since 18 + */ + RDB_E_SQLITE_CONSTRAINT = (E_BASE + 65), } OH_Rdb_ErrCode; #ifdef __cplusplus }; #endif +/** @} */ + #endif // RELATIONAL_STORE_ERRNO_CODE_H \ No newline at end of file diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index 4d72ebe84601236bffeabef5d779e216e164172b..5d4110e087074620dbbcfdfba17a5a37ba4cda57 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -1,120 +1,530 @@ [ - {"name":"OH_Rdb_CreatePredicates" }, - {"name":"OH_Rdb_CreateValueObject" }, - {"name":"OH_Rdb_CreateValuesBucket" }, - { - "first_introduced":"13", - "name":"OH_Rdb_CreateConfig" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetDatabaseDir" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetStoreName" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetBundleName" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetModuleName" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetEncrypted" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetSecurityLevel" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetArea" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_SetDbType" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_GetSupportedDbType" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_DestroyConfig" - }, - {"name":"OH_Rdb_GetOrOpen" }, - { - "first_introduced": "13", - "name":"OH_Rdb_CreateOrOpen" - }, - {"name":"OH_Rdb_CloseStore" }, - {"name":"OH_Rdb_DeleteStore" }, - { - "first_introduced": "13", - "name":"OH_Rdb_DeleteStoreV2" - }, - {"name":"OH_Rdb_Insert" }, - {"name":"OH_Rdb_Update" }, - {"name":"OH_Rdb_Delete" }, - {"name":"OH_Rdb_Query" }, - {"name":"OH_Rdb_Execute" }, - { - "first_introduced": "13", - "name":"OH_Rdb_ExecuteByTrxId" - }, - {"name":"OH_Rdb_ExecuteQuery" }, - {"name":"OH_Rdb_BeginTransaction" }, - {"name":"OH_Rdb_RollBack" }, - {"name":"OH_Rdb_Commit" }, - { - "first_introduced": "13", - "name":"OH_Rdb_BeginTransWithTrxId" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_RollBackByTrxId" - }, - { - "first_introduced": "13", - "name":"OH_Rdb_CommitByTrxId" - }, - {"name":"OH_Rdb_Backup" }, - {"name":"OH_Rdb_Restore"}, - {"name":"OH_Rdb_GetVersion"}, - {"name":"OH_Rdb_SetVersion"}, - {"name":"OH_Rdb_SetDistributedTables"}, - {"name":"OH_Rdb_FindModifyTime"}, - {"name":"OH_Rdb_GetTableDetails"}, - {"name":"OH_Rdb_CloudSync"}, - {"name":"OH_VBucket_PutAsset"}, - {"name":"OH_VBucket_PutAssets"}, - {"name":"OH_Data_Asset_SetName"}, - {"name":"OH_Data_Asset_SetUri"}, - {"name":"OH_Data_Asset_SetPath"}, - {"name":"OH_Data_Asset_SetCreateTime"}, - {"name":"OH_Data_Asset_SetModifyTime"}, - {"name":"OH_Data_Asset_SetSize"}, - {"name":"OH_Data_Asset_SetStatus"}, - {"name":"OH_Data_Asset_GetName"}, - {"name":"OH_Data_Asset_GetUri"}, - {"name":"OH_Data_Asset_GetPath"}, - {"name":"OH_Data_Asset_GetCreateTime"}, - {"name":"OH_Data_Asset_GetModifyTime"}, - {"name":"OH_Data_Asset_GetSize"}, - {"name":"OH_Data_Asset_GetStatus"}, - {"name":"OH_Data_Asset_CreateOne"}, - {"name":"OH_Data_Asset_DestroyOne"}, - {"name":"OH_Data_Asset_CreateMultiple"}, - {"name":"OH_Data_Asset_DestroyMultiple"}, - {"name":"OH_Rdb_Subscribe"}, - {"name":"OH_Rdb_Unsubscribe"}, - {"name":"OH_Rdb_SubscribeAutoSyncProgress"}, - {"name":"OH_Rdb_UnsubscribeAutoSyncProgress"}, - {"name":"OH_Rdb_LockRow"}, - {"name":"OH_Rdb_UnlockRow"}, - {"name":"OH_Rdb_QueryLockedRow"} + { + "name":"OH_Rdb_CreatePredicates" + }, + { + "name":"OH_Rdb_CreateValueObject" + }, + { + "name":"OH_Rdb_CreateValuesBucket" + }, + { + "first_introduced":"14", + "name":"OH_Rdb_CreateConfig" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetDatabaseDir" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetStoreName" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetBundleName" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetModuleName" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetEncrypted" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetSecurityLevel" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetArea" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_SetDbType" + }, + { + "first_introduced": "18", + "name":"OH_Rdb_SetPersistent" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_GetSupportedDbType" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_DestroyConfig" + }, + {"name":"OH_Rdb_GetOrOpen" }, + { + "first_introduced": "14", + "name":"OH_Rdb_CreateOrOpen" + }, + { + "name":"OH_Rdb_CloseStore" + }, + { + "name":"OH_Rdb_DeleteStore" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_DeleteStoreV2" + }, + { + "name":"OH_Rdb_Insert" + }, + { + "first_introduced": "18", + "name":"OH_Rdb_BatchInsert" + }, + { + "name":"OH_Rdb_Update" + }, + { + "name":"OH_Rdb_Delete" + }, + { + "name":"OH_Rdb_Query" + }, + { + "name":"OH_Rdb_Execute" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_ExecuteByTrxId" + }, + { + "name":"OH_Rdb_ExecuteQuery" + }, + { + "name":"OH_Rdb_BeginTransaction" + }, + { + "name":"OH_Rdb_RollBack" + }, + { + "name":"OH_Rdb_Commit" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_BeginTransWithTrxId" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_RollBackByTrxId" + }, + { + "first_introduced": "14", + "name":"OH_Rdb_CommitByTrxId" + }, + { + "name":"OH_Rdb_Backup" + }, + { + "name":"OH_Rdb_Restore" + }, + { + "name":"OH_Rdb_GetVersion" + }, + { + "name":"OH_Rdb_SetVersion" + }, + { + "name":"OH_Rdb_SetDistributedTables" + }, + { + "name":"OH_Rdb_FindModifyTime" + }, + { + "name":"OH_Rdb_GetTableDetails" + }, + { + "name":"OH_Rdb_CloudSync" + }, + { + "name":"OH_VBucket_PutAsset" + }, + { + "name":"OH_VBucket_PutAssets" + }, + { + "name":"OH_Data_Asset_SetName" + }, + { + "name":"OH_Data_Asset_SetUri" + }, + { + "name":"OH_Data_Asset_SetPath" + }, + { + "name":"OH_Data_Asset_SetCreateTime" + }, + { + "name":"OH_Data_Asset_SetModifyTime" + }, + { + "name":"OH_Data_Asset_SetSize" + }, + { + "name":"OH_Data_Asset_SetStatus" + }, + { + "name":"OH_Data_Asset_GetName" + }, + { + "name":"OH_Data_Asset_GetUri" + }, + { + "name":"OH_Data_Asset_GetPath" + }, + { + "name":"OH_Data_Asset_GetCreateTime" + }, + { + "name":"OH_Data_Asset_GetModifyTime" + }, + { + "name":"OH_Data_Asset_GetSize" + }, + { + "name":"OH_Data_Asset_GetStatus" + }, + { + "name":"OH_Data_Asset_CreateOne" + }, + { + "name":"OH_Data_Asset_DestroyOne" + }, + { + "name":"OH_Data_Asset_CreateMultiple" + }, + { + "name":"OH_Data_Asset_DestroyMultiple" + }, + { + "name":"OH_Rdb_Subscribe" + }, + { + "name":"OH_Rdb_Unsubscribe" + }, + { + "name":"OH_Rdb_SubscribeAutoSyncProgress" + }, + { + "name":"OH_Rdb_UnsubscribeAutoSyncProgress" + }, + { + "name":"OH_Rdb_LockRow" + }, + { + "name":"OH_Rdb_UnlockRow" + }, + { + "name":"OH_Rdb_QueryLockedRow" + }, + { + "first_introduced": "18", + "name":"OH_Value_Create" + }, + { + "first_introduced": "18", + "name":"OH_Value_Destroy" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutNull" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutInt" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutReal" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutText" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutBlob" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutAsset" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutAssets" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutFloatVector" + }, + { + "first_introduced": "18", + "name":"OH_Value_PutUnlimitedInt" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetType" + }, + { + "first_introduced": "18", + "name":"OH_Value_IsNull" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetInt" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetReal" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetText" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetBlob" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetAsset" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetAssetsCount" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetAssets" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetFloatVectorCount" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetFloatVector" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetUnlimitedIntBand" + }, + { + "first_introduced": "18", + "name":"OH_Value_GetUnlimitedInt" + }, + { + "first_introduced": "18", + "name":"OH_VBuckets_Create" + }, + { + "first_introduced": "18", + "name":"OH_VBuckets_Destroy" + }, + { + "first_introduced": "18", + "name":"OH_VBuckets_PutRow" + }, + { + "first_introduced": "18", + "name":"OH_VBuckets_PutRows" + }, + { + "first_introduced": "18", + "name":"OH_VBuckets_RowCount" + }, + { + "first_introduced": "18", + "name":"OH_Values_Create" + }, + { + "first_introduced": "18", + "name":"OH_Values_Destroy" + }, + { + "first_introduced": "18", + "name":"OH_Values_Put" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutNull" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutInt" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutReal" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutText" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutBlob" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutAsset" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutAssets" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutFloatVector" + }, + { + "first_introduced": "18", + "name":"OH_Values_PutUnlimitedInt" + }, + { + "first_introduced": "18", + "name":"OH_Values_Count" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetType" + }, + { + "first_introduced": "18", + "name":"OH_Values_Get" + }, + { + "first_introduced": "18", + "name":"OH_Values_IsNull" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetInt" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetReal" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetText" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetBlob" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetAsset" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetAssetsCount" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetAssets" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetFloatVectorCount" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetFloatVector" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetUnlimitedIntBand" + }, + { + "first_introduced": "18", + "name":"OH_Values_GetUnlimitedInt" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_CreateOptions" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_DestroyOptions" + }, + { + "first_introduced": "18", + "name":"OH_RdbTransOption_SetType" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Commit" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Rollback" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Insert" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_BatchInsert" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Update" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Delete" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Query" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_QuerySql" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Execute" + }, + { + "first_introduced": "18", + "name":"OH_RdbTrans_Destroy" + }, + { + "first_introduced": "18", + "name":"OH_Rdb_CreateTransaction" + }, + { + "first_introduced": "18", + "name":"OH_VBucket_PutFloatVector" + }, + { + "first_introduced": "18", + "name":"OH_VBucket_PutUnlimitedInt" + }, + { + "first_introduced": "18", + "name":"OH_Rdb_ExecuteV2" + }, + { + "first_introduced": "18", + "name":"OH_Rdb_ExecuteQueryV2" + }, + { + "first_introduced": "18", + "name":"OH_Cursor_GetFloatVectorCount" + }, + { + "first_introduced": "18", + "name":"OH_Cursor_GetFloatVector" + } ] \ No newline at end of file diff --git a/distributeddatamgr/udmf/include/udmf.h b/distributeddatamgr/udmf/include/udmf.h index e79579b5fdf2311e54f8edaca483e0fa1a87f84d..171f4ca522990fdfcdb21141f08f5a4995e8bbcd 100644 --- a/distributeddatamgr/udmf/include/udmf.h +++ b/distributeddatamgr/udmf/include/udmf.h @@ -90,6 +90,38 @@ typedef enum Udmf_ShareOption { SHARE_OPTIONS_CROSS_APP } Udmf_ShareOption; +/** + * @brief Describe the types of file conflict options when getting data from the udmf. + * + * @since 15 + */ +typedef enum Udmf_FileConflictOptions { + /** + * @brief Overwrite when dest uri has file with same name. + */ + UDMF_OVERWRITE = 0, + /** + * @brief Skip when dest uri has file with same name. + */ + UDMF_SKIP = 1, +} Udmf_FileConflictOptions; + +/** + * @brief Describe the types of progress indicator when getting data from the udmf. + * + * @since 15 +*/ +typedef enum Udmf_ProgressIndicator { + /** + * @brief Getting data without system default progress indicator. + */ + UDMF_NONE = 0, + /** + * @brief Getting data with system default progress indicator. + */ + UDMF_DEFAULT = 1 +} Udmf_ProgressIndicator; + /** * @brief Describes the unified data type. * @@ -118,6 +150,29 @@ typedef struct OH_UdmfRecordProvider OH_UdmfRecordProvider; */ typedef struct OH_UdmfProperty OH_UdmfProperty; +/** + * @brief Represents the udmf progress information. + * + * @since 15 +*/ +typedef struct OH_Udmf_ProgressInfo OH_Udmf_ProgressInfo; + +/** + * @brief Represents the parameters of udmf get data with progress info. + * + * @since 15 +*/ +typedef struct OH_UdmfGetDataParams OH_UdmfGetDataParams; + +/** + * @brief Defines the callback function used to return the progress information and data. + * + * @param progressInfo The progress information notified to Application. + * @param data Represents the unified data. + * @since 15 +*/ +typedef void (*OH_Udmf_DataProgressListener)(OH_Udmf_ProgressInfo* progressInfo, OH_UdmfData* data); + /** * @brief Creation a pointer to the instance of the {@link OH_UdmfData}. * @@ -206,7 +261,7 @@ OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create(); /** * @brief Destroy an {@link OH_UdmfRecordProvider} instance. * - * @param subscriber Pointer to the {@link OH_UdmfRecordProvider} instance to destroy. + * @param provider Pointer to the {@link OH_UdmfRecordProvider} instance to destroy. * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}. * Returns {@link UDMF_E_OK} if the operation is successful. * Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected. @@ -368,6 +423,19 @@ int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap); */ int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer); +/** + * @brief Add one {@link OH_UdsContentForm} data to the {@link OH_UdmfRecord} record. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}. + * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode. + * @since 14 + */ +int OH_UdmfRecord_AddContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm); + /** * @brief Get all types in the {@link OH_UdmfRecord} record. * @@ -454,22 +522,6 @@ int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html); int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem); /** - * @brief Set the data provider of the types. - * - * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}. - * @param types Represents a pointer to a group of data types; - * @param count Represents the number of data types; - * @param provider Represents a pointer an instance of {@link OH_UdmfRecordProvider}. - * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. - * {@link UDMF_E_OK} success. - * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. - * @see OH_UdmfRecord OH_UdmfRecordProvider Udmf_ErrCode. - * @since 13 - */ -int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count, - OH_UdmfRecordProvider* provider); - -/** * @brief Get one {OH_UdsFileUri} data from the {@link OH_UdmfRecord} record. * * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}. @@ -495,6 +547,22 @@ int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri); */ int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap); +/** + * @brief Set the data provider of the types. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}. + * @param types Represents a pointer to a group of data types; + * @param count Represents the number of data types; + * @param provider Represents a pointer an instance of {@link OH_UdmfRecordProvider}. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdmfRecord OH_UdmfRecordProvider Udmf_ErrCode. + * @since 13 + */ +int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count, + OH_UdmfRecordProvider* provider); + /** * @brief Get one {@link OH_UdsArrayBuffer} data from the {@link OH_UdmfRecord} record. * @@ -509,6 +577,19 @@ int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap); */ int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer); +/** + * @brief Get one {@link OH_UdsContentForm} data from the {@link OH_UdmfRecord} record. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}. + * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode. + * @since 14 + */ +int OH_UdmfRecord_GetContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm); + /** * @brief Get primary {@link OH_UdsPlainText} data from the {@link OH_UdmfData}. * @@ -731,6 +812,87 @@ int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfDat int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData, char* key, unsigned int keyLen); +/** + * @brief Gets the progress from the {@OH_Udmf_ProgressInfo}. + * + * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}. + * @return Returns the progress. + * @see OH_Udmf_ProgressInfo + * @since 15 + */ +int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo); + +/** + * @brief Gets the status from the {@OH_Udmf_ProgressInfo}. + * + * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}. + * @return Returns the status code. See {@link Udmf_ListenerStatus}. + * @see OH_Udmf_ProgressInfo Udmf_ListenerStatus + * @since 15 + */ +int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo); + +/** + * @brief Creation a pointer to the instance of the {@link OH_UdmfGetDataParams}. + * + * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfGetDataParams} + * structure is returned. If the operation is failed, nullptr is returned. + * @see OH_UdmfGetDataParams + * @since 15 + */ +OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create(); + +/** + * @brief Destroy a pointer that points to an instance of {@link OH_UdmfGetDataParams}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @see OH_UdmfGetDataParams + * @since 15 + */ +void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis); + +/** + * @brief Sets the destination uri to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param destUri Pointer to a destination uri. + * @see OH_UdmfGetDataParams + * @since 15 + */ +void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri); + +/** + * @brief Sets the file conflict options to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param options Represents to the file conflict options. + * @see OH_UdmfGetDataParams Udmf_FileConflictOptions + * @since 15 + */ +void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options); + +/** + * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param progressIndicator Represents to the progress indicator. + * @see OH_UdmfGetDataParams Udmf_ProgressIndicator + * @since 15 + */ +void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params, + const Udmf_ProgressIndicator progressIndicator); + +/** + * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}. + * + * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}. + * @param dataProgressListener Represents to the data progress listener. + * @see OH_UdmfGetDataParams OH_Udmf_DataProgressListener + * @since 15 + */ +void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params, + const OH_Udmf_DataProgressListener dataProgressListener); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/include/udmf_err_code.h b/distributeddatamgr/udmf/include/udmf_err_code.h index 105191c7c040db176267497551b13ee668468dd6..f3db582c673095baf2f945bbb87f1900fc99bd31 100644 --- a/distributeddatamgr/udmf/include/udmf_err_code.h +++ b/distributeddatamgr/udmf/include/udmf_err_code.h @@ -66,6 +66,46 @@ typedef enum Udmf_ErrCode { UDMF_E_INVALID_PARAM = (UDMF_ERR + 1), } Udmf_ErrCode; +/** + * @brief Indicates the error code information. + * + * @since 15 + */ +typedef enum Udmf_ListenerStatus { + /** + * brief Indicates the finished status. + */ + UDMF_FINISHED = 0, + /** + * @brief Indicates that processing is still in progress. + */ + UDMF_PROCESSING, + /** + * @brief Indicates that the process has been canceled. + */ + UDMF_CANCELED, + /** + * @brief Indicates that an internal error has occurred. + */ + UDMF_INNER_ERROR = 200, + /** + * @brief Indicates that the GetDataParams contains invalid parameters. + */ + UDMF_INVALID_PARAMETERS, + /** + * @brief Indicates that no data is obtained. + */ + UDMF_DATA_NOT_FOUND, + /** + * @brief Indicates that an error occurred in the synchronization process. + */ + UDMF_SYNC_FAILED, + /** + * @brief Indicates that an error occurred during file copying. + */ + UDMF_COPY_FILE_FAILED, +} Udmf_ListenerStatus; + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/include/udmf_meta.h b/distributeddatamgr/udmf/include/udmf_meta.h index 25b31bf8012b6862bf14a73203029842ad353681..cfe651a89e0d3fc20011f09f7d617abaa6b69929 100644 --- a/distributeddatamgr/udmf/include/udmf_meta.h +++ b/distributeddatamgr/udmf/include/udmf_meta.h @@ -997,6 +997,13 @@ extern "C" { */ #define UDMF_META_GENERAL_FILE_URI "general.file-uri" +/** + * @brief A specific type of uniform data type. + * + * @since 14 + */ +#define UDMF_METE_GENERAL_CONTENT_FORM "general.content-form" + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/include/uds.h b/distributeddatamgr/udmf/include/uds.h index 4ccef6ebee330286d3be09a5d56640098392994b..e7450a53a8ccad49019dd22ccd9f6913b16f14aa 100644 --- a/distributeddatamgr/udmf/include/uds.h +++ b/distributeddatamgr/udmf/include/uds.h @@ -89,6 +89,13 @@ typedef struct OH_UdsFileUri OH_UdsFileUri; */ typedef struct OH_UdsPixelMap OH_UdsPixelMap; +/** + * @brief Describes the unified data struct of content form. + * + * @since 14 + */ +typedef struct OH_UdsContentForm OH_UdsContentForm; + /** * @brief Describes the unified data struct of array buffer. * @@ -665,6 +672,185 @@ int OH_UdsArrayBuffer_SetData(OH_UdsArrayBuffer* buffer, unsigned char* data, un */ int OH_UdsArrayBuffer_GetData(OH_UdsArrayBuffer* buffer, unsigned char** data, unsigned int* len); +/** + * @brief Creation a pointer to the instance of the {@link OH_UdsContentForm}. + * + * @return If the operation is successful, a pointer to the instance of the {@link OH_UdsContentForm} + * structure is returned. If the operation is failed, nullptr is returned. + * @see OH_UdsContentForm + * @since 14 + */ +OH_UdsContentForm* OH_UdsContentForm_Create(); + +/** + * @brief Destroy a pointer that points to the {@link OH_UdsContentForm} instance. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @see OH_UdsContentForm + * @since 14 + */ +void OH_UdsContentForm_Destroy(OH_UdsContentForm* pThis); + +/** + * @brief Get type id from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns a pointer of the value string when input args normally, otherwise return nullptr. + * @see OH_UdsContentForm + * @since 14 + */ +const char* OH_UdsContentForm_GetType(OH_UdsContentForm* pThis); + +/** + * @brief Get thumb data from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param thumbData Represents a pointer to thumb data that is a output param. + * @param len Represents the thumb data length that is a output param. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * {@link UDMF_ERR} Internal data error. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_GetThumbData(OH_UdsContentForm* pThis, unsigned char** thumbData, unsigned int* len); + +/** + * @brief Get description from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns a pointer of the value string when input args normally, otherwise return nullptr. + * @see OH_UdsContentForm + * @since 14 + */ +const char* OH_UdsContentForm_GetDescription(OH_UdsContentForm* pThis); + +/** + * @brief Get title from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns a pointer of the value string when input args normally, otherwise return nullptr. + * @see OH_UdsContentForm + * @since 14 + */ +const char* OH_UdsContentForm_GetTitle(OH_UdsContentForm* pThis); + +/** + * @brief Get thumb data from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param appIcon Represents a pointer to app icon that is a output param. + * @param len Represents the app icon length that is a output param. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * {@link UDMF_ERR} Internal data error. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_GetAppIcon(OH_UdsContentForm* pThis, unsigned char** appIcon, unsigned int* len); + +/** + * @brief Get app name from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns a pointer of the value string when input args normally, otherwise return nullptr. + * @see OH_UdsContentForm + * @since 14 + */ +const char* OH_UdsContentForm_GetAppName(OH_UdsContentForm* pThis); + +/** + * @brief Get link url from the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @return Returns a pointer of the value string when input args normally, otherwise return nullptr. + * @see OH_UdsContentForm + * @since 14 + */ +const char* OH_UdsContentForm_GetLinkUri(OH_UdsContentForm* pThis); + +/** + * @brief Set thumb data to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param thumbData Represents the thumb data. + * @param len Represents the length of thumb data param. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetThumbData(OH_UdsContentForm* pThis, const unsigned char* thumbData, unsigned int len); + +/** + * @brief Set description to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param description Represents a description string. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetDescription(OH_UdsContentForm* pThis, const char* description); + +/** + * @brief Set title to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param title Represents a title string. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetTitle(OH_UdsContentForm* pThis, const char* title); + +/** + * @brief Set thumb data to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param appIcon Represents the app icon. + * @param len Represents the length of app icon param. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetAppIcon(OH_UdsContentForm* pThis, const unsigned char* appIcon, unsigned int len); + +/** + * @brief Set app name to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param appName Represents a app name string. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetAppName(OH_UdsContentForm* pThis, const char* appName); + +/** + * @brief Set link uri to the {@link OH_UdsContentForm}. + * + * @param pThis Represents a pointer to an instance of {@link OH_UdsContentForm}. + * @param linkUri Represents a link uri string. + * @return Returns the status code of the execution. See {@link Udmf_ErrCode}. + * {@link UDMF_E_OK} success. + * {@link UDMF_E_INVALID_PARAM} The error code for common invalid args. + * @see OH_UdsContentForm Udmf_ErrCode + * @since 14 + */ +int OH_UdsContentForm_SetLinkUri(OH_UdsContentForm* pThis, const char* linkUri); + #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/udmf/libudmf.ndk.json b/distributeddatamgr/udmf/libudmf.ndk.json index fc246ae6d0b0a43ec0b11a9970625a6bc2c7c8aa..561cd69ebabd1c6e3bfd87ab08ad2fd450a0b8b2 100644 --- a/distributeddatamgr/udmf/libudmf.ndk.json +++ b/distributeddatamgr/udmf/libudmf.ndk.json @@ -458,5 +458,105 @@ { "first_introduced": "13", "name": "OH_UdsArrayBuffer_GetData" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_Create" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_Destroy" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetType" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetThumbData" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetDescription" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetTitle" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetAppIcon" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetAppName" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_GetLinkUri" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetThumbData" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetDescription" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetTitle" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetAppIcon" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetAppName" + }, + { + "first_introduced": "14", + "name": "OH_UdsContentForm_SetLinkUri" + }, + { + "first_introduced": "14", + "name": "OH_UdmfRecord_AddContentForm" + }, + { + "first_introduced": "14", + "name": "OH_UdmfRecord_GetContentForm" + }, + { + "first_introduced": "15", + "name": "OH_UdmfProgressInfo_GetProgress" + }, + { + "first_introduced": "15", + "name": "OH_UdmfProgressInfo_GetStatus" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_Create" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_Destroy" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetDestUri" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetFileConflictOptions" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetProgressIndicator" + }, + { + "first_introduced": "15", + "name": "OH_UdmfGetDataParams_SetDataProgressListener" } ] \ No newline at end of file diff --git a/drivers/external_device_manager/base/ddk_api.h b/drivers/external_device_manager/base/ddk_api.h index 41d69c7b66d838f6c8c0ce6ef0d7d65b04da25a4..b5eb3005bd9191a208db204f7f813eb06de551bb 100644 --- a/drivers/external_device_manager/base/ddk_api.h +++ b/drivers/external_device_manager/base/ddk_api.h @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef DDK_API_H -#define DDK_API_H /** * @addtogroup Ddk @@ -36,6 +34,9 @@ * @since 12 */ +#ifndef DDK_API_H +#define DDK_API_H + #include #include "ddk_types.h" diff --git a/drivers/external_device_manager/base/ddk_types.h b/drivers/external_device_manager/base/ddk_types.h index e9e352c873b67aa0e4d70dc5ec86796fde82cbb1..b136513677027efe9fceb7d6ac3be863394f382e 100644 --- a/drivers/external_device_manager/base/ddk_types.h +++ b/drivers/external_device_manager/base/ddk_types.h @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef DDK_TYPES_H -#define DDK_TYPES_H /** * @addtogroup Ddk @@ -36,6 +34,9 @@ * @since 12 */ +#ifndef DDK_TYPES_H +#define DDK_TYPES_H + #include #include diff --git a/drivers/external_device_manager/hid/hid_ddk_api.h b/drivers/external_device_manager/hid/hid_ddk_api.h index b5d535a107598c9e7f6f793d9d0ce2b8a2c0c326..8ceafb01a6a2cd1f14505c637ec4039b8296fa61 100644 --- a/drivers/external_device_manager/hid/hid_ddk_api.h +++ b/drivers/external_device_manager/hid/hid_ddk_api.h @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef HID_DDK_API_H -#define HID_DDK_API_H /** * @addtogroup HidDdk @@ -32,11 +30,16 @@ * @brief Declares the HID DDK interfaces for the host to access an input device. * * @kit DriverDevelopmentKit + * @library libhid.z.so + * @syscap SystemCapability.Driver.HID.Extension * File to include: * @since 11 * @version 1.0 */ +#ifndef HID_DDK_API_H +#define HID_DDK_API_H + #include #include "hid_ddk_types.h" @@ -80,8 +83,7 @@ int32_t OH_Hid_CreateDevice(Hid_Device *hidDevice, Hid_EventProperties *hidEvent * {@link HID_DDK_INVALID_OPERATION} connect hid ddk service failed or the caller is not the creator of device. * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.deviceId is less than 0;\n * 2.length exceeds 7; 3.items is null. - * {@link HID_DDK_NULL_PTR} the inject of device is null. - * {@link HID_DDK_FAILURE} the device does not exit. + * {@link HID_DDK_NULL_PTR} the device does not exist. * @since 11 * @version 1.0 */ @@ -95,12 +97,293 @@ int32_t OH_Hid_EmitEvent(int32_t deviceId, const Hid_EmitItem items[], uint16_t * @return {@link HID_DDK_SUCCESS} operation successful. * {@link HID_DDK_NO_PERM} permission check failed. * {@link HID_DDK_INVALID_OPERATION} connect hid ddk service failed or the caller is not the creator of device. - * {@link HID_DDK_FAILURE} the device does not exit. * @since 11 * @version 1.0 */ int32_t OH_Hid_DestroyDevice(int32_t deviceId); +/** + * @brief Initializes the HID DDK. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INIT_ERROR} create DDK instance failed. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * @since 18 + */ +int32_t OH_Hid_Init(void); + +/** + * @brief Releases the HID DDK. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * @since 18 + */ +int32_t OH_Hid_Release(void); + +/** + * @brief Open HID device by deviceId in blocking mode. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param deviceId ID of the device to be operated. + * @param interfaceIndex Interface index, which corresponds to interface which supports USB protocol HID. + * @param dev Device operation handle. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } alloc memory of dev failed. + * {@link HID_DDK_IO_ERROR} open device failed. + * {@link HID_DDK_INVALID_PARAMETER} dev is null. + * {@link HID_DDK_DEVICE_NOT_FOUND} device not found by deviceId. + * @since 18 + */ +int32_t OH_Hid_Open(uint64_t deviceId, uint8_t interfaceIndex, Hid_DeviceHandle **dev); + +/** + * @brief Close HID device by dev. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_IO_ERROR} close device failed. + * {@link HID_DDK_INVALID_PARAMETER} dev is null. + * @since 18 + */ +int32_t OH_Hid_Close(Hid_DeviceHandle **dev); + +/** + * @brief Write an Output report to a HID device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data The data to be sent. + * @param length The length in bytes of the data to send. + * @param bytesWritten The acture bytes of the data be sent. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.length is 0; 4.length is greater than HID_MAX_REPORT_BUFFER_SIZE;\n + * 5.bytesWritten is null. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_IO_ERROR } send data failed. + * @since 18 +*/ +int32_t OH_Hid_Write(Hid_DeviceHandle *dev, uint8_t *data, uint32_t length, uint32_t *bytesWritten); + +/** + * @brief Read an input report from the device with timeout. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @param timeout Timeout in milliseconds or -1 for blocking wait. + * @param bytesRead The number of bytes to read. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE;\n + * 5.bytesRead is null. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_TIMEOUT } read timeout. + * @since 18 +*/ +int32_t OH_Hid_ReadTimeout(Hid_DeviceHandle *dev, uint8_t *data, uint32_t bufSize, int timeout, uint32_t *bytesRead); + +/** + * @brief Read an input report from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @param bytesRead The number of bytes to read. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE;\n + * 5.bytesRead is null. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_TIMEOUT } read timeout. + * @since 18 +*/ +int32_t OH_Hid_Read(Hid_DeviceHandle *dev, uint8_t *data, uint32_t bufSize, uint32_t *bytesRead); + +/** + * @brief Set the device handle to be non-blocking. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param nonBlock Enable or not the nonblocking reads + * - 1 to enable nonblocking + * - 0 to disable nonblocking. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes:1.dev is null;\n + * 2.nonBlock is not 1 or 0. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * @since 18 +*/ +int32_t OH_Hid_SetNonBlocking(Hid_DeviceHandle *dev, int nonBlock); + +/** + * @brief Get a raw info from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param rawDevInfo Vendor id, product id and bus type get from the device. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.rawDevInfo is null. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetRawInfo(Hid_DeviceHandle *dev, Hid_RawDevInfo *rawDevInfo); + +/** + * @brief Get a raw name from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetRawName(Hid_DeviceHandle *dev, char *data, uint32_t bufSize); + +/** + * @brief Get a physical address from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetPhysicalAddress(Hid_DeviceHandle *dev, char *data, uint32_t bufSize); + +/** + * @brief Get a raw unique id from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetRawUniqueId(Hid_DeviceHandle *dev, uint8_t *data, uint32_t bufSize); + +/** + * @brief Send a report to the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param reportType Report type will be sent. + * @param data The data to be sent. + * @param length The length in bytes of the data to send. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.length is 0; 4.length is greater than HID_MAX_REPORT_BUFFER_SIZE. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_IO_ERROR } send data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_SendReport(Hid_DeviceHandle *dev, Hid_ReportType reportType, const uint8_t *data, uint32_t length); + +/** + * @brief Get a report from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param reportType Report type get from device. + * @param data A buffer to put the read data into. + * @param bufSize A buffer size to put the read data into. + * @return {@link HID_DDK_SUCCESS} the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetReport(Hid_DeviceHandle *dev, Hid_ReportType reportType, uint8_t *data, uint32_t bufSize); + +/** + * @brief Get a report descriptor from the device. + * + * @permission ohos.permission.ACCESS_DDK_HID + * @param dev Device operation handle. + * @param buf The buffer to copy descriptor into. + * @param bufSize The size of the buffer in bytes, the recommended value is HID_MAX_REPORT_DESCRIPTOR_SIZE. + * @param bytesRead The number of bytes to read. + * @return {@link HID_DDK_SUCCESS} if the operation is successful. + * {@link HID_DDK_NO_PERM} permission check failed. + * {@link HID_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.data is null; 3.bufSize is 0; 4.bufSize is greater than HID_MAX_REPORT_BUFFER_SIZE;\n + * 5.bytesRead is null. + * {@link HID_DDK_INIT_ERROR} the DDK not init. + * {@link HID_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link HID_DDK_MEMORY_ERROR } the memory of data copies failed. + * {@link HID_DDK_IO_ERROR } read data failed. + * {@link HID_DDK_INVALID_OPERATION } the operation is not supported. + * @since 18 +*/ +int32_t OH_Hid_GetReportDescriptor(Hid_DeviceHandle *dev, uint8_t *buf, uint32_t bufSize, uint32_t *bytesRead); +/** @} */ #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/drivers/external_device_manager/hid/hid_ddk_types.h b/drivers/external_device_manager/hid/hid_ddk_types.h index 4feaf5f5593e9ab44aa9bd5012f376b83c19a519..6ffd711bc3ec6e1190f749063520d7cdc8da9353 100644 --- a/drivers/external_device_manager/hid/hid_ddk_types.h +++ b/drivers/external_device_manager/hid/hid_ddk_types.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HID_DDK_TYPES_H -#define HID_DDK_TYPES_H /** * @addtogroup HidDdk * @{ @@ -33,10 +31,15 @@ * @brief Provides definitions of enum variables and structs in the HID DDK. * * File to include: + * @library libhid.z.so + * @syscap SystemCapability.Driver.HID.Extension * @since 11 * @version 1.0 */ +#ifndef HID_DDK_TYPES_H +#define HID_DDK_TYPES_H + #include #ifdef __cplusplus @@ -588,19 +591,81 @@ typedef struct Hid_EventProperties { typedef enum { /** @error Operation successful */ HID_DDK_SUCCESS = 0, - /** @error Operation failed */ - HID_DDK_FAILURE = -1, + /** @error Permission denied */ + HID_DDK_NO_PERM = 201, /** @error Invalid parameter */ - HID_DDK_INVALID_PARAMETER = -2, - /** @error Invalid operation */ - HID_DDK_INVALID_OPERATION = -3, + HID_DDK_INVALID_PARAMETER = 401, + /** @error Operation failed */ + HID_DDK_FAILURE = 27300001, /** @error Null pointer exception */ - HID_DDK_NULL_PTR = -4, + HID_DDK_NULL_PTR = 27300002, + /** @error Invalid operation */ + HID_DDK_INVALID_OPERATION = 27300003, /** @error Timeout */ - HID_DDK_TIMEOUT = -5, - /** @error Permission denied */ - HID_DDK_NO_PERM = -6 + HID_DDK_TIMEOUT = 27300004, + /** @error Init operation + * @since 18 + */ + HID_DDK_INIT_ERROR = 27300005, + /** @error Service error operation + * @since 18 + */ + HID_DDK_SERVICE_ERROR = 27300006, + /** @error Buff is outside accessible address space + * @since 18 + */ + HID_DDK_MEMORY_ERROR = 27300007, + /** @error Physical I/O error has occurred. + * @since 18 + */ + HID_DDK_IO_ERROR = 27300008, + /** @error Device not found. + * @since 18 + */ + HID_DDK_DEVICE_NOT_FOUND = 27300009 } Hid_DdkErrCode; + +/** + * @brief max report buffer size. + * + * @since 18 + */ +#define HID_MAX_REPORT_BUFFER_SIZE (16 * 1024 - 1) + +/** + * @brief Opaque usb HID device structure. + * + * @since 18 + */ +typedef struct Hid_DeviceHandle Hid_DeviceHandle; + +/** + * @brief Defines the report type. + * + * @since 18 + */ +typedef enum { + /** Input report */ + HID_INPUT_REPORT = 0, + /** Output report */ + HID_OUTPUT_REPORT = 1, + /** Feature report */ + HID_FEATURE_REPORT = 2 +} Hid_ReportType; + +/** + * @brief Defines the raw dev info. + * + * @since 18 + */ +typedef struct Hid_RawDevInfo { + /** Bus type */ + uint32_t busType; + /** Vendor ID */ + uint16_t vendor; + /** Product ID */ + uint16_t product; +} Hid_RawDevInfo; #ifdef __cplusplus } /** @} */ diff --git a/drivers/external_device_manager/hid/libhid.ndk.json b/drivers/external_device_manager/hid/libhid.ndk.json index 192bc43e1f6a8e50368956f02e8b5e896c010421..513f4ac9c44e32569bab9afc19c8b7794fbe725f 100644 --- a/drivers/external_device_manager/hid/libhid.ndk.json +++ b/drivers/external_device_manager/hid/libhid.ndk.json @@ -7,5 +7,50 @@ }, { "name": "OH_Hid_DestroyDevice" + }, + { + "name": "OH_Hid_Init" + }, + { + "name": "OH_Hid_Release" + }, + { + "name": "OH_Hid_Open" + }, + { + "name": "OH_Hid_Close" + }, + { + "name": "OH_Hid_Write" + }, + { + "name": "OH_Hid_ReadTimeout" + }, + { + "name": "OH_Hid_Read" + }, + { + "name": "OH_Hid_SetNonBlocking" + }, + { + "name": "OH_Hid_GetRawInfo" + }, + { + "name": "OH_Hid_GetRawName" + }, + { + "name": "OH_Hid_GetPhysicalAddress" + }, + { + "name": "OH_Hid_GetRawUniqueId" + }, + { + "name": "OH_Hid_SendReport" + }, + { + "name": "OH_Hid_GetReport" + }, + { + "name": "OH_Hid_GetReportDescriptor" } ] \ No newline at end of file diff --git a/drivers/external_device_manager/scsi_peripheral/BUILD.gn b/drivers/external_device_manager/scsi_peripheral/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a475453507472d9559a3a0e2182b93e43fd0f193 --- /dev/null +++ b/drivers/external_device_manager/scsi_peripheral/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2025 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("//build/ohos.gni") + +ohos_ndk_headers("scsi_header") { + dest_dir = "$ndk_headers_out_dir/scsi_peripheral/" + sources = [ + "scsi_peripheral_api.h", + "scsi_peripheral_types.h", + ] +} + +ohos_ndk_library("libscsi") { + ndk_description_file = "./libscsi.ndk.json" + min_compact_version = "16" + output_name = "scsi" + system_capability = "SystemCapability.Driver.SCSI.Extension" + system_capability_headers = [ + "scsi_peripheral/scsi_peripheral_api.h", + "scsi_peripheral/scsi_peripheral_types.h", + ] +} diff --git a/drivers/external_device_manager/scsi_peripheral/libscsi.ndk.json b/drivers/external_device_manager/scsi_peripheral/libscsi.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..7c996ab31199bc3c0f3b766bf09d909340114db8 --- /dev/null +++ b/drivers/external_device_manager/scsi_peripheral/libscsi.ndk.json @@ -0,0 +1,62 @@ +[ + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Init" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Release" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Open" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Close" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_ReadCapacity10" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_TestUnitReady" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Inquiry" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_RequestSense" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Read10" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Write10" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_Verify10" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_SendRequestByCdb" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_CreateDeviceMemMap" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_DestroyDeviceMemMap" + }, + { + "first_introduced": "18", + "name": "OH_ScsiPeripheral_ParseBasicSenseInfo" + } +] \ No newline at end of file diff --git a/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_api.h b/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_api.h new file mode 100644 index 0000000000000000000000000000000000000000..6f0ad01d8a9a41733d53483a7a68e453785b615d --- /dev/null +++ b/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_api.h @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2025 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 ScsiPeripheralDDK + * @{ + * + * @brief Provide ScsiPeripheral DDK interface, including initializing DDK, releasing DDK, opening devices, reading and writing devices, etc. + * @since 18 + */ + +/** + * @file scsi_peripheral_api.h + * + * @brief Declares the ScsiPeripheral DDK APIs. + * + * @kit DriverDevelopmentKit + * @library libscsi.z.so + * @syscap SystemCapability.Driver.SCSI.Extension + * @since 18 + */ + +#ifndef SCSI_PERIPHERAL_API_H +#define SCSI_PERIPHERAL_API_H + +#include +#include "scsi_peripheral_types.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief Initializes the ScsiPeripheral DDK. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk init error. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Init(void); + +/** + * @brief Releases the ScsiPeripheral DDK. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Release(void); + +/** + * @brief Open SCSI device by deviceId. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param deviceId ID of the device to be operated. + * @param interfaceIndex Interface index, which corresponds to interface which supports USB Protocol UAS. + * @param dev Device handle. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_DEVICE_NOT_FOUND} device not found by deviceId. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Open(uint64_t deviceId, uint8_t interfaceIndex, ScsiPeripheral_Device **dev); + +/** + * @brief Close SCSI device. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Close(ScsiPeripheral_Device **dev); + +/** + * @brief Check if the logical unit is ready. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request Test unit ready request information. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_TestUnitReady(ScsiPeripheral_Device *dev, ScsiPeripheral_TestUnitReadyRequest *request, + ScsiPeripheral_Response *response); + +/** + * @brief Get the information regarding the logical unit and SCSI target device. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request Inquiry request information. + * @param inquiryInfo The data of inquiry command. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or inquiryInfo is null or\n + * inquiryInfo->data is null or response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Inquiry(ScsiPeripheral_Device *dev, ScsiPeripheral_InquiryRequest *request, + ScsiPeripheral_InquiryInfo *inquiryInfo, ScsiPeripheral_Response *response); + +/** + * @brief Get the device capacity. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request ReadCapacity request information. + * @param capacityInfo The data of read capacity command. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or capacityInfo is null or\n + * response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_ReadCapacity10(ScsiPeripheral_Device *dev, ScsiPeripheral_ReadCapacityRequest *request, + ScsiPeripheral_CapacityInfo *capacityInfo, ScsiPeripheral_Response *response); + +/** + * @brief Get the sense data. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request RequestSense request information. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_RequestSense(ScsiPeripheral_Device *dev, ScsiPeripheral_RequestSenseRequest *request, + ScsiPeripheral_Response *response); + +/** + * @brief Read from the specified logical block(s). + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request The request parameters. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or request->data is null or\n + * response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Read10(ScsiPeripheral_Device *dev, ScsiPeripheral_IORequest *request, + ScsiPeripheral_Response *response); + +/** + * @brief Write data to the specified logical block(s). + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request The request parameters. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or request->data is null or\n + * response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Write10(ScsiPeripheral_Device *dev, ScsiPeripheral_IORequest *request, + ScsiPeripheral_Response *response); + +/** + * @brief Verify the specified logical block(s) on the medium. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request Verify request information. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_Verify10(ScsiPeripheral_Device *dev, ScsiPeripheral_VerifyRequest *request, + ScsiPeripheral_Response *response); + +/** + * @brief Send SCSI command that specified by CDB. + * + * @permission ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL + * @param dev Device handle. + * @param request The request parameters. + * @param response The response parameters. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_NO_PERM} permission check failed. + * {@link SCSIPERIPHERAL_DDK_INIT_ERROR} the ddk not init. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or request is null or request->data is null or\n + * request->cdbLength is 0 or response is null. + * {@link SCSIPERIPHERAL_DDK_SERVICE_ERROR} communication with ddk service failed. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * {@link SCSIPERIPHERAL_DDK_IO_ERROR} i/o operation error. + * {@link SCSIPERIPHERAL_DDK_TIMEOUT} transmission timeout. + * {@link SCSIPERIPHERAL_DDK_INVALID_OPERATION} this operation is not supported. + * @since 18 + */ +int32_t OH_ScsiPeripheral_SendRequestByCdb(ScsiPeripheral_Device *dev, ScsiPeripheral_Request *request, + ScsiPeripheral_Response *response); + +/** + * @brief Creates a buffer. To avoid resource leakage, destroy a buffer by calling\n + * OH_ScsiPeripheral_DestroyDeviceMemMap after use. + * + * @param dev Device handle. + * @param size Buffer size. + * @param devMmap Data memory map, through which the created buffer is returned to the caller. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} dev is null or devMmap is null. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * @since 18 + */ +int32_t OH_ScsiPeripheral_CreateDeviceMemMap(ScsiPeripheral_Device *dev, size_t size, + ScsiPeripheral_DeviceMemMap **devMmap); + +/** + * @brief Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use. + * + * @param devMmap Device memory map created by calling OH_ScsiPeripheral_CreateDeviceMemMap. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} devMmap is null. + * {@link SCSIPERIPHERAL_DDK_MEMORY_ERROR} memory data operation failed. + * @since 18 + */ +int32_t OH_ScsiPeripheral_DestroyDeviceMemMap(ScsiPeripheral_DeviceMemMap *devMmap); + +/** + * @brief Parse the basic sense data of Information、Command-specific information、Sense key specific. + * + * @param senseData Sense data. + * @param senseDataLen The length of sense data. + * @param senseInfo Basic sense data. + * @return {@link SCSIPERIPHERAL_DDK_SUCCESS} the operation is successful. + * {@link SCSIPERIPHERAL_DDK_INVALID_PARAMETER} senseData is null or senseInfo is null or\n + * senseData format is not Descriptor/Fixed format or\n + * senseDataLen is smaller than SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE or\n + * senseDataLen is smaller than SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE. + * @since 18 + */ +int32_t OH_ScsiPeripheral_ParseBasicSenseInfo(uint8_t *senseData, uint8_t senseDataLen, + ScsiPeripheral_BasicSenseInfo *senseInfo); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif // SCSI_PERIPHERAL_API_H +/** @} */ diff --git a/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_types.h b/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_types.h new file mode 100644 index 0000000000000000000000000000000000000000..b22e70f24618918206b00e7f864c55f0274fbf5b --- /dev/null +++ b/drivers/external_device_manager/scsi_peripheral/scsi_peripheral_types.h @@ -0,0 +1,379 @@ +/* + * Copyright (c) 2025 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 ScsiPeripheralDDK + * @{ + * + * @brief Provides ScsiPeripheral DDK types and declares macros, enumerations, and data structures used by the ScsiPeripheral DDK. + * @since 18 + */ + +/** + * @file scsi_peripheral_types.h + * + * @brief Provides the enums, structs, and macros used in SCSI Peripheral DDK APIs. + * + * @kit DriverDevelopmentKit + * @library libscsi.z.so + * @syscap SystemCapability.Driver.SCSI.Extension + * @since 18 + */ + +#ifndef SCSI_PERIPHERAL_TYPES_H +#define SCSI_PERIPHERAL_TYPES_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @brief The min length of descriptor format sense data: 8. + * + * @since 18 + */ +#define SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE 8 + +/** + * @brief The min length of fixed format sense data: 18. + * + * @since 18 + */ +#define SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE 18 + +/** + * @brief Defines error codes for SCSI DDK. + * + * @since 18 + */ +typedef enum { + /** @error Permission denied. */ + SCSIPERIPHERAL_DDK_NO_PERM = 201, + /** @error Invalid parameter. */ + SCSIPERIPHERAL_DDK_INVALID_PARAMETER = 401, + /** @error The operation is successful. */ + SCSIPERIPHERAL_DDK_SUCCESS = 31700000, + /** @error Memory-related error, for example, insufficient memory, memory data copy failure,\n + * or memory application failure. + */ + SCSIPERIPHERAL_DDK_MEMORY_ERROR = 31700001, + /** @error Invalid operation. */ + SCSIPERIPHERAL_DDK_INVALID_OPERATION = 31700002, + /** @error Device I/O operation failed. */ + SCSIPERIPHERAL_DDK_IO_ERROR = 31700003, + /** @error Transmission timeout. */ + SCSIPERIPHERAL_DDK_TIMEOUT = 31700004, + /** @error The ddk init error or the ddk not init. */ + SCSIPERIPHERAL_DDK_INIT_ERROR = 31700005, + /** @error Communication with the SCSI ddk service failed. */ + SCSIPERIPHERAL_DDK_SERVICE_ERROR = 31700006, + /** @error Device not found. */ + SCSIPERIPHERAL_DDK_DEVICE_NOT_FOUND = 31700007, +} ScsiPeripheral_DdkErrCode; + +/** + * @brief Defines SCSI status for response. + * + * @since 18 + */ +typedef enum { + /** Good condition */ + SCSIPERIPHERAL_STATUS_GOOD = 0x00, + /** Check condition needed */ + SCSIPERIPHERAL_STATUS_CHECK_CONDITION_NEEDED = 0x02, + /** Condition met */ + SCSIPERIPHERAL_STATUS_CONDITION_MET = 0x04, + /** Busy */ + SCSIPERIPHERAL_STATUS_BUSY = 0x08, + /** Reservation conflict */ + SCSIPERIPHERAL_STATUS_RESERVATION_CONFLICT = 0x18, + /** Task set full */ + SCSIPERIPHERAL_STATUS_TASK_SET_FULL = 0x28, + /** ACA active */ + SCSIPERIPHERAL_STATUS_ACA_ACTIVE = 0x30, + /** Task aborted */ + SCSIPERIPHERAL_STATUS_TASK_ABORTED = 0x40, +} ScsiPeripheral_Status; + +/** + * @brief Opaque SCSI device structure. + * + * @since 18 + */ +typedef struct ScsiPeripheral_Device ScsiPeripheral_Device; + +/** + * @brief Device memory map created by calling OH_ScsiPeripheral_CreateDeviceMemMap.\n + * A buffer using the device memory map can provide better performance. + * + * @since 18 + */ +typedef struct ScsiPeripheral_DeviceMemMap { + /** Buffer address. */ + uint8_t * const address; + /** Buffer size. */ + const size_t size; + /** Offset of the used buffer. The default value is 0, indicating that there is no offset\n + * and the buffer starts from the specified address. + */ + uint32_t offset; + /** Length of the used buffer. By default, the value is equal to the size, indicating that\n + * the entire buffer is used. + */ + uint32_t bufferLength; + /** Length of the transferred data. */ + uint32_t transferredLength; +} ScsiPeripheral_DeviceMemMap; + +/** + * @brief Request parameters for read/write. + * + * @since 18 + */ +typedef struct ScsiPeripheral_IORequest { + /** Starting with the logical block. */ + uint32_t lbAddress; + /** Number of contiguous logical blocks that shall be read. */ + uint16_t transferLength; + /** Control byte. */ + uint8_t control; + /** Byte 1 of the CDB. */ + uint8_t byte1; + /** Byte 6 of the CDB. */ + uint8_t byte6; + /** Buffer of data transfer. */ + ScsiPeripheral_DeviceMemMap *data; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_IORequest; + +/** + * @brief The max length of command descriptor block: 16. + * + * @since 18 + */ +#define SCSIPERIPHERAL_MAX_CMD_DESC_BLOCK_LEN 16 + +/** + * @brief Request parameters. + * + * @since 18 + */ +typedef struct ScsiPeripheral_Request { + /** Command descriptor block. */ + uint8_t commandDescriptorBlock[SCSIPERIPHERAL_MAX_CMD_DESC_BLOCK_LEN]; + /** The length of command descriptor block. */ + uint8_t cdbLength; + /** Data transfer direction. */ + int8_t dataTransferDirection; + /** Buffer of data transfer. */ + ScsiPeripheral_DeviceMemMap *data; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_Request; + +/** + * @brief The max length of sense data: 252. + * + * @since 18 + */ +#define SCSIPERIPHERAL_MAX_SENSE_DATA_LEN 252 + +/** + * @brief Response parameters. + * + * @since 18 + */ +typedef struct ScsiPeripheral_Response { + /** Sense data. */ + uint8_t senseData[SCSIPERIPHERAL_MAX_SENSE_DATA_LEN]; + /** The status at completion of the call, such as good, busy, or timeout. */ + ScsiPeripheral_Status status; + /** Shifted, masked scsi status. */ + uint8_t maskedStatus; + /** Messaging level data (optional). */ + uint8_t msgStatus; + /** Byte count actually written to sbp. */ + uint8_t sbLenWr; + /** Errors from host adapter. */ + uint16_t hostStatus; + /** Errors from software driver. */ + uint16_t driverStatus; + /** Dxfer_len - actual_transferred. */ + int32_t resId; + /** Time taken by cmd (unit: millisec). */ + uint32_t duration; +} ScsiPeripheral_Response; + +/** + * @brief SCSI test unit ready request. + * + * @since 18 + */ +typedef struct ScsiPeripheral_TestUnitReadyRequest { + /** Control byte. */ + uint8_t control; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_TestUnitReadyRequest; + +/** + * @brief SCSI inquiry request. + * + * @since 18 + */ +typedef struct ScsiPeripheral_InquiryRequest { + /** Page code. */ + uint8_t pageCode; + /** Allocation length. */ + uint16_t allocationLength; + /** Control byte. */ + uint8_t control; + /** Byte 1 of the CDB. */ + uint8_t byte1; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_InquiryRequest; + +/** + * @brief The length of vendor identification: 8. + * + * @since 18 + */ +#define SCSIPERIPHERAL_VENDOR_ID_LEN 8 + +/** + * @brief The length of product identification: 16. + * + * @since 18 + */ +#define SCSIPERIPHERAL_PRODUCT_ID_LEN 16 + +/** + * @brief The length of product revision: 4. + * + * @since 18 + */ +#define SCSIPERIPHERAL_PRODUCT_REV_LEN 4 + +/** + * @brief SCSI inquiry data. + * + * @since 18 + */ +typedef struct ScsiPeripheral_InquiryInfo { + /** Peripheral device type. */ + uint8_t deviceType; + /** Vendor identification. */ + char idVendor[SCSIPERIPHERAL_VENDOR_ID_LEN + 1]; + /** Product identification. */ + char idProduct[SCSIPERIPHERAL_PRODUCT_ID_LEN + 1]; + /** Product revision. */ + char revProduct[SCSIPERIPHERAL_PRODUCT_REV_LEN + 1]; + /** All inquiry data. */ + ScsiPeripheral_DeviceMemMap *data; +} ScsiPeripheral_InquiryInfo; + +/** + * @brief SCSI read capacity request. + * + * @since 18 + */ +typedef struct ScsiPeripheral_ReadCapacityRequest { + /** Logical block address. */ + uint32_t lbAddress; + /** Control byte. */ + uint8_t control; + /** Byte 8 of the CDB. */ + uint8_t byte8; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_ReadCapacityRequest; + +/** + * @brief SCSI read capacity data. + * + * @since 18 + */ +typedef struct ScsiPeripheral_CapacityInfo { + /** Returned logical block address. */ + uint32_t lbAddress; + /** Logical block length in bytes. */ + uint32_t lbLength; +} ScsiPeripheral_CapacityInfo; + +/** + * @brief SCSI request sense request. + * + * @since 18 + */ +typedef struct ScsiPeripheral_RequestSenseRequest { + /** Allocation length. */ + uint8_t allocationLength; + /** Control byte. */ + uint8_t control; + /** Byte 1 of the CDB. */ + uint8_t byte1; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_RequestSenseRequest; + +/** + * @brief Basic sense data of Information、Command-specific information、Sense key specific. + * + * @since 18 + */ +typedef struct ScsiPeripheral_BasicSenseInfo { + /** Response code. */ + uint8_t responseCode; + /** Information valid bit. */ + bool valid; + /** Information sense data descriptor. */ + uint64_t information; + /** Command-specific information sense data descriptor. */ + uint64_t commandSpecific; + /** Sense key specific valid bit. */ + bool sksv; + /** Sense key specific sense data descriptor. */ + uint32_t senseKeySpecific; +} ScsiPeripheral_BasicSenseInfo; + +/** + * @brief SCSI verify request. + * + * @since 18 + */ +typedef struct ScsiPeripheral_VerifyRequest { + /** Starting with the logical block. */ + uint32_t lbAddress; + /** Number of contiguous logical blocks that shall be verify. */ + uint16_t verificationLength; + /** Control byte. */ + uint8_t control; + /** Byte 1 of the CDB. */ + uint8_t byte1; + /** Byte 6 of the CDB. */ + uint8_t byte6; + /** Timeout(unit: millisec). */ + uint32_t timeout; +} ScsiPeripheral_VerifyRequest; +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif // SCSI_PERIPHERAL_TYPES_H +/** @} */ diff --git a/drivers/external_device_manager/usb/libusb.ndk.json b/drivers/external_device_manager/usb/libusb.ndk.json index d3ad5dbd33abd8e8b82db853b6e8df1818f4bea0..55f578e408bfb68ec45a13be05dca735cc700654 100644 --- a/drivers/external_device_manager/usb/libusb.ndk.json +++ b/drivers/external_device_manager/usb/libusb.ndk.json @@ -5,6 +5,9 @@ { "name": "OH_Usb_Release" }, + { + "name": "OH_Usb_ReleaseResource" + }, { "name": "OH_Usb_GetDeviceDescriptor" }, @@ -43,5 +46,8 @@ }, { "name": "OH_Usb_DestroyDeviceMemMap" + }, + { + "name": "OH_Usb_GetDevices" } ] \ No newline at end of file diff --git a/drivers/external_device_manager/usb/usb_ddk_api.h b/drivers/external_device_manager/usb/usb_ddk_api.h index d43aa52d75f273710cf91db472fa402d5e0cf064..d13ed1319b0bb48194ef62ca01700a3ae8284463 100644 --- a/drivers/external_device_manager/usb/usb_ddk_api.h +++ b/drivers/external_device_manager/usb/usb_ddk_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 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 @@ -12,8 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef USB_DDK_API_H -#define USB_DDK_API_H /** * @addtogroup UsbDdk @@ -33,10 +31,16 @@ * * @brief Declares the USB DDK APIs used by the USB host to access USB devices. * + * @kit DriverDevelopmentKit + * @library libusb_ndk.z.so + * @syscap SystemCapability.Driver.USB.Extension * @since 10 * @version 1.0 */ +#ifndef USB_DDK_API_H +#define USB_DDK_API_H + #include #include "ddk_types.h" @@ -66,6 +70,17 @@ int32_t OH_Usb_Init(void); */ void OH_Usb_Release(void); +/** + * @brief Releases the DDK. + * + * @permission ohos.permission.ACCESS_DDK_USB + * @return {@link USB_DDK_SUCCESS} the operation is successful. + * {@link USB_DDK_NO_PERM} permission check failed. + * @since 18 + * @version 1.0 + */ +int32_t OH_Usb_ReleaseResource(void); + /** * @brief Obtains the USB device descriptor. * @@ -73,7 +88,7 @@ void OH_Usb_Release(void); * @param deviceId ID of the device whose descriptor is to be obtained. * @param desc Standard device descriptor defined in the USB protocol. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} desc is null. * @since 10 @@ -91,7 +106,7 @@ int32_t OH_Usb_GetDeviceDescriptor(uint64_t deviceId, struct UsbDeviceDescriptor * @param config Configuration descriptor, which includes the standard configuration descriptor defined in the\n * USB protocol and the associated interface descriptor and endpoint descriptor. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} config is null. * @since 10 @@ -120,7 +135,7 @@ void OH_Usb_FreeConfigDescriptor(struct UsbDdkConfigDescriptor * const config); * @param interfaceHandle Interface operation handle. After the interface is claimed successfully, a value will be\n * assigned to this parameter. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} interfaceHandle is null. * @since 10 @@ -134,7 +149,7 @@ int32_t OH_Usb_ClaimInterface(uint64_t deviceId, uint8_t interfaceIndex, uint64_ * @permission ohos.permission.ACCESS_DDK_USB * @param interfaceHandle Interface operation handle. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * @since 10 * @version 1.0 @@ -149,7 +164,7 @@ int32_t OH_Usb_ReleaseInterface(uint64_t interfaceHandle); * @param settingIndex Index of the alternate setting, which corresponds to bAlternateSetting\n * in the USB protocol. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * @since 10 * @version 1.0 @@ -164,7 +179,7 @@ int32_t OH_Usb_SelectInterfaceSetting(uint64_t interfaceHandle, uint8_t settingI * @param settingIndex Index of the alternate setting, which corresponds to bAlternateSetting\n * in the USB protocol. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} settingIndex is null. * @since 10 @@ -182,7 +197,7 @@ int32_t OH_Usb_GetCurrentInterfaceSetting(uint64_t interfaceHandle, uint8_t *set * @param data Data to be transferred. * @param dataLen Data length. The return value indicates the length of the actually read data. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} setup is null or data is null or dataLen is null or dataLen is less than\n * size of the read data. @@ -203,7 +218,7 @@ int32_t OH_Usb_SendControlReadRequest(uint64_t interfaceHandle, const struct Usb * @param data Data to be transferred. * @param dataLen Data length. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} setup is null or data is null. * @since 10 @@ -220,7 +235,7 @@ int32_t OH_Usb_SendControlWriteRequest(uint64_t interfaceHandle, const struct Us * @param pipe Pipe used to transfer data. * @param devMmap Device memory map, which can be obtained by calling OH_Usb_CreateDeviceMemMap. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} pipe is null or devMmap is null or address of devMmap is null. * @since 10 @@ -236,7 +251,7 @@ int32_t OH_Usb_SendPipeRequest(const struct UsbRequestPipe *pipe, UsbDeviceMemMa * @param pipe Pipe used to transfer data. * @param ashmem Shared memory, which can be obtained by calling OH_DDK_CreateAshmem. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. * {@link USB_DDK_INVALID_PARAMETER} pipe is null or ashmem is null or address of ashmem is null. * @since 12 @@ -252,7 +267,7 @@ int32_t OH_Usb_SendPipeRequestWithAshmem(const struct UsbRequestPipe *pipe, DDK_ * @param size Buffer size. * @param devMmap Data memory map, through which the created buffer is returned to the caller. * @return {@link USB_DDK_SUCCESS} the operation is successful. - * {@link USB_DDK_FAILED} permission check failed or internal error failed. + * {@link USB_DDK_NO_PERM} permission check failed. * {@link USB_DDK_INVALID_PARAMETER} devMmap is null. * {@link USB_DDK_MEMORY_ERROR} mmap failed or alloc memory of devMmap failed. * @since 10 @@ -269,6 +284,19 @@ int32_t OH_Usb_CreateDeviceMemMap(uint64_t deviceId, size_t size, UsbDeviceMemMa * @version 1.0 */ void OH_Usb_DestroyDeviceMemMap(UsbDeviceMemMap *devMmap); + +/** + * @brief Obtain USB devices. + * + * @permission ohos.permission.ACCESS_DDK_USB + * @param devices USB device array. + * @return {@link USB_DDK_SUCCESS} the operation is successful. + * {@link USB_DDK_NO_PERM} permission check failed. + * {@link USB_DDK_INVALID_OPERATION} connect usb ddk service failed. + * {@link USB_DDK_INVALID_PARAMETER} devices is null. + * @since 18 + */ +int32_t OH_Usb_GetDevices(struct Usb_DeviceArray *devices); /** @} */ #ifdef __cplusplus } diff --git a/drivers/external_device_manager/usb/usb_ddk_types.h b/drivers/external_device_manager/usb/usb_ddk_types.h index 6385308af0def4120aabfeecb32fd3e7a26088e7..96ac845a1d6f8d212ce9cfafce7571a6566ef44b 100644 --- a/drivers/external_device_manager/usb/usb_ddk_types.h +++ b/drivers/external_device_manager/usb/usb_ddk_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2025 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 @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef USB_DDK_TYPES_H -#define USB_DDK_TYPES_H /** * @addtogroup UsbDdk * @{ @@ -33,10 +31,16 @@ * * @brief Provides the enumerated variables, structures, and macros used in USB DDK APIs. * + * @kit DriverDevelopmentKit + * @library libusb_ndk.z.so + * @syscap SystemCapability.Driver.USB.Extension * @since 10 * @version 1.0 */ +#ifndef USB_DDK_TYPES_H +#define USB_DDK_TYPES_H + #include #include @@ -294,23 +298,45 @@ typedef struct UsbDeviceMemMap { typedef enum { /** @error The operation is successful. */ USB_DDK_SUCCESS = 0, - /** @error The operation failed. */ + /** @error The operation failed. + * @deprecate since 16 + */ USB_DDK_FAILED = -1, + /** @error Permission denied. */ + USB_DDK_NO_PERM = 201, /** @error Invalid parameter. */ - USB_DDK_INVALID_PARAMETER = -2, + USB_DDK_INVALID_PARAMETER = 401, /** @error Memory-related error, for example, insufficient memory, memory data copy failure,\n * or memory application failure. */ - USB_DDK_MEMORY_ERROR = -3, - /** @error Invalid operation. */ - USB_DDK_INVALID_OPERATION = -4, - /** @error Null pointer exception */ + USB_DDK_MEMORY_ERROR = 27400001, + /** @error Null pointer exception + * @deprecate since 16 + */ USB_DDK_NULL_PTR = -5, - /** @error Device busy. */ + /** @error Device busy. + * @deprecate since 16 + */ USB_DDK_DEVICE_BUSY = -6, + /** @error Invalid operation. */ + USB_DDK_INVALID_OPERATION = 27400002, + /** @error Device I/O operation failed. */ + USB_DDK_IO_FAILED = 27400003, /** @error Transmission timeout. */ - USB_DDK_TIMEOUT = -7 + USB_DDK_TIMEOUT = 27400004, } UsbDdkErrCode; + +/** + * @brief all usb devices. + * + * @since 18 + */ +typedef struct Usb_DeviceArray { + /** device id array */ + uint64_t* deviceIds; + /** Number of devices. If the value is 0, no device exists */ + uint32_t num; +} Usb_DeviceArray; #ifdef __cplusplus } /** @} */ diff --git a/drivers/external_device_manager/usb_serial/BUILD.gn b/drivers/external_device_manager/usb_serial/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0e47d0d1b99d3728d0b00e8c1ba9003c045547e3 --- /dev/null +++ b/drivers/external_device_manager/usb_serial/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2025 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("//build/ohos.gni") + +ohos_ndk_headers("usb_serial_header") { + dest_dir = "$ndk_headers_out_dir/usb_serial/" + sources = [ + "usb_serial_api.h", + "usb_serial_types.h", + ] +} + +ohos_ndk_library("libusb_serial") { + ndk_description_file = "./libusb_serial.ndk.json" + min_compact_version = "16" + output_name = "usb_serial_ndk" + system_capability = "SystemCapability.Driver.UsbSerial.Extension" + system_capability_headers = [ + "usb_serial/usb_serial_api.h", + "usb_serial/usb_serial_types.h", + ] +} diff --git a/drivers/external_device_manager/usb_serial/libusb_serial.ndk.json b/drivers/external_device_manager/usb_serial/libusb_serial.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..6a62ecb85c0b8d623121b6787f31bdd2fcf77c37 --- /dev/null +++ b/drivers/external_device_manager/usb_serial/libusb_serial.ndk.json @@ -0,0 +1,54 @@ +[ + { + "first_introduced": "18", + "name": "OH_UsbSerial_Init" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Release" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Open" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Close" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Read" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Write" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_SetBaudRate" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_SetParams" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_SetTimeout" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_SetFlowControl" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_Flush" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_FlushInput" + }, + { + "first_introduced": "18", + "name": "OH_UsbSerial_FlushOutput" + } +] \ No newline at end of file diff --git a/drivers/external_device_manager/usb_serial/usb_serial_api.h b/drivers/external_device_manager/usb_serial/usb_serial_api.h new file mode 100644 index 0000000000000000000000000000000000000000..46eb5542721f5136a5a6ea893b80723db9ae806d --- /dev/null +++ b/drivers/external_device_manager/usb_serial/usb_serial_api.h @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2025 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 USBSerialDDK + * @{ + * + * @brief Provides USB SERIAL DDK types and declares the macros, enumerated variables, and\n + * data structures required by the USB SERIAL DDK APIs. + * + * @since 18 + */ + +/** + * @file usb_serial_api.h + * + * @brief Declares the USB SERIAL DDK interfaces for the usb host to access an usb serial device. + * + * @kit DriverDevelopmentKit + * @library libusb_serial.z.so + * @syscap SystemCapability.Driver.UsbSerial.Extension + * @since 18 + */ + +#ifndef DDK_USB_SERIAL_API_H +#define DDK_USB_SERIAL_API_H + +#include +#include "usb_serial_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initializes the USB serial DDK. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk init error. + * @since 18 + */ +int32_t OH_UsbSerial_Init(void); + +/** + * @brief Releases the USB serial DDK. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * @since 18 + */ +int32_t OH_UsbSerial_Release(void); + +/** + * @brief Open USB serial device by deviceId. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param deviceId ID of the device to be operated. + * @param interfaceIndex Interface index, which corresponds to interface which supports USB Protocol ACM. + * @param dev Device handle. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_MEMORY_ERROR} insufficient memory. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_DEVICE_NOT_FOUND} device or interface not found. + * @since 18 + */ +int32_t OH_UsbSerial_Open(uint64_t deviceId, uint8_t interfaceIndex, UsbSerial_Device **dev); + +/** + * @brief Close USB serial device. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1. dev is null.\n + * 2. *dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_Close(UsbSerial_Device **dev); + +/** + * @brief Read bytesRead into buff from UsbSerial device. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param buff Received data from a serial device. + * @param bufferSize The buffer size. + * @param bytesRead Actual bytes read. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.buff is null; 3.bufferSize is zero; 4.bytesRead is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_MEMORY_ERROR} the buff is outside accessible address space error. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_Read(UsbSerial_Device *dev, uint8_t *buff, uint32_t bufferSize, uint32_t *bytesRead); + +/** + * @brief Write bytesWritten from buff to UsbSerial device. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param buff Serial information write to device. + * @param bufferSize The buffer size. + * @param bytesWritten Actual bytes written. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.buff is null; 3.bufferSize is zero; 4. bytesWritten is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_MEMORY_ERROR} the buff is outside accessible address space error. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_Write(UsbSerial_Device *dev, uint8_t *buff, uint32_t bufferSize, uint32_t *bytesWritten); + +/** + * @brief Set the serial port baud rate. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param baudRate Serial port baud rate set to connect device. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_SetBaudRate(UsbSerial_Device *dev, uint32_t baudRate); + +/** + * @brief Set the serial port parameters. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param params Serial port params set to connect device. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2.params is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_SetParams(UsbSerial_Device *dev, UsbSerial_Params *params); + +/** + * @brief Set the timeout in milliseconds. + * The timeout value defaults to 0 without calling this function. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param timeout Set to -1 to infinite timeout, 0 to return immediately with any data, + * or > 0 to wait for data for a specified number of milliseconds. + * Timeout will be rounded to the nearest 100ms. Maximum value limited to 25500ms. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: 1.dev is null;\n + * 2. timeout < -1 or timeout > 25500. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_SetTimeout(UsbSerial_Device *dev, int timeout); + +/** + * @brief Set the flow control. + * It defaults to no flow control without calling this function. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @param flowControl {@link UsbSerial_FlowControl} flow control mode. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_SetFlowControl(UsbSerial_Device *dev, UsbSerial_FlowControl flowControl); + +/** + * @brief Flush the input and output buffers after finish writting. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_Flush(UsbSerial_Device *dev); + +/** + * @brief Flush the input buffer, and the data in the buffer will be cleared directly. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_FlushInput(UsbSerial_Device *dev); + +/** + * @brief Flush the output buffer, and the data in the buffer will be cleared directly. + * + * @permission ohos.permission.ACCESS_DDK_USB_SERIAL + * @param dev Device handle. + * @return {@link USB_SERIAL_DDK_SUCCESS} the operation is successful. + * {@link USB_SERIAL_DDK_NO_PERM} permission check failed. + * {@link USB_SERIAL_DDK_INVALID_PARAMETER} parameter check failed. Possible causes: dev is null. + * {@link USB_SERIAL_DDK_INIT_ERROR} the ddk not init. + * {@link USB_SERIAL_DDK_SERVICE_ERROR} communication with the ddk service failed. + * {@link USB_SERIAL_DDK_IO_ERROR} the ddk I/O error. + * {@link USB_SERIAL_DDK_INVALID_OPERATION} invalid operation. + * @since 18 + */ +int32_t OH_UsbSerial_FlushOutput(UsbSerial_Device *dev); +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif // DDK_USB_SERIAL_API_H +/** @} */ diff --git a/drivers/external_device_manager/usb_serial/usb_serial_types.h b/drivers/external_device_manager/usb_serial/usb_serial_types.h new file mode 100644 index 0000000000000000000000000000000000000000..c0af700f3846e99b9df41aa976cd451714075980 --- /dev/null +++ b/drivers/external_device_manager/usb_serial/usb_serial_types.h @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2025 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 USBSerialDDK + * @{ + * + * @brief Provides USB SERIAL DDK types and declares the macros, enumerated variables, and\n + * data structures required by the USB SERIAL DDK APIs. + * + * @since 18 + */ + +/** + * @file usb_serial_types.h + * + * @brief Provides the enumerated variables, structures, and macros used in USB SERIAL DDK APIs. + * + * @kit DriverDevelopmentKit + * @library libusb_serial.z.so + * @syscap SystemCapability.Driver.UsbSerial.Extension + * @since 18 + */ + +#ifndef DDK_USB_SERIAL_TYPES_H +#define DDK_USB_SERIAL_TYPES_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Opaque usb serial device structure. + * + * @since 18 + */ +typedef struct UsbSerial_Device UsbSerial_Device; + +/** + * @brief Defines Return codes for USB SERIAL DDK. + * + * @since 18 + */ +typedef enum { + /** @error Permission denied */ + USB_SERIAL_DDK_NO_PERM = 201, + /** @error Invalid parameter */ + USB_SERIAL_DDK_INVALID_PARAMETER = 401, + /** @error Operation successful */ + USB_SERIAL_DDK_SUCCESS = 31600000, + /** @error Invalid operation */ + USB_SERIAL_DDK_INVALID_OPERATION = 31600001, + /** @error Init operation */ + USB_SERIAL_DDK_INIT_ERROR = 31600002, + /** @error Service Error operation */ + USB_SERIAL_DDK_SERVICE_ERROR = 31600003, + /** @error Memory-related error, for example, insufficient memory, memory data copy failure,\n + * or memory application failure. + */ + USB_SERIAL_DDK_MEMORY_ERROR = 31600004, + /** @error I/O Error */ + USB_SERIAL_DDK_IO_ERROR = 31600005, + /** @error Device not found */ + USB_SERIAL_DDK_DEVICE_NOT_FOUND = 31600006, +} UsbSerial_DdkRetCode; + +/** + * @brief Defines USB Serial Port Params for USB SERIAL DDK. + * + * @since 18 + */ +typedef struct UsbSerial_Params { + /** The baud rate requested by the system */ + uint32_t baudRate; + /** The number of data bits to transmit */ + uint8_t nDataBits; + /** The number of half stop bits. */ + uint8_t nStopBits; + /** The parity setting to use during communication */ + uint8_t parity; +} __attribute__((aligned(8))) UsbSerial_Params; + +/** + * @brief Defines flow control for USB SERIAL DDK. + * + * @since 18 + */ +typedef enum { + /** No flow control */ + USB_SERIAL_NO_FLOW_CONTROL = 0, + /** Software flow control */ + USB_SERIAL_SOFTWARE_FLOW_CONTROL = 1, + /** Hardware flow control */ + USB_SERIAL_HARDWARE_FLOW_CONTROL = 2, +} UsbSerial_FlowControl; + +/** + * @brief Defines parity for USB SERIAL DDK. + * + * @since 18 + */ +typedef enum { + /** No parity */ + USB_SERIAL_PARITY_NONE = 0, + /** Odd parity */ + USB_SERIAL_PARITY_ODD = 1, + /** Even parity */ + USB_SERIAL_PARITY_EVEN = 2, +} UsbSerial_Parity; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif // DDK_USB_SERIAL_TYPES_H +/** @} */ diff --git a/filemanagement/environment/include/oh_environment.h b/filemanagement/environment/include/oh_environment.h index 92bbebde7244dc43e62c3640f05fd0f702dbe67c..299e1272b679dfaa396b93d878196a31bad5ecc8 100644 --- a/filemanagement/environment/include/oh_environment.h +++ b/filemanagement/environment/include/oh_environment.h @@ -12,11 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H -#define FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H /** * @addtogroup Environment + * @{ * * @brief This module provides the ability to access the environment directory and obtain the native interface for public root directory. @@ -33,6 +32,9 @@ * @since 12 */ +#ifndef FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H +#define FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H + #include "error_code.h" #ifdef __cplusplus @@ -79,3 +81,4 @@ FileManagement_ErrCode OH_Environment_GetUserDocumentDir(char **result); #endif #endif //FILE_MANAGEMENT_ENVIRONMENT_OH_ENVIRONMENT_H +/** @} */ diff --git a/filemanagement/file_uri/include/oh_file_uri.h b/filemanagement/file_uri/include/oh_file_uri.h index adf9f0fa3c3211ff5ed2f748ffa0ac6ca91001d1..dde24336d1afa1b68ff5d630c6daa2dac80ff1f2 100644 --- a/filemanagement/file_uri/include/oh_file_uri.h +++ b/filemanagement/file_uri/include/oh_file_uri.h @@ -13,8 +13,15 @@ * limitations under the License. */ -#ifndef FILE_MANAGEMENT_OH_FILE_URI_H -#define FILE_MANAGEMENT_OH_FILE_URI_H +/** + * @addtogroup fileUri + * @{ + * + * @brief This module provides URI format validation and URI conversion processing, + * as well as obtaining URI-related information + * + * @since 12 + */ /** * @file oh_file_uri.h @@ -30,6 +37,9 @@ * @since 12 */ +#ifndef FILE_MANAGEMENT_OH_FILE_URI_H +#define FILE_MANAGEMENT_OH_FILE_URI_H + #include "error_code.h" #include #include @@ -116,4 +126,5 @@ FileManagement_ErrCode OH_FileUri_GetFileName(const char *uri, unsigned int leng #ifdef __cplusplus }; #endif +/** @} */ #endif // FILE_MANAGEMENT_OH_FILE_URI_H diff --git a/filemanagement/fileio/include/error_code.h b/filemanagement/fileio/include/error_code.h index 27944b43195a129dc9ef82bf245ad958c4a7e0e6..08b32f3a1d81de3d164f8f3bd3f441c12a5e9ec3 100644 --- a/filemanagement/fileio/include/error_code.h +++ b/filemanagement/fileio/include/error_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef FILE_MANAGEMENT_FILEIO_ERROR_CODE_H -#define FILE_MANAGEMENT_FILEIO_ERROR_CODE_H - /** * @addtogroup FileIO * @{ @@ -27,12 +24,15 @@ /** * @file error_code.h * @kit CoreFileKit - * + * @library NA * @brief Declare the error codes of file management module. * @syscap SystemCapability.FileManagement.File.FileIO * @since 12 */ +#ifndef FILE_MANAGEMENT_FILEIO_ERROR_CODE_H +#define FILE_MANAGEMENT_FILEIO_ERROR_CODE_H + #ifdef __cplusplus extern "C" { #endif @@ -81,3 +81,4 @@ typedef enum FileManagement_ErrCode { #endif #endif // FILE_MANAGEMENT_FILEIO_ERROR_CODE_H +/** @} */ diff --git a/filemanagement/fileio/include/oh_fileio.h b/filemanagement/fileio/include/oh_fileio.h index 845b9c0f996d1d27e13c4c5c539d9d5c0ae1a4e5..b318d4f84ade1251f90c834974bb196fdf8e1bde 100644 --- a/filemanagement/fileio/include/oh_fileio.h +++ b/filemanagement/fileio/include/oh_fileio.h @@ -12,11 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef FILE_MANAGEMENT_FILEIO_OH_FILEIO_H -#define FILE_MANAGEMENT_FILEIO_OH_FILEIO_H /** * @addtogroup FileIO + * @{ * * @brief This module provides the basic file operations. * @since 12 @@ -32,6 +31,9 @@ * @since 12 */ +#ifndef FILE_MANAGEMENT_FILEIO_OH_FILEIO_H +#define FILE_MANAGEMENT_FILEIO_OH_FILEIO_H + #include "error_code.h" #ifdef __cplusplus @@ -77,3 +79,4 @@ FileManagement_ErrCode OH_FileIO_GetFileLocation(char *uri, int uriLength, #endif #endif //FILE_MANAGEMENT_FILEIO_OH_FILEIO_H +/** @} */ diff --git a/filemanagement/fileshare/include/oh_file_share.h b/filemanagement/fileshare/include/oh_file_share.h index e89d335f5f6f3f4ace0b0faca5c946b892524c57..fc89f08edd9afabcc857ff04d60957f4fbb25a3a 100644 --- a/filemanagement/fileshare/include/oh_file_share.h +++ b/filemanagement/fileshare/include/oh_file_share.h @@ -13,12 +13,6 @@ * limitations under the License. */ -#ifndef FILE_MANAGEMENT_OH_FILE_SHARE_H -#define FILE_MANAGEMENT_OH_FILE_SHARE_H - -#include "error_code.h" -#include - /** * @addtogroup fileShare * @{ @@ -38,6 +32,13 @@ * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization * @since 12 */ + +#ifndef FILE_MANAGEMENT_OH_FILE_SHARE_H +#define FILE_MANAGEMENT_OH_FILE_SHARE_H + +#include "error_code.h" +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/global/resource_management/include/rawfile/raw_dir.h b/global/resource_management/include/rawfile/raw_dir.h index 94965690c36f02b3a0bdb7bd7cf572372aaa8ac9..7cc36d691905cc81238d48d0fb173bc0bd71a23d 100644 --- a/global/resource_management/include/rawfile/raw_dir.h +++ b/global/resource_management/include/rawfile/raw_dir.h @@ -31,6 +31,9 @@ * @brief Declares native functions related to raw file directories. * * For example, you can use the functions to traverse and close a raw file directory, and reset its index. + * + * @syscap SystemCapability.Global.ResourceManager + * @library librawfile.z.so * @kit LocalizationKit * @since 8 * @version 1.0 diff --git a/global/resource_management/include/rawfile/raw_file.h b/global/resource_management/include/rawfile/raw_file.h index 4aa80b8421965b389ab09a58acaa443b7ae9dd53..5616931a66f340822de15b3b6e40bb71c61364c5 100644 --- a/global/resource_management/include/rawfile/raw_file.h +++ b/global/resource_management/include/rawfile/raw_file.h @@ -31,6 +31,9 @@ * @brief Declares native functions related to raw file. * * For example, you can use the functions to search for, read, and close raw files. + * + * @syscap SystemCapability.Global.ResourceManager + * @library librawfile.z.so * @kit LocalizationKit * @since 8 * @version 1.0 diff --git a/global/resource_management/include/rawfile/raw_file_manager.h b/global/resource_management/include/rawfile/raw_file_manager.h index 1663e77bef1dee9c78116eab55f2508556f0fbc4..6b775fc15af57e05592f1a992dc3380d56ee9aec 100644 --- a/global/resource_management/include/rawfile/raw_file_manager.h +++ b/global/resource_management/include/rawfile/raw_file_manager.h @@ -31,6 +31,9 @@ * @brief Declares native functions for the resource manager. * * You can use the resource manager to open raw files for subsequent operations, such as seeking and reading. + * + * @syscap SystemCapability.Global.ResourceManager + * @library librawfile.z.so * @kit LocalizationKit * @since 8 * @version 1.0 diff --git a/global/resource_management/include/resourcemanager/ohresmgr.h b/global/resource_management/include/resourcemanager/ohresmgr.h index 9fc6efde4b4f1245f9cea1eb476ce27f6839db4b..ea4c2b7aed217284d8a526b4481503398aea92ea 100644 --- a/global/resource_management/include/resourcemanager/ohresmgr.h +++ b/global/resource_management/include/resourcemanager/ohresmgr.h @@ -50,10 +50,10 @@ extern "C" { * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -73,10 +73,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64(const NativeResource * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -96,10 +96,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data(const NativeReso * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -119,10 +119,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName(const NativeRe * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -142,10 +142,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName(const Nati * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -165,10 +165,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMedia(const NativeResourceManage * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -188,10 +188,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaData(const NativeResourceMa * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -211,10 +211,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName(const NativeResource * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. - * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means - * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param resultValue the result write to resultValue. * @param resultLen the media length write to resultLen. + * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means + * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -234,10 +234,10 @@ ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName(const NativeReso * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. + * @param drawableDescriptor the result write to drawableDescriptor. * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param type The optional parameter means the media type, 0 means the normal media, 1 means the the theme style media. - * @param drawableDescriptor the result write to drawableDescriptor. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -256,11 +256,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor(const NativeR * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resId Indicates the resource ID. + * @param drawableDescriptor the result write to drawableDescriptor. * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param type The optional parameter means the media type, 0 means the normal media, 1 means the the theme style media. * If this attribute is not required, set this parameter to 0. - * @param drawableDescriptor the result write to drawableDescriptor. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -278,11 +278,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData(const Nat * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. + * @param drawableDescriptor the result write to drawableDescriptor. * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param type The optional parameter means the media type, 0 means the normal media, 1 means the the theme style media, * 2 means the theme dynamic media. - * @param drawableDescriptor the result write to drawableDescriptor. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -300,11 +300,11 @@ ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName(const N * @param mgr Indicates the pointer to {@link NativeResourceManager} * {@link OH_ResourceManager_InitNativeResourceManager}. * @param resName Indicates the resource name. + * @param drawableDescriptor the result write to drawableDescriptor. * @param density The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. If this attribute is not required, set this parameter to 0. * @param type The optional parameter means the media type, 0 means the normal media, 1 means the the theme style media, * 2 means the theme dynamic media. If this attribute is not required, set this parameter to 0. - * @param drawableDescriptor the result write to drawableDescriptor. * @return {@link SUCCESS} 0 - Success. * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. Possible causes: * 1.Incorrect parameter types; 2.Parameter verification failed. @@ -552,6 +552,8 @@ ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray(char ***resValue {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. * @since 12 + * @deprecated since 18 + * @useinstead OH_ResourceManager_GetIntPluralString */ ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourceManager *mgr, uint32_t resId, uint32_t num, char **resultValue); @@ -575,10 +577,108 @@ ResourceManager_ErrorCode OH_ResourceManager_GetPluralString(const NativeResourc {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. * @since 12 + * @deprecated since 18 + * @useinstead OH_ResourceManager_GetIntPluralStringByName */ ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName(const NativeResourceManager *mgr, const char *resName, uint32_t num, char **resultValue); +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the ID string corresponding to the specified number. + * You need to call free() to release the memory for the string. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @param num - an integer used to get the correct string for the current plural rules. + * @param resultValue the result write to resultValue. + * @param { const char* | int | float } args - Indicates the formatting string resource parameters. + * @return {@link SUCCESS} 0 - Success. + * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. + Possible causes: Incorrect parameter types. + {@link ERROR_CODE_RES_ID_NOT_FOUND} 9001001 - Invalid resource ID. + {@link ERROR_CODE_RES_NOT_FOUND_BY_ID} 9001002 - No matching resource is found based on the resource ID. + {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. + {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. + * @since 18 + */ +ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralString(const NativeResourceManager *mgr, uint32_t resId, + uint32_t num, char **resultValue, ...); + +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the ID string corresponding to the specified number. + * You need to call free() to release the memory for the string. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resId Indicates the resource ID. + * @param num - a double parameter used to get the correct string for the current plural rules. + * @param resultValue the result write to resultValue. + * @param { const char* | int | float } args - Indicates the formatting string resource parameters. + * @return {@link SUCCESS} 0 - Success. + * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. + Possible causes: Incorrect parameter types. + {@link ERROR_CODE_RES_ID_NOT_FOUND} 9001001 - Invalid resource ID. + {@link ERROR_CODE_RES_NOT_FOUND_BY_ID} 9001002 - No matching resource is found based on the resource ID. + {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. + {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. + * @since 18 + */ +ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralString(const NativeResourceManager *mgr, uint32_t resId, + double num, char **resultValue, ...); + +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the Name string corresponding to the specified number. + * You need to call free() to release the memory for the string. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource name. + * @param num - an integer used to get the correct string for the current plural rules. + * @param resultValue the result write to resultValue. + * @param { const char* | int | float } args - Indicates the formatting string resource parameters. + * @return {@link SUCCESS} 0 - Success. + * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. + Possible causes: Incorrect parameter types. + {@link ERROR_CODE_RES_NAME_NOT_FOUND} 9001003 - Invalid resource name. + {@link ERROR_CODE_RES_NOT_FOUND_BY_NAME} 9001004 - No matching resource is found based on the resource name. + {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. + {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. + * @since 18 + */ +ResourceManager_ErrorCode OH_ResourceManager_GetIntPluralStringByName(const NativeResourceManager *mgr, + const char *resName, uint32_t num, char **resultValue, ...); + +/** + * @brief Obtains the singular-plural character string represented. + * + * Obtains the singular-plural character string represented by the Name string corresponding to the specified number. + * You need to call free() to release the memory for the string. + * + * @param mgr Indicates the pointer to {@link NativeResourceManager} + * {@link OH_ResourceManager_InitNativeResourceManager}. + * @param resName Indicates the resource name. + * @param num - a double parameter used to get the correct string for the current plural rules. + * @param resultValue the result write to resultValue. + * @param { const char* | int | float } args - Indicates the formatting string resource parameters. + * @return {@link SUCCESS} 0 - Success. + * {@link ERROR_CODE_INVALID_INPUT_PARAMETER} 401 - The input parameter invalid. + Possible causes: Incorrect parameter types. + {@link ERROR_CODE_RES_NAME_NOT_FOUND} 9001003 - Invalid resource name. + {@link ERROR_CODE_RES_NOT_FOUND_BY_NAME} 9001004 - No matching resource is found based on the resource name. + {@link ERROR_CODE_RES_REF_TOO_MUCH} 9001006 - The resource is referenced cyclically. + {@link ERROR_CODE_OUT_OF_MEMORY} 9001100 - Out of memory. + * @since 18 + */ +ResourceManager_ErrorCode OH_ResourceManager_GetDoublePluralStringByName(const NativeResourceManager *mgr, + const char *resName, double num, char **resultValue, ...); + /** * @brief Obtains the color resource. * diff --git a/global/resource_management/libnative_resmgr.ndk.json b/global/resource_management/libnative_resmgr.ndk.json index dcb320f422601685fedcaf4d6563333549dda9dc..ecf4734743c4b9741c0cb551afffa01c07ab82e2 100644 --- a/global/resource_management/libnative_resmgr.ndk.json +++ b/global/resource_management/libnative_resmgr.ndk.json @@ -138,5 +138,21 @@ { "first_introduced": "12", "name": "OH_ResourceManager_RemoveResource" + }, + { + "first_introduced": "18", + "name": "OH_ResourceManager_GetIntPluralString" + }, + { + "first_introduced": "18", + "name": "OH_ResourceManager_GetDoublePluralString" + }, + { + "first_introduced": "18", + "name": "OH_ResourceManager_GetIntPluralStringByName" + }, + { + "first_introduced": "18", + "name": "OH_ResourceManager_GetDoublePluralStringByName" } ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_buffer/buffer_common.h b/graphic/graphic_2d/native_buffer/buffer_common.h index fd1bfa4a5a61e90172f1e55c41b395c3e9770030..20b22fd8733a829f2c4b6c2514bf6adba5b6cc54 100644 --- a/graphic/graphic_2d/native_buffer/buffer_common.h +++ b/graphic/graphic_2d/native_buffer/buffer_common.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NDK_INCLUDE_BUFFER_COMMON_H_ -#define NDK_INCLUDE_BUFFER_COMMON_H_ - /** * @addtogroup OH_NativeBuffer * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef NDK_INCLUDE_BUFFER_COMMON_H_ +#define NDK_INCLUDE_BUFFER_COMMON_H_ + #ifdef __cplusplus extern "C" { #endif @@ -138,7 +138,12 @@ typedef enum OH_NativeBuffer_MetadataType { /** HDR10 */ OH_VIDEO_HDR_HDR10, /** HDR VIVID */ - OH_VIDEO_HDR_VIVID + OH_VIDEO_HDR_VIVID, + /** + * NONE Metadata + * @since 13 + */ + OH_VIDEO_NONE = -1 } OH_NativeBuffer_MetadataType; /** diff --git a/graphic/graphic_2d/native_buffer/native_buffer.h b/graphic/graphic_2d/native_buffer/native_buffer.h index 154df76d3ea589a746fdd175691561d2b24969e2..70d47a631f87e2dbc026ae2cf59ba722381ac7b8 100644 --- a/graphic/graphic_2d/native_buffer/native_buffer.h +++ b/graphic/graphic_2d/native_buffer/native_buffer.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NDK_INCLUDE_NATIVE_BUFFER_H_ -#define NDK_INCLUDE_NATIVE_BUFFER_H_ - /** * @addtogroup OH_NativeBuffer * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef NDK_INCLUDE_NATIVE_BUFFER_H_ +#define NDK_INCLUDE_NATIVE_BUFFER_H_ + #include #include #include @@ -114,42 +114,42 @@ typedef enum OH_NativeBuffer_Format { */ NATIVEBUFFER_PIXEL_FMT_YUV_422_I, /** - * YCBCR422 semi-plannar format + * YCBCR422 semi-planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCBCR_422_SP, /** - * YCRCB422 semi-plannar format + * YCRCB422 semi-planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCRCB_422_SP, /** - * YCBCR420 semi-plannar format + * YCBCR420 semi-planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCBCR_420_SP, /** - * YCRCB420 semi-plannar format + * YCRCB420 semi-planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCRCB_420_SP, /** - * YCBCR422 plannar format + * YCBCR422 planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCBCR_422_P, /** - * YCRCB422 plannar format + * YCRCB422 planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCRCB_422_P, /** - * YCBCR420 plannar format + * YCBCR420 planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCBCR_420_P, /** - * YCRCB420 plannar format + * YCRCB420 planar format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_YCRCB_420_P, @@ -194,7 +194,17 @@ typedef enum OH_NativeBuffer_Format { */ NATIVEBUFFER_PIXEL_FMT_RAW10, /** - * vender mask format + * BLOB format + * @since 15 + */ + NATIVEBUFFER_PIXEL_FMT_BLOB, + /** + * RGBA16 float format + * @since 15 + */ + NATIVEBUFFER_PIXEL_FMT_RGBA16_FLOAT, + /** + * vendor mask format * @since 12 */ NATIVEBUFFER_PIXEL_FMT_VENDER_MASK = 0X7FFF0000, @@ -246,7 +256,7 @@ typedef enum OH_NativeBuffer_ColorGamut { /** * @brief OH_NativeBuffer config. \n - * Used to allocating new OH_NativeBuffer andquery parameters if existing ones. + * Used to allocating new OH_NativeBuffer and query parameters if existing ones. * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @since 9 @@ -288,7 +298,7 @@ typedef struct { /** * @brief Alloc a OH_NativeBuffer that matches the passed BufferRequestConfig. \n * A new OH_NativeBuffer instance is created each time this function is called.\n - * This interface needs to be used in conjunction with OH_NativeBuffer_Unreference<\b>, + * This interface needs to be used in conjunction with OH_NativeBuffer_Unreference, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -303,7 +313,7 @@ OH_NativeBuffer* OH_NativeBuffer_Alloc(const OH_NativeBuffer_Config* config); /** * @brief Adds the reference count of a OH_NativeBuffer.\n - * This interface needs to be used in conjunction with OH_NativeBuffer_Unreference<\b>, + * This interface needs to be used in conjunction with OH_NativeBuffer_Unreference, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -343,7 +353,7 @@ void OH_NativeBuffer_GetConfig(OH_NativeBuffer *buffer, OH_NativeBuffer_Config* /** * @brief Provide direct cpu access to the OH_NativeBuffer in the process's address space.\n - * This interface needs to be used in conjunction with OH_NativeBuffer_Unmap<\b>.\n + * This interface needs to be used in conjunction with OH_NativeBuffer_Unmap.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer @@ -369,7 +379,7 @@ int32_t OH_NativeBuffer_Map(OH_NativeBuffer *buffer, void **virAddr); int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); /** - * @brief Get the systen wide unique sequence number of the OH_NativeBuffer.\n + * @brief Get the system wide unique sequence number of the OH_NativeBuffer.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer @@ -381,14 +391,14 @@ int32_t OH_NativeBuffer_Unmap(OH_NativeBuffer *buffer); uint32_t OH_NativeBuffer_GetSeqNum(OH_NativeBuffer *buffer); /** - * @brief Provide direct cpu access to the potentially multi-plannar OH_NativeBuffer in the process's address space.\n + * @brief Provide direct cpu access to the potentially multi-planar OH_NativeBuffer in the process's address space.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param buffer Indicates the pointer to a OH_NativeBuffer instance. * @param virAddr Indicates the address of the OH_NativeBuffer in virtual memory. * @param outPlanes Indicates all image planes that contain the pixel data. - * @return Returns an error code, 0 is sucess, otherwise, failed. + * @return Returns an error code, 0 is success, otherwise, failed. * @since 12 * @version 1.0 */ @@ -401,7 +411,7 @@ int32_t OH_NativeBuffer_MapPlanes(OH_NativeBuffer *buffer, void **virAddr, OH_Na * @syscap SystemCapability.Graphic.Graphic2D.NativeBuffer * @param nativeWindowBuffer Indicates the pointer to a OHNativeWindowBuffer instance. * @param buffer Indicates the pointer to a OH_NativeBuffer pointer. - * @return Returns an error code, 0 is sucess, otherwise, failed. + * @return Returns an error code, 0 is success, otherwise, failed. * @since 12 * @version 1.0 */ diff --git a/graphic/graphic_2d/native_color_space_manager/native_color_space_manager.h b/graphic/graphic_2d/native_color_space_manager/native_color_space_manager.h index e4634b4743b8fed57ae1fc1fb10d8148a11423d5..a2528fcb9d824f3b7d7cd1075225abfdd926903b 100644 --- a/graphic/graphic_2d/native_color_space_manager/native_color_space_manager.h +++ b/graphic/graphic_2d/native_color_space_manager/native_color_space_manager.h @@ -29,6 +29,7 @@ * * @brief Defines the functions for obtaining and using a native colorSpaceManager. * + * @kit ArkGraphics2D * @library libnative_color_space_manager.so * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core * @since 13 diff --git a/graphic/graphic_2d/native_display_soloist/native_display_soloist.h b/graphic/graphic_2d/native_display_soloist/native_display_soloist.h index abbda4fdefc2d61ab483d52a51a5d854c87d217f..8f3b9dca04d9f42379b151997a6e3bd0d2cdf8b2 100644 --- a/graphic/graphic_2d/native_display_soloist/native_display_soloist.h +++ b/graphic/graphic_2d/native_display_soloist/native_display_soloist.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_ -#define C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_ - /** * @addtogroup NativeDisplaySoloist * @{ @@ -38,6 +35,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_ +#define C_INCLUDE_NATIVE_DISPLAY_SOLOIST_H_ + #include #include #ifdef __cplusplus diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index aea6e1dc4d1cfb37bb9425bf80c1ba123ca28877..88c0459bc9fd316e2be057729c6e97d9081011e3 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -50,6 +50,10 @@ ohos_ndk_headers("native_drawing_header") { "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_surface.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_blob.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_declaration.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_line.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_lineTypography.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_run.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_typography.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_typeface.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_types.h", @@ -95,6 +99,10 @@ ohos_ndk_library("libnative_drawing_ndk") { "native_drawing/drawing_surface.h", "native_drawing/drawing_text_blob.h", "native_drawing/drawing_text_declaration.h", + "native_drawing/drawing_text_font_descriptor.h", + "native_drawing/drawing_text_line.h", + "native_drawing/drawing_text_lineTypography.h", + "native_drawing/drawing_text_run.h", "native_drawing/drawing_text_typography.h", "native_drawing/drawing_typeface.h", "native_drawing/drawing_types.h", diff --git a/graphic/graphic_2d/native_drawing/drawing_bitmap.h b/graphic/graphic_2d/native_drawing/drawing_bitmap.h index 5811794feb5fdedd3b006fd9dcc62a4da363d17d..95dd825f93f298b52e560a7a645346104da734e2 100644 --- a/graphic/graphic_2d/native_drawing/drawing_bitmap.h +++ b/graphic/graphic_2d/native_drawing/drawing_bitmap.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_BITMAP_H -#define C_INCLUDE_DRAWING_BITMAP_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_BITMAP_H +#define C_INCLUDE_DRAWING_BITMAP_H + #include "drawing_types.h" #ifdef __cplusplus @@ -73,114 +73,114 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); * @brief Destroys an OH_Drawing_Bitmap object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @since 8 * @version 1.0 */ -void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); +void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap* bitmap); /** * @brief Creates an OH_Drawing_Bitmap object with OH_Drawing_Image_Info object * and sets the mem address or pixel storage. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @param imageInfo Indicates the pointer to an OH_Drawing_Image_Info object. * @param pixels the pointer to memory address or pixel storage. * @param rowBytes size of pixel row or larger. * @return Returns the pointer to the OH_Drawing_Bitmap object created. * @since 12 * @version 1.0 */ -OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels(OH_Drawing_Image_Info*, void* pixels, uint32_t rowBytes); +OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels(OH_Drawing_Image_Info* imageInfo, void* pixels, uint32_t rowBytes); /** * @brief Initializes the width and height of an OH_Drawing_Bitmap object * and sets the pixel format for the bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @param width Indicates the width of the bitmap to be initialized. * @param height Indicates the height of the bitmap to be initialized. - * @param OH_Drawing_BitmapFormat Indicates the pixel format of the bitmap to be initialized, + * @param bitmapFormat Indicates the pixel format of the bitmap to be initialized, * including the pixel color type and alpha type. * @since 8 * @version 1.0 */ -void OH_Drawing_BitmapBuild( - OH_Drawing_Bitmap*, const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat*); +void OH_Drawing_BitmapBuild(OH_Drawing_Bitmap* bitmap, + const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat* bitmapFormat); /** * @brief Obtains the width of a bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns the width. * @since 8 * @version 1.0 */ -uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap*); +uint32_t OH_Drawing_BitmapGetWidth(OH_Drawing_Bitmap* bitmap); /** * @brief Obtains the height of a bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns the height. * @since 8 * @version 1.0 */ -uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap*); +uint32_t OH_Drawing_BitmapGetHeight(OH_Drawing_Bitmap* bitmap); /** * @brief Obtains the color format of a bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns the bitmap color format. * @since 12 * @version 1.0 */ -OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat(OH_Drawing_Bitmap*); +OH_Drawing_ColorFormat OH_Drawing_BitmapGetColorFormat(OH_Drawing_Bitmap* bitmap); /** * @brief Obtains the alpha format of a bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns the bitmap alpha format. * @since 12 * @version 1.0 */ -OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat(OH_Drawing_Bitmap*); +OH_Drawing_AlphaFormat OH_Drawing_BitmapGetAlphaFormat(OH_Drawing_Bitmap* bitmap); /** * @brief Obtains the pixel address of a bitmap. You can use this address to obtain the pixel data of the bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns the pixel address. * @since 8 * @version 1.0 */ -void* OH_Drawing_BitmapGetPixels(OH_Drawing_Bitmap*); +void* OH_Drawing_BitmapGetPixels(OH_Drawing_Bitmap* bitmap); /** * @brief Gets the image info. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. - * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param imageInfo Indicates the pointer to an OH_Drawing_Image_Info object. * @since 12 * @version 1.0 */ -void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap*, OH_Drawing_Image_Info*); +void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap* bitmap, OH_Drawing_Image_Info* imageInfo); /** * @brief Copies a rect of pixels from bitmap to dstPixels. Copy starts at (srcX, srcY), * and does not exceed bitmap width and height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @param dstInfo Indicates the pointer to an OH_Drawing_Image_Info object. * @param dstPixels Destination pixel storage. * @param dstRowBytes Destination row length. @@ -190,7 +190,7 @@ void OH_Drawing_BitmapGetImageInfo(OH_Drawing_Bitmap*, OH_Drawing_Image_Info*); * @since 12 * @version 1.0 */ -bool OH_Drawing_BitmapReadPixels(OH_Drawing_Bitmap*, const OH_Drawing_Image_Info* dstInfo, +bool OH_Drawing_BitmapReadPixels(OH_Drawing_Bitmap* bitmap, const OH_Drawing_Image_Info* dstInfo, void* dstPixels, size_t dstRowBytes, int32_t srcX, int32_t srcY); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h index 1762a979bb63d499ac6c2e23f0fa33ed57709d6d..d677d9aece287b7ae8621ffe19e86cf1d0ee2627 100644 --- a/graphic/graphic_2d/native_drawing/drawing_brush.h +++ b/graphic/graphic_2d/native_drawing/drawing_brush.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_BRUSH_H -#define C_INCLUDE_DRAWING_BRUSH_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_BRUSH_H +#define C_INCLUDE_DRAWING_BRUSH_H + #include "drawing_types.h" #ifdef __cplusplus @@ -60,158 +60,158 @@ OH_Drawing_Brush* OH_Drawing_BrushCreate(void); * @brief Creates an OH_Drawing_Brush copy object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @return Returns the pointer to the OH_Drawing_Brush object created. * If nullptr is returned, the creation fails. * The possible cause of the failure is that the available memory is empty or a nullptr is passed. * @since 12 * @version 1.0 */ -OH_Drawing_Brush* OH_Drawing_BrushCopy(OH_Drawing_Brush*); +OH_Drawing_Brush* OH_Drawing_BrushCopy(OH_Drawing_Brush* brush); /** * @brief Destroys an OH_Drawing_Brush object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @since 8 * @version 1.0 */ -void OH_Drawing_BrushDestroy(OH_Drawing_Brush*); +void OH_Drawing_BrushDestroy(OH_Drawing_Brush* brush); /** * @brief Checks whether anti-aliasing is enabled for a brush. If anti-aliasing is enabled, * edges will be drawn with partial transparency. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @return Returns true if anti-aliasing is enabled; returns false otherwise. * @since 8 * @version 1.0 */ -bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); +bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush* brush); /** * @brief Enables or disables anti-aliasing for a brush. If anti-aliasing is enabled, * edges will be drawn with partial transparency. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param bool Specifies whether to enable anti-aliasing. The value true means + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param antiAlias Specifies whether to enable anti-aliasing. The value true means * to enable anti-aliasing, and false means the opposite. * @since 8 * @version 1.0 */ -void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush*, bool); +void OH_Drawing_BrushSetAntiAlias(OH_Drawing_Brush* brush, bool antiAlias); /** * @brief Obtains the color of a brush. The color is used by the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @return Returns a 32-bit (ARGB) variable that describes the color. * @since 8 * @version 1.0 */ -uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush*); +uint32_t OH_Drawing_BrushGetColor(const OH_Drawing_Brush* brush); /** * @brief Sets the color for a brush. The color will be used by the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @param color Indicates the color to set, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ -void OH_Drawing_BrushSetColor(OH_Drawing_Brush*, uint32_t color); +void OH_Drawing_BrushSetColor(OH_Drawing_Brush* brush, uint32_t color); /** * @brief Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @return Returns a 8-bit variable that describes the alpha. * @since 11 * @version 1.0 */ -uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush*); +uint8_t OH_Drawing_BrushGetAlpha(const OH_Drawing_Brush* brush); /** * @brief Sets the alpha for a brush. The alpha will be used by the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @param alpha Indicates the alpha to set, which is a 8-bit variable. * @since 11 * @version 1.0 */ -void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush*, uint8_t alpha); +void OH_Drawing_BrushSetAlpha(OH_Drawing_Brush* brush, uint8_t alpha); /** * @brief Sets the shaderEffect for a brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param OH_Drawing_ShaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param shaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. * @since 11 * @version 1.0 */ -void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect*); +void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush* brush, OH_Drawing_ShaderEffect* shaderEffect); /** * @brief Sets the shadowLayer for a brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param OH_Drawing_ShadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param shadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. * @since 12 * @version 1.0 */ -void OH_Drawing_BrushSetShadowLayer(OH_Drawing_Brush*, OH_Drawing_ShadowLayer*); +void OH_Drawing_BrushSetShadowLayer(OH_Drawing_Brush* brush, OH_Drawing_ShadowLayer* shadowLayer); /** * @brief Sets the filter for a brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. * @since 11 * @version 1.0 */ -void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); +void OH_Drawing_BrushSetFilter(OH_Drawing_Brush* brush, OH_Drawing_Filter* filter); /** * @brief Gets the filter from a brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. * @since 12 * @version 1.0 */ -void OH_Drawing_BrushGetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); +void OH_Drawing_BrushGetFilter(OH_Drawing_Brush* brush, OH_Drawing_Filter* filter); /** * @brief Sets a blender that implements the specified blendmode enum for a brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Brush object. - * @param OH_Drawing_BlendMode Indicates the blend mode. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. + * @param blendMode Indicates the blend mode. * @since 12 * @version 1.0 */ -void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode); +void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush* brush, OH_Drawing_BlendMode blendMode); /** * @brief Resets all brush contents to their initial values. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @since 12 * @version 1.0 */ -void OH_Drawing_BrushReset(OH_Drawing_Brush*); +void OH_Drawing_BrushReset(OH_Drawing_Brush* brush); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index f78e6127f9297b09d0a66a932d3fd2165787339b..2581f31ab87dfc947b1b3a3e25e35b3f8d6265d9 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_H -#define C_INCLUDE_DRAWING_H - /** * @addtogroup Drawing * @{ @@ -40,8 +37,12 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_H +#define C_INCLUDE_DRAWING_H + #include "drawing_error_code.h" #include "drawing_types.h" +#include "drawing_sampling_options.h" #ifdef __cplusplus extern "C" { @@ -78,128 +79,128 @@ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); * @brief Destroys an OH_Drawing_Canvas object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); +void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas* canvas); /** * @brief Binds a bitmap to a canvas so that the content drawn on the canvas * is output to the bitmap (this process is called CPU rendering). * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); +void OH_Drawing_CanvasBind(OH_Drawing_Canvas* canvas, OH_Drawing_Bitmap* bitmap); /** * @brief Attaches a pen to a canvas so that the canvas will use the style and color of the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); +void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas* canvas, const OH_Drawing_Pen* pen); /** * @brief Detaches the pen from a canvas so that the canvas will not use the style * and color of the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas*); +void OH_Drawing_CanvasDetachPen(OH_Drawing_Canvas* canvas); /** * @brief Attaches a brush to a canvas so that the canvas will use the style and color of the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas*, const OH_Drawing_Brush*); +void OH_Drawing_CanvasAttachBrush(OH_Drawing_Canvas* canvas, const OH_Drawing_Brush* brush); /** * @brief Detaches the brush from a canvas so that the canvas will not use the style * and color of the brush to fill in a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); +void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas* canvas); /** * @brief Saves the current canvas status (canvas matrix) to the top of the stack. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); +void OH_Drawing_CanvasSave(OH_Drawing_Canvas* canvas); /** * @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing. * Calling restore discards changes to matrix and clip, and draws the bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*); +void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, const OH_Drawing_Brush* brush); /** * @brief Restores the canvas status (canvas matrix) saved on the top of the stack. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasRestore(OH_Drawing_Canvas*); +void OH_Drawing_CanvasRestore(OH_Drawing_Canvas* canvas); /** * @brief Gets the number of the canvas status (canvas matrix) saved in the stack. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @return Returns a 32-bit variable that describes the number of canvas status. * @since 11 * @version 1.0 */ -uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas*); +uint32_t OH_Drawing_CanvasGetSaveCount(OH_Drawing_Canvas* canvas); /** * @brief Restores the specific number of the canvas status (canvas matrix) saved in the stack. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param saveCount Indicates the specific number of canvas status. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); +void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas* canvas, uint32_t saveCount); /** * @brief Draws a line segment. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param x1 Indicates the x coordinate of the start point of the line segment. * @param y1 Indicates the y coordinate of the start point of the line segment. * @param x2 Indicates the x coordinate of the end point of the line segment. @@ -207,55 +208,76 @@ void OH_Drawing_CanvasRestoreToCount(OH_Drawing_Canvas*, uint32_t saveCount); * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas*, float x1, float y1, float x2, float y2); +void OH_Drawing_CanvasDrawLine(OH_Drawing_Canvas* canvas, float x1, float y1, float x2, float y2); /** * @brief Draws a path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); +void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path); + +/** + * @brief Divides the pixelmap into a grid with nine sections: four sides, four corners, and the center. + * Draws the specified section of the pixelmap onto the canvas, corners are unmodified or scaled down if they exceed + * the destination rectangle, center and four sides are scaled to fit remaining space. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param pixelMap Indicates the pointer to an OH_Drawing_PixelMap object. + * @param center Divides the pixelmap into nine sections: four sides, four corners, and the center. + * @param dst The area of destination canvas. + * @param mode Filter mode. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, pixelMap + * and dst is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPixelMapNine(OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, + const OH_Drawing_Rect* center, const OH_Drawing_Rect* dst, OH_Drawing_FilterMode mode); /** * @brief Draw the specified area of the Media::PixelMap to the specified area of the canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_PixelMap Indicates the pointer to an OH_Drawing_PixelMap object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param pixelMap Indicates the pointer to an OH_Drawing_PixelMap object. * @param src the area of source pixelmap. * @param dst the area of destination canvas. - * @param OH_Drawing_SamplingOptions the sampling mode. + * @param samplingOptions the sampling mode. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawPixelMapRect(OH_Drawing_Canvas*, OH_Drawing_PixelMap*, const OH_Drawing_Rect* src, - const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*); +void OH_Drawing_CanvasDrawPixelMapRect(OH_Drawing_Canvas* canvas, OH_Drawing_PixelMap* pixelMap, + const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* samplingOptions); /** * @brief Fills clipped canvas area with brush. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param brush Indicates the pointer to an OH_Drawing_Brush object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawBackground(OH_Drawing_Canvas*, const OH_Drawing_Brush*); +void OH_Drawing_CanvasDrawBackground(OH_Drawing_Canvas* canvas, const OH_Drawing_Brush* brush); /** * @brief Draws region using clip, matrix and paint. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Region Indicates the pointer to an OH_Drawing_Region object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param region Indicates the pointer to an OH_Drawing_Region object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawRegion(OH_Drawing_Canvas*, const OH_Drawing_Region*); +void OH_Drawing_CanvasDrawRegion(OH_Drawing_Canvas* canvas, const OH_Drawing_Region* region); /** * @brief Enumerates of scale to fit flags, selects if an array of points are drawn as discrete points, as lines, @@ -297,66 +319,66 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawPoint(OH_Drawing_Canvas* canvas, const * @brief Draws point array as separate point, line segment or open polygon according to given point mode. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param mode Draw points enum. * @param count The point count. - * @param OH_Drawing_Point2D Point struct array. + * @param point2D Point struct array. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawPoints(OH_Drawing_Canvas*, OH_Drawing_PointMode mode, - uint32_t count, const OH_Drawing_Point2D*); +void OH_Drawing_CanvasDrawPoints(OH_Drawing_Canvas* canvas, OH_Drawing_PointMode mode, + uint32_t count, const OH_Drawing_Point2D* point2D); /** * @brief Draws a bitmap. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @param left Indicates the left position of the OH_Drawing_Bitmap. * @param top Indicates the top position of the OH_Drawing_Bitmap. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); +void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas* canvas, const OH_Drawing_Bitmap* bitmap, float left, float top); /** * @brief Draw the specified area of the bitmap to the specified area of the canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @param src the area of source bitmap, can be nullptr. * @param dst the area of destination canvas. - * @param OH_Drawing_SamplingOptions the sampling mode. + * @param samplingOptions the sampling mode. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawBitmapRect(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, const OH_Drawing_Rect* src, - const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*); +void OH_Drawing_CanvasDrawBitmapRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Bitmap* bitmap, + const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* samplingOptions); /** * @brief Draws a rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*); +void OH_Drawing_CanvasDrawRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect); /** * @brief Draws a circle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param point Indicates the pointer to an OH_Drawing_Point object. * @param radius Indicates the radius of the circle. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas*, const OH_Drawing_Point*, float radius); +void OH_Drawing_CanvasDrawCircle(OH_Drawing_Canvas* canvas, const OH_Drawing_Point* point, float radius); /** * @brief Fills the entire canvas with the specified color and blend mode. @@ -378,44 +400,81 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawColor(OH_Drawing_Canvas* canvas, uint3 * @brief Draws an oval. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas*, const OH_Drawing_Rect*); +void OH_Drawing_CanvasDrawOval(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect); /** * @brief Draws an arc. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @param startAngle Indicates the startAngle of the arc. * @param sweepAngle Indicates the sweepAngle of the arc. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); +void OH_Drawing_CanvasDrawArc(OH_Drawing_Canvas* canvas, + const OH_Drawing_Rect* rect, float startAngle, float sweepAngle); + +/** + * @brief Draws an arc with use center. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param startAngle Indicates the startAngle of the arc. + * @param sweepAngle Indicates the sweepAngle of the arc. + * @param useCenter If true, include the center of the oval in the arc, and close it if it is being stroked. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or rect is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasDrawArcWithCenter(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, + float startAngle, float sweepAngle, bool useCenter); + /** * @brief Draws a roundrect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*); +void OH_Drawing_CanvasDrawRoundRect(OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* roundRect); + +/** + * @brief Draw two nested rounded rectangles. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param outer Rounded rectangle object, representing the outer rounded rectangle boundary. + * @param inner Rounded rectangle object, representing the internal rounded rectangle boundary. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of canvas, outer + * and inner is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasDrawNestedRoundRect(OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* outer, + const OH_Drawing_RoundRect* inner); /** * @brief Draws a single character. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param str Indicates the single character encoded in UTF-8. - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param x Indicates the horizontal offset applied to the single character. * @param y Indicates the vertical offset applied to the single character. * @return Returns the error code. @@ -432,14 +491,14 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawSingleCharacter(OH_Drawing_Canvas* can * @brief Draws a textblob. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_TextBlob Indicates the pointer to an OH_Drawing_TextBlob object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param textBlob Indicates the pointer to an OH_Drawing_TextBlob object. * @param x Indicates the horizontal offset applied to blob. * @param y Indicates the vertical offset applied to blob. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob*, float x, float y); +void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas* canvas, const OH_Drawing_TextBlob* textBlob, float x, float y); /** * @brief Enumerates clip op. @@ -462,42 +521,42 @@ typedef enum { * @brief Clip a rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @param clipOp Indicates the operation to apply to clip. * @param doAntiAlias Indicates whether clip operation requires anti-aliased. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas*, const OH_Drawing_Rect*, +void OH_Drawing_CanvasClipRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** * @brief Clip a round rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object. * @param clipOp Indicates the operation to apply to clip. * @param doAntiAlias Indicates whether clip operation requires anti-aliased. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasClipRoundRect(OH_Drawing_Canvas*, const OH_Drawing_RoundRect*, +void OH_Drawing_CanvasClipRoundRect(OH_Drawing_Canvas* canvas, const OH_Drawing_RoundRect* roundRect, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** * @brief Clip a path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param clipOp Indicates the operation to apply to clip. * @param doAntiAlias Indicates whether clip operation requires anti-aliased. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas*, const OH_Drawing_Path*, +void OH_Drawing_CanvasClipPath(OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, OH_Drawing_CanvasClipOp clipOp, bool doAntiAlias); /** @@ -520,104 +579,104 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasClipRegion(OH_Drawing_Canvas* canvas, cons * @brief Rotates by degrees. Positive degrees rotates clockwise. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param degrees Indicates the amount to rotate, in degrees. * @param px Indicates the x-axis value of the point to rotate about. * @param py Indicates the y-axis value of the point to rotate about. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasRotate(OH_Drawing_Canvas*, float degrees, float px, float py); +void OH_Drawing_CanvasRotate(OH_Drawing_Canvas* canvas, float degrees, float px, float py); /** * @brief Translates by dx along the x-axis and dy along the y-axis. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param dx Indicates the distance to translate on x-axis. * @param dy Indicates the distance to translate on y-axis. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); +void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas* canvas, float dx, float dy); /** * @brief Scales by sx on the x-axis and sy on the y-axis. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param sx Indicates the amount to scale on x-axis. * @param sy Indicates the amount to scale on y-axis. * @since 11 * @version 1.0 */ -void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); +void OH_Drawing_CanvasScale(OH_Drawing_Canvas* canvas, float sx, float sy); /** * @brief Skew by sx on the x-axis and sy on the y-axis. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param sx Indicates the amount to skew on x-axis. * @param sy Indicates the amount to skew on y-axis. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasSkew(OH_Drawing_Canvas*, float sx, float sy); +void OH_Drawing_CanvasSkew(OH_Drawing_Canvas* canvas, float sx, float sy); /** * @brief Get the width of a canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 12 * @version 1.0 */ -int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*); +int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas* canvas); /** * @brief Get the height of a canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 12 * @version 1.0 */ -int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*); +int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas* canvas); /** * @brief Get the bounds of clip of a canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*); +void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas* canvas, OH_Drawing_Rect* rect); /** * @brief Get a 3x3 matrix of the transform from local coordinates to 'device'. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); +void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas* canvas, OH_Drawing_Matrix* matrix); /** * @brief Use the passed matrix to transforming the geometry, then use existing matrix. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object, + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object, * represents the matrix which is passed. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); +void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas* canvas, OH_Drawing_Matrix* matrix); /** * @brief Enumerates of shadow flags. @@ -648,8 +707,8 @@ typedef enum { * @brief Use circular light to draw an offset spot shadow and outlining ambient shadow for the given path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object, use to generate shadows. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates the pointer to an OH_Drawing_Path object, use to generate shadows. * @param planeParams Represents the value of the function which returns Z offset of the occluder from the * canvas based on x and y. * @param devLightPos Represents the position of the light relative to the canvas. @@ -660,7 +719,7 @@ typedef enum { * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams, +void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas* canvas, OH_Drawing_Path* path, OH_Drawing_Point3D planeParams, OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, OH_Drawing_CanvasShadowFlags flag); @@ -668,66 +727,66 @@ void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawin * @brief Clears a canvas by using a specified color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param color Indicates the color, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ -void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); +void OH_Drawing_CanvasClear(OH_Drawing_Canvas* canvas, uint32_t color); /** * @brief Sets matrix of canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); +void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas* canvas, OH_Drawing_Matrix* matrix); /** * @brief Reset matrix to the idenmtity matrix, any prior matrix state is overwritten. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasResetMatrix(OH_Drawing_Canvas*); +void OH_Drawing_CanvasResetMatrix(OH_Drawing_Canvas* canvas); /** * @brief Draws the specified source rectangle of the image onto the canvas, * scaled and translated to the destination rectangle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param image Indicates the pointer to an OH_Drawing_Image object. * @param src The area of source image. * @param dst The area of destination canvas. - * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. - * @param OH_Drawing_SrcRectConstraint Constraint type. + * @param samplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param srcRectConstraint Constraint type. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawImageRectWithSrc(OH_Drawing_Canvas*, const OH_Drawing_Image*, - const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*, - OH_Drawing_SrcRectConstraint); +void OH_Drawing_CanvasDrawImageRectWithSrc(OH_Drawing_Canvas* canvas, const OH_Drawing_Image* image, + const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions* samplingOptions, + OH_Drawing_SrcRectConstraint srcRectConstraint); /** * @brief Draws the specified source rectangle of the image onto the canvas, * scaled and translated to the destination rectangle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. - * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param image Indicates the pointer to an OH_Drawing_Image object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param samplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*, - OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*); +void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas* canvas, OH_Drawing_Image* image, + OH_Drawing_Rect* rect, OH_Drawing_SamplingOptions* samplingOptions); /** * @brief Enumerates of vertices flags. @@ -754,7 +813,7 @@ typedef enum { * @brief Draw a triangular mesh with vertex descriptions. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. * @param vertexMmode Draw a set of vertices. * @param vertexCount Vertex count. * @param positions Positions data pointer. @@ -762,10 +821,11 @@ typedef enum { * @param colors Color data pointer. * @param indexCount Index count. * @param indices Index data pointer. + * @param mode Blend mode used for drawing. * @since 12 * @version 1.0 */ -void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas*, OH_Drawing_VertexMode vertexMmode, +void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas* canvas, OH_Drawing_VertexMode vertexMmode, int32_t vertexCount, const OH_Drawing_Point2D* positions, const OH_Drawing_Point2D* texs, const uint32_t* colors, int32_t indexCount, const uint16_t* indices, OH_Drawing_BlendMode mode); @@ -773,8 +833,8 @@ void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas*, OH_Drawing_VertexMode ver * @brief Read pixels data from canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Image_Info width, height, colorType, and alphaType of dstPixels. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param imageInfo width, height, colorType, and alphaType of dstPixels. * @param dstPixels destination pixel storage. * @param dstRowBytes size of one row of pixels. * @param srcX offset into canvas writable pixels on x-axis. @@ -783,22 +843,23 @@ void OH_Drawing_CanvasDrawVertices(OH_Drawing_Canvas*, OH_Drawing_VertexMode ver * @since 12 * @version 1.0 */ -bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*, +bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas* canvas, OH_Drawing_Image_Info* imageInfo, void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY); /** * @brief Read pixels data to a bitmap from canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @param srcX offset into canvas writable pixels on x-axis. * @param srcY offset into canvas writable pixels on y-axis. * @return true if pixels are copied to dstBitmap. * @since 12 * @version 1.0 */ -bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY); +bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas* canvas, + OH_Drawing_Bitmap* bitmap, int32_t srcX, int32_t srcY); /** * @brief Checks whether the drawable area is empty. @@ -841,6 +902,40 @@ OH_Drawing_ErrorCode OH_Drawing_CanvasGetImageInfo(OH_Drawing_Canvas* canvas, OH * @version 1.0 */ OH_Drawing_ErrorCode OH_Drawing_CanvasDrawRecordCmd(OH_Drawing_Canvas* canvas, OH_Drawing_RecordCmd* recordCmd); + +/** + * @brief Checks if the path has been cut off. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates the pointer to an OH_Drawing_Paht object. + * @param quickReject Indicates if the path has been cut off. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or path is nullptr, + * or quickReject is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectPath(OH_Drawing_Canvas* canvas, const OH_Drawing_Path* path, + bool* quickReject); + +/** + * @brief Checks if the rect has been cut off. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param quickReject Indicates if the rect has been cut off. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if canvas or rect is nullptr, + * or quickReject is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_CanvasQuickRejectRect(OH_Drawing_Canvas* canvas, const OH_Drawing_Rect* rect, + bool* quickReject); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_color.h b/graphic/graphic_2d/native_drawing/drawing_color.h index cb1b27e10a2fc63b9d79c572dd78fff7090d4567..0f71c8873ec084dff19621635fa8218b6369598a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_color.h +++ b/graphic/graphic_2d/native_drawing/drawing_color.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_COLOR_H -#define C_INCLUDE_DRAWING_COLOR_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_COLOR_H +#define C_INCLUDE_DRAWING_COLOR_H + #include "drawing_types.h" #ifdef __cplusplus diff --git a/graphic/graphic_2d/native_drawing/drawing_color_filter.h b/graphic/graphic_2d/native_drawing/drawing_color_filter.h index 98907ba17b2341321b8f37766dd57834f66d6a76..051ef91bd0c699c01083266df27b1d2df252f4b0 100644 --- a/graphic/graphic_2d/native_drawing/drawing_color_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_color_filter.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_COLOR_FILTER_H -#define C_INCLUDE_DRAWING_COLOR_FILTER_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_COLOR_FILTER_H +#define C_INCLUDE_DRAWING_COLOR_FILTER_H + #include "drawing_types.h" #ifdef __cplusplus @@ -51,25 +51,25 @@ extern "C" { * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param color Indicates the color, which is a 32-bit (ARGB) variable. - * @param OH_Drawing_BlendMode Indicates the blend mode. + * @param blendMode Indicates the blend mode. * @return Returns the pointer to the OH_Drawing_ColorFilter object created. * @since 11 * @version 1.0 */ -OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode(uint32_t color, OH_Drawing_BlendMode); +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateBlendMode(uint32_t color, OH_Drawing_BlendMode blendMode); /** - * @brief Creates an OH_Drawing_ColorFilter applies the colorFilter1 and then applies colorFilter2. + * @brief Creates an OH_Drawing_ColorFilter applies the outerColorFilter and then applies innerColorFilter. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. - * @param OH_Drawing_ColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. + * @param outerColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. + * @param innerColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. * @return Returns the pointer to the OH_Drawing_ColorFilter object created. * @since 11 * @version 1.0 */ -OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose(OH_Drawing_ColorFilter* colorFilter1, - OH_Drawing_ColorFilter* colorFilter2); +OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateCompose(OH_Drawing_ColorFilter* outerColorFilter, + OH_Drawing_ColorFilter* innerColorFilter); /** * @brief Creates an OH_Drawing_ColorFilter with a 5x4 color matrix. @@ -117,11 +117,11 @@ OH_Drawing_ColorFilter* OH_Drawing_ColorFilterCreateLuma(void); * @brief Destroys an OH_Drawing_ColorFilter object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. + * @param colorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. * @since 11 * @version 1.0 */ -void OH_Drawing_ColorFilterDestroy(OH_Drawing_ColorFilter*); +void OH_Drawing_ColorFilterDestroy(OH_Drawing_ColorFilter* colorFilter); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_color_space.h b/graphic/graphic_2d/native_drawing/drawing_color_space.h index c87705cbbbb7a3d12cc36f87b94e3ad5645bb87d..f2a2bc7a6203f70fe913dcfc7117a9acbba25e6c 100755 --- a/graphic/graphic_2d/native_drawing/drawing_color_space.h +++ b/graphic/graphic_2d/native_drawing/drawing_color_space.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_COLOR_SPACE_H -#define C_INCLUDE_DRAWING_COLOR_SPACE_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_COLOR_SPACE_H +#define C_INCLUDE_DRAWING_COLOR_SPACE_H + #include "drawing_types.h" #ifdef __cplusplus @@ -70,11 +70,11 @@ OH_Drawing_ColorSpace* OH_Drawing_ColorSpaceCreateSrgbLinear(void); * @brief Destroy an OH_Drawing_ColorSpace object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ColorSpace Indicates the pointer to an OH_Drawing_ColorSpace object. + * @param colorSpace Indicates the pointer to an OH_Drawing_ColorSpace object. * @since 12 * @version 1.0 */ -void OH_Drawing_ColorSpaceDestroy(OH_Drawing_ColorSpace*); +void OH_Drawing_ColorSpaceDestroy(OH_Drawing_ColorSpace* colorSpace); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_error_code.h b/graphic/graphic_2d/native_drawing/drawing_error_code.h index 817c8c61467d0798907427364e08d674741e1637..5bdc19682c4052b80b3c52d070ef15f78c099ae1 100644 --- a/graphic/graphic_2d/native_drawing/drawing_error_code.h +++ b/graphic/graphic_2d/native_drawing/drawing_error_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_ERROR_CODE_H -#define C_INCLUDE_DRAWING_ERROR_CODE_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_ERROR_CODE_H +#define C_INCLUDE_DRAWING_ERROR_CODE_H + #ifdef __cplusplus extern "C" { #endif @@ -82,6 +82,14 @@ typedef enum { */ OH_Drawing_ErrorCode OH_Drawing_ErrorCodeGet(); +/** + * @brief Resets the error code of the drawing module to OH_DRAWING_SUCCESS. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 18 + * @version 1.0 + */ +void OH_Drawing_ErrorCodeReset(); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_filter.h b/graphic/graphic_2d/native_drawing/drawing_filter.h index a20fe15794b5d71607fc5284c64e4a1b7667519b..6f0ad102e12f803c4d5cd6e96152d6036c15ad7d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_filter.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_FILTER_H -#define C_INCLUDE_DRAWING_FILTER_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_FILTER_H +#define C_INCLUDE_DRAWING_FILTER_H + #include "drawing_types.h" #ifdef __cplusplus @@ -60,55 +60,55 @@ OH_Drawing_Filter* OH_Drawing_FilterCreate(void); * @brief Sets an OH_Drawing_ImageFilter object for an OH_Drawing_Filter object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. - * @param OH_Drawing_ImageFilter Indicates the pointer to an OH_Drawing_ImageFilter object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. + * @param imageFilter Indicates the pointer to an OH_Drawing_ImageFilter object. * @since 12 * @version 1.0 */ -void OH_Drawing_FilterSetImageFilter(OH_Drawing_Filter*, OH_Drawing_ImageFilter*); +void OH_Drawing_FilterSetImageFilter(OH_Drawing_Filter* filter, OH_Drawing_ImageFilter* imageFilter); /** * @brief Sets an OH_Drawing_MaskFilter object for an OH_Drawing_Filter object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. - * @param OH_Drawing_MaskFilter Indicates the pointer to an OH_Drawing_MaskFilter object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. + * @param maskFilter Indicates the pointer to an OH_Drawing_MaskFilter object. * @since 11 * @version 1.0 */ -void OH_Drawing_FilterSetMaskFilter(OH_Drawing_Filter*, OH_Drawing_MaskFilter*); +void OH_Drawing_FilterSetMaskFilter(OH_Drawing_Filter* filter, OH_Drawing_MaskFilter* maskFilter); /** * @brief Sets an OH_Drawing_ColorFilter object for an OH_Drawing_Filter object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. - * @param OH_Drawing_ColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. + * @param colorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. * @since 11 * @version 1.0 */ -void OH_Drawing_FilterSetColorFilter(OH_Drawing_Filter*, OH_Drawing_ColorFilter*); +void OH_Drawing_FilterSetColorFilter(OH_Drawing_Filter* filter, OH_Drawing_ColorFilter* colorFilter); /** * @brief Gets an OH_Drawing_ColorFilter object from an OH_Drawing_Filter object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. - * @param OH_Drawing_ColorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. + * @param colorFilter Indicates the pointer to an OH_Drawing_ColorFilter object. * @since 12 * @version 1.0 */ -void OH_Drawing_FilterGetColorFilter(OH_Drawing_Filter*, OH_Drawing_ColorFilter*); +void OH_Drawing_FilterGetColorFilter(OH_Drawing_Filter* filter, OH_Drawing_ColorFilter* colorFilter); /** * @brief Destroys an OH_Drawing_Filter object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. * @since 11 * @version 1.0 */ -void OH_Drawing_FilterDestroy(OH_Drawing_Filter*); +void OH_Drawing_FilterDestroy(OH_Drawing_Filter* filter); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 38ea644f359e53892c949eb6f499df748d079975..e8582939c07e7975b18b1b9d6b3b1a490574a927 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_FONT_H -#define C_INCLUDE_DRAWING_FONT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_FONT_H +#define C_INCLUDE_DRAWING_FONT_H + #include "drawing_error_code.h" #include "drawing_types.h" @@ -93,131 +93,131 @@ typedef enum { * @brief Sets whether the font baselines and pixels alignment when the transformation matrix is ​​axis aligned. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param baselineSnap Indicates whether the font baselines and pixels alignment. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetBaselineSnap(OH_Drawing_Font*, bool baselineSnap); +void OH_Drawing_FontSetBaselineSnap(OH_Drawing_Font* font, bool baselineSnap); /** * @brief Gets whether the font baselines and pixels alignment when the transformation matrix is ​​axis aligned. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true if the font baselines and pixels alignment; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsBaselineSnap(const OH_Drawing_Font*); +bool OH_Drawing_FontIsBaselineSnap(const OH_Drawing_Font* font); /** * @brief Sets whether the font uses sub-pixel rendering. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param isSubpixel Indicates whether the font uses sub-pixel rendering. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetSubpixel(OH_Drawing_Font*, bool isSubpixel); +void OH_Drawing_FontSetSubpixel(OH_Drawing_Font* font, bool isSubpixel); /** * @brief Gets whether the font uses sub-pixel rendering. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true if the font uses sub-pixel rendering; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsSubpixel(const OH_Drawing_Font*); +bool OH_Drawing_FontIsSubpixel(const OH_Drawing_Font* font); /** * @brief Sets whether the font outline is automatically adjusted. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param isForceAutoHinting Indicates whether the font outline is automatically adjusted. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetForceAutoHinting(OH_Drawing_Font*, bool isForceAutoHinting); +void OH_Drawing_FontSetForceAutoHinting(OH_Drawing_Font* font, bool isForceAutoHinting); /** * @brief Gets whether the font outline is automatically adjusted. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true if the font outline is automatically adjusted; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsForceAutoHinting(const OH_Drawing_Font*); +bool OH_Drawing_FontIsForceAutoHinting(const OH_Drawing_Font* font); /** * @brief Sets an OH_Drawing_Typeface object for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_Typeface Indicates the pointer to an OH_Drawing_Typeface object. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param typeface Indicates the pointer to an OH_Drawing_Typeface object. * @since 11 * @version 1.0 */ -void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); +void OH_Drawing_FontSetTypeface(OH_Drawing_Font* font, OH_Drawing_Typeface* typeface); /** * @brief Gets an OH_Drawing_Typeface object from the OH_Drawing_Typeface object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return OH_Drawing_Typeface Indicates the pointer to an OH_Drawing_Typeface object. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*); +OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font* font); /** * @brief Sets text size for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param textSize Indicates the text size. * @since 11 * @version 1.0 */ -void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); +void OH_Drawing_FontSetTextSize(OH_Drawing_Font* font, float textSize); /** * @brief Gets text size for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns the size of text. * @since 12 * @version 1.0 */ -float OH_Drawing_FontGetTextSize(const OH_Drawing_Font*); +float OH_Drawing_FontGetTextSize(const OH_Drawing_Font* font); /** * @brief Calculate number of glyphs represented by text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param text Indicates the character storage encoded with text encoding. * @param byteLength Indicates the text length in bytes. * @param encoding Indicates the text encoding. * @since 12 * @version 1.0 */ -int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLength, +int OH_Drawing_FontCountText(OH_Drawing_Font* font, const void* text, size_t byteLength, OH_Drawing_TextEncoding encoding); /** * @brief Converts text into glyph indices. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param text Indicates the character storage encoded with text encoding. * @param byteLength Indicates the text length in bytes. * @param encoding Indicates the text encoding. @@ -227,21 +227,21 @@ int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLeng * @since 12 * @version 1.0 */ -uint32_t OH_Drawing_FontTextToGlyphs(const OH_Drawing_Font*, const void* text, uint32_t byteLength, +uint32_t OH_Drawing_FontTextToGlyphs(const OH_Drawing_Font* font, const void* text, uint32_t byteLength, OH_Drawing_TextEncoding encoding, uint16_t* glyphs, int maxGlyphCount); /** * @brief Retrieves the advance for each glyph in glyphs. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param glyphs Indicates the array of glyph indices to be measured. * @param count Indicates the number of glyphs. * @param widths Indicates the text advances for each glyph returned to the caller. * @since 12 * @version 1.0 */ -void OH_Drawing_FontGetWidths(const OH_Drawing_Font*, const uint16_t* glyphs, int count, float* widths); +void OH_Drawing_FontGetWidths(const OH_Drawing_Font* font, const uint16_t* glyphs, int count, float* widths); /** * @brief Measures the width of a single character. @@ -284,165 +284,165 @@ OH_Drawing_ErrorCode OH_Drawing_FontMeasureText(const OH_Drawing_Font* font, con * @brief Enables or disables linearly scalable font for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param isLinearText Indicates whether to enable linearly scalable font. * @since 11 * @version 1.0 */ -void OH_Drawing_FontSetLinearText(OH_Drawing_Font*, bool isLinearText); +void OH_Drawing_FontSetLinearText(OH_Drawing_Font* font, bool isLinearText); /** * @brief Gets whether the font is linearly scalable. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true if the font is linearly scalable; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsLinearText(const OH_Drawing_Font*); +bool OH_Drawing_FontIsLinearText(const OH_Drawing_Font* font); /** * @brief Sets text skew on x-axis for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param skewX Indicates the additional shear on x-axis relative to y-axis. * @since 11 * @version 1.0 */ -void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font*, float skewX); +void OH_Drawing_FontSetTextSkewX(OH_Drawing_Font* font, float skewX); /** * @brief Gets text skew on x-axis for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns additional skew on x-axis relative to y-axis. * @since 12 * @version 1.0 */ -float OH_Drawing_FontGetTextSkewX(const OH_Drawing_Font*); +float OH_Drawing_FontGetTextSkewX(const OH_Drawing_Font* font); /** * @brief Enables or disables to increase stroke width to approximate bold fonts for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param isFakeBoldText Indicates whether to enable to increase stroke width. * @since 11 * @version 1.0 */ -void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); +void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font* font, bool isFakeBoldText); /** * @brief Gets whether to increase the stroke width to approximate bold fonts. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true to increase the stroke width to approximate bold fonts; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsFakeBoldText(const OH_Drawing_Font*); +bool OH_Drawing_FontIsFakeBoldText(const OH_Drawing_Font* font); /** * @brief Sets text scale on x-axis for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param scaleX Indicates the text horizontal scale. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetScaleX(OH_Drawing_Font*, float scaleX); +void OH_Drawing_FontSetScaleX(OH_Drawing_Font* font, float scaleX); /** * @brief Gets text scale on x-axis from an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns text horizontal scale on x-axis. * @since 12 * @version 1.0 */ -float OH_Drawing_FontGetScaleX(const OH_Drawing_Font*); +float OH_Drawing_FontGetScaleX(const OH_Drawing_Font* font); /** * @brief Sets hinting pattern for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_FontHinting Indicates the font hinting pattern. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param fontHinting Indicates the font hinting pattern. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetHinting(OH_Drawing_Font*, OH_Drawing_FontHinting); +void OH_Drawing_FontSetHinting(OH_Drawing_Font* font, OH_Drawing_FontHinting fontHinting); /** * @brief Gets hinting pattern from an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns the font hinting pattern. * @since 12 * @version 1.0 */ -OH_Drawing_FontHinting OH_Drawing_FontGetHinting(const OH_Drawing_Font*); +OH_Drawing_FontHinting OH_Drawing_FontGetHinting(const OH_Drawing_Font* font); /** * @brief Sets whether to use bitmaps instead of outlines in the OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param isEmbeddedBitmaps Indicates whether to use bitmaps instead of outlines. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetEmbeddedBitmaps(OH_Drawing_Font*, bool isEmbeddedBitmaps); +void OH_Drawing_FontSetEmbeddedBitmaps(OH_Drawing_Font* font, bool isEmbeddedBitmaps); /** * @brief Gets whether to use bitmaps instead of outlines in the OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns true if using bitmaps instead of outlines; returns false otherwise. * @since 12 * @version 1.0 */ -bool OH_Drawing_FontIsEmbeddedBitmaps(const OH_Drawing_Font*); +bool OH_Drawing_FontIsEmbeddedBitmaps(const OH_Drawing_Font* font); /** * @brief Sets the font edging effect for an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_FontEdging Indicates the font edging effect. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param fontEdging Indicates the font edging effect. * @since 12 * @version 1.0 */ -void OH_Drawing_FontSetEdging(OH_Drawing_Font*, OH_Drawing_FontEdging); +void OH_Drawing_FontSetEdging(OH_Drawing_Font* font, OH_Drawing_FontEdging fontEdging); /** * @brief Gets the font edging effect from an OH_Drawing_Font object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @return Returns the font edging effect. * @since 12 * @version 1.0 */ -OH_Drawing_FontEdging OH_Drawing_FontGetEdging(const OH_Drawing_Font*); +OH_Drawing_FontEdging OH_Drawing_FontGetEdging(const OH_Drawing_Font* font); /** * @brief Destroys an OH_Drawing_Font object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @since 11 * @version 1.0 */ -void OH_Drawing_FontDestroy(OH_Drawing_Font*); +void OH_Drawing_FontDestroy(OH_Drawing_Font* font); /** * @brief Defines a run, supplies storage for the metrics of an OH_Drawing_Font. @@ -489,13 +489,94 @@ typedef struct OH_Drawing_Font_Metrics { * @brief Obtains the metrics of a font. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_Font_Metrics Indicates the pointer to an OH_Drawing_Font_Metrics object. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param fontMetrics Indicates the pointer to an OH_Drawing_Font_Metrics object. * @return Returns a float variable that recommended spacing between lines. * @since 12 * @version 1.0 */ -float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*); +float OH_Drawing_FontGetMetrics(OH_Drawing_Font* font, OH_Drawing_Font_Metrics* fontMetrics); + +/** + * @brief Retrieves the bound rect for each glyph in glyph array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param glyphs Indicates the array of glyph indices to be measured. + * @param count Indicates the number of glyphs. + * @param bounds The bound rect array for each glyph, returned to the caller. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, glyphs + * and bounds is nullptr or count is 0. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_FontGetBounds(const OH_Drawing_Font* font, const uint16_t* glyphs, uint32_t count, + OH_Drawing_Array* bounds); + +/** + * @brief Retrieves the path for specified Glyph. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param glyph glyph index to be obtained. + * @param path The path object, returned to the caller. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, path + * is nullptr or glyph not exist. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_FontGetPathForGlyph(const OH_Drawing_Font* font, uint16_t glyph, + OH_Drawing_Path* path); + +/** + * @brief Get the text outline path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param text Indicates the character storage encoded with text encoding. + * @param byteLength Indicates to get the byte length of the corresponding text path. If this byte length is greater + * than the byte length of the text string, undefined behavior will occur. + * @param encoding OH_Drawing_TextEncoding Indicates the text encoding. + * @param x Indicates x coordinates of the text. + * @param y Indicates y coordinates of the text. + * @param path OH_Drawing_Path The path object, returned to the caller. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, text or path is nullptr. + * @since 18 + */ +OH_Drawing_ErrorCode OH_Drawing_FontGetTextPath(const OH_Drawing_Font* font, const void* text, size_t byteLength, + OH_Drawing_TextEncoding encoding, float x, float y, OH_Drawing_Path* path); + +/** + * @brief Sets whether to follow the theme font. If the value is true, the theme font is used when typeface is not set. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param followed Indicates whether to follow the theme font. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if font is nullptr. + * @since 15 + */ +OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed(OH_Drawing_Font* font, bool followed); + +/** + * @brief Gets whether to follow the theme font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param followed Indicates whether to follow the theme font. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if font or followed is nullptr. + * @since 15 + */ +OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed(const OH_Drawing_Font* font, bool* followed); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_font_collection.h b/graphic/graphic_2d/native_drawing/drawing_font_collection.h index 5f7277d721ee5942f8b5039bb4e4e7e68b5d8052..e6ac9f49424f699c6c830f9788619ca8093dec78 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font_collection.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_collection.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_FONT_COLLECTION_H -#define C_INCLUDE_DRAWING_FONT_COLLECTION_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_FONT_COLLECTION_H +#define C_INCLUDE_DRAWING_FONT_COLLECTION_H + #include "drawing_text_declaration.h" #ifdef __cplusplus @@ -59,31 +59,31 @@ OH_Drawing_FontCollection* OH_Drawing_CreateFontCollection(void); * @brief Releases the memory occupied by an OH_Drawing_FontCollection object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. * @since 8 * @version 1.0 */ -void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection*); +void OH_Drawing_DestroyFontCollection(OH_Drawing_FontCollection* fontCollection); /** * @brief Disable the font collection fallback. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. * @since 12 * @version 1.0 */ -void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection*); +void OH_Drawing_DisableFontCollectionFallback(OH_Drawing_FontCollection* fontCollection); /** * @brief Disable the font collection systemfont. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. * @since 12 * @version 1.0 */ -void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection*); +void OH_Drawing_DisableFontCollectionSystemFont(OH_Drawing_FontCollection* fontCollection); /** * @brief Creates an OH_Drawing_FontCollection object with shared usage between @@ -100,11 +100,21 @@ OH_Drawing_FontCollection* OH_Drawing_CreateSharedFontCollection(void); * @brief Clear font caches. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. * @since 12 * @version 1.0 */ -void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection*); +void OH_Drawing_ClearFontCaches(OH_Drawing_FontCollection* fontCollection); + +/** + * @brief Get the OH_Drawing_FontCollection global instance. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Return the pointer to the OH_Drawing_FontCollection global instance. + * @since 14 + * @version 1.0 + */ +OH_Drawing_FontCollection* OH_Drawing_GetFontCollectionGlobalInstance(void); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 15b931f80bbde80557e1866ffe3a1978b9ea9b04..04d880558fe972bc3d8806e204175682836bbdc5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_FONT_MGR_H -#define C_INCLUDE_DRAWING_FONT_MGR_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_FONT_MGR_H +#define C_INCLUDE_DRAWING_FONT_MGR_H + #include "drawing_types.h" #include "drawing_text_typography.h" #include @@ -62,34 +62,34 @@ OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate(void); * @brief Releases the memory occupied by an OH_Drawing_FontMgr object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @since 12 * @version 1.0 */ -void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*); +void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr* drawingFontMgr); /** * @brief Gets the count of font families. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @return Returns the count of font families. * @since 12 * @version 1.0 */ -int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr*); +int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr* drawingFontMgr); /** * @brief Gets the font family name by the index. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param index Indicates the index to get the font family name. * @return Returns the font family name corresponding to the index value. * @since 12 * @version 1.0 */ -char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index); +char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr* drawingFontMgr, int index); /** * @brief Releases the memory occupied by font family name. @@ -105,57 +105,57 @@ void OH_Drawing_FontMgrDestroyFamilyName(char* familyName); * @brief Creates an OH_Drawing_FontStyleSet object by OH_Drawing_FontMgr object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param index Indicates the index used to get the font style set object from the font manager object. * @return Returns the pointer to the OH_Drawing_FontStyleSet object created. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr*, int index); +OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr* drawingFontMgr, int index); /** * @brief Releases the memory occupied by an OH_Drawing_FontStyleSet object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param drawingFontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. * @since 12 * @version 1.0 */ -void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet*); +void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet* drawingFontStyleSet); /** * @brief Get the pointer to an OH_Drawing_FontStyleSet object for the given font style set family name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. * @return Returns the pointer to the OH_Drawing_FontStyleSet object matched. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char* familyName); +OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr* drawingFontMgr, const char* familyName); /** * @brief Get the pointer to an OH_Drawing_Typeface object based on the given font style and family name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @param fontStyle Indicates an OH_Drawing_FontStyleStruct object. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr* drawingFontMgr, const char* familyName, OH_Drawing_FontStyleStruct fontStyle); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param drawingFontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @param fontStyle Indicates an OH_Drawing_FontStyleStruct object. * @param bcp47 Indicates an array of languages which indicate the language of character. * @param bcp47Count Indicates the array size of bcp47. * @param character Indicates a UTF8 value to be matched. @@ -163,33 +163,34 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, - OH_Drawing_FontStyleStruct fontStyle, const char* bcp47[], int bcp47Count, int32_t character); +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr* drawingFontMgr, + const char* familyName, OH_Drawing_FontStyleStruct fontStyle, + const char* bcp47[], int bcp47Count, int32_t character); /** * @brief Create a typeface for the given index. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param fontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. * @param index Indicates the index of the typeface in this fontStyleSet. * @return If successful, return a pointer to OH_Drawing_Typeface object; if failed, return nullptr. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet*, int index); +OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet* fontStyleSet, int index); /** * @brief Get font style for the specified typeface. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param fontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. * @param index Indicates the index of the typeface in this fontStyleSet. * @param styleName Indicates the style name returned. * @return Return the OH_Drawing_FontStyleStruct structure. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet*, int32_t index, +OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet* fontStyleSet, int32_t index, char** styleName); /** @@ -206,25 +207,25 @@ void OH_Drawing_FontStyleSetFreeStyleName(char** styleName); * @brief Get the closest matching typeface. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param fontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. * @param fontStyleStruct Indicates the OH_Drawing_FontStyleStruct structure. * @return A pointer to matched OH_Drawing_Typeface. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet*, +OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet* fontStyleSet, OH_Drawing_FontStyleStruct fontStyleStruct); /** * @brief Get the count of typeface. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param fontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. * @return The count of typeface in this font style set. * @since 12 * @version 1.0 */ -int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet*); +int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet* fontStyleSet); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_gpu_context.h b/graphic/graphic_2d/native_drawing/drawing_gpu_context.h index 9558108d2ede9c10af7014525e704546aeba473e..1949a5e725f78c553096ebece81194d738b81f27 100644 --- a/graphic/graphic_2d/native_drawing/drawing_gpu_context.h +++ b/graphic/graphic_2d/native_drawing/drawing_gpu_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_GPU_CONTEXT_H -#define C_INCLUDE_DRAWING_GPU_CONTEXT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_GPU_CONTEXT_H +#define C_INCLUDE_DRAWING_GPU_CONTEXT_H + #include "drawing_types.h" #ifdef __cplusplus @@ -61,22 +61,32 @@ typedef struct { * @brief Creates an OH_Drawing_GpuContext object, whose GPU backend context is GL. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_GpuContextOptions Indicates the GPU context options. + * @param gpuContextOptions Indicates the GPU context options. * @return Returns the pointer to the OH_Drawing_GpuContext object created. * @since 12 * @version 1.0 */ -OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL(OH_Drawing_GpuContextOptions); +OH_Drawing_GpuContext* OH_Drawing_GpuContextCreateFromGL(OH_Drawing_GpuContextOptions gpuContextOptions); + +/** + * @brief Creates an OH_Drawing_GpuContext object, whose GPU backend context depends on device. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_GpuContext object created. + * @since 16 + * @version 1.0 + */ +OH_Drawing_GpuContext* OH_Drawing_GpuContextCreate(void); /** * @brief Destroys an OH_Drawing_GpuContext object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_GpuContext Indicates the pointer to an OH_Drawing_GpuContext object. + * @param gpuContext Indicates the pointer to an OH_Drawing_GpuContext object. * @since 12 * @version 1.0 */ -void OH_Drawing_GpuContextDestroy(OH_Drawing_GpuContext*); +void OH_Drawing_GpuContextDestroy(OH_Drawing_GpuContext* gpuContext); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_image.h b/graphic/graphic_2d/native_drawing/drawing_image.h index 07c96aecddf04e575546b66ef1557b7247cbd240..ed2d09789dd38317b51411176bb33175a7184c4a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image.h +++ b/graphic/graphic_2d/native_drawing/drawing_image.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_IMAGE_H -#define C_INCLUDE_DRAWING_IMAGE_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_IMAGE_H +#define C_INCLUDE_DRAWING_IMAGE_H + #include "drawing_types.h" #ifdef __cplusplus @@ -60,56 +60,56 @@ OH_Drawing_Image* OH_Drawing_ImageCreate(void); * @brief Destroys an OH_Drawing_Image object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param image Indicates the pointer to an OH_Drawing_Image object. * @since 12 * @version 1.0 */ -void OH_Drawing_ImageDestroy(OH_Drawing_Image*); +void OH_Drawing_ImageDestroy(OH_Drawing_Image* image); /** * @brief Rebuilds an OH_Drawing_Image object, sharing or copying bitmap pixels. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. - * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param image Indicates the pointer to an OH_Drawing_Image object. + * @param bitmap Indicates the pointer to an OH_Drawing_Bitmap object. * @return Returns true if successed. * @since 12 * @version 1.0 */ -bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image*, OH_Drawing_Bitmap*); +bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image* image, OH_Drawing_Bitmap* bitmap); /** * @brief Gets pixel count in each row of image. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param image Indicates the pointer to an OH_Drawing_Image object. * @return Returns the width. * @since 12 * @version 1.0 */ -int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image*); +int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image* image); /** * @brief Gets pixel row count of image. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param image Indicates the pointer to an OH_Drawing_Image object. * @return Returns the height. * @since 12 * @version 1.0 */ -int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*); +int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image* image); /** * @brief Gets the image info. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. - * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @param image Indicates the pointer to an OH_Drawing_Image object. + * @param imageInfo Indicates the pointer to an OH_Drawing_Image_Info object. * @since 12 * @version 1.0 */ -void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*); +void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image* image, OH_Drawing_Image_Info* imageInfo); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_image_filter.h b/graphic/graphic_2d/native_drawing/drawing_image_filter.h index d77292aa373122d42569a029b9ca7dc448cefae1..3fde3b7248d2225700aa8043aee6bfd5497c4028 100644 --- a/graphic/graphic_2d/native_drawing/drawing_image_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_image_filter.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_IMAGE_FILTER_H -#define C_INCLUDE_DRAWING_IMAGE_FILTER_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_IMAGE_FILTER_H +#define C_INCLUDE_DRAWING_IMAGE_FILTER_H + #include "drawing_shader_effect.h" #ifdef __cplusplus @@ -52,23 +52,23 @@ extern "C" { * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param sigmaX Indicates the Gaussian sigma value for blurring along the x axis. * @param sigmaY Indicates the Gaussian sigma value for blurring along the y axis. - * @param OH_Drawing_TileMode Indicates the tile mode applied at edges. - * @param OH_Drawing_ImageFilter Indicates the input filter that is blurred, uses source bitmap if this is null. + * @param tileMode Indicates the tile mode applied at edges. + * @param imageFilter Indicates the input filter that is blurred, uses source bitmap if this is null. * @return Returns the pointer to the OH_Drawing_ImageFilter object created. * If nullptr is returned, the creation fails. * The possible cause of the failure is that the available memory is empty. * @since 12 * @version 1.0 */ -OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode, - OH_Drawing_ImageFilter*); +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sigmaY, OH_Drawing_TileMode tileMode, + OH_Drawing_ImageFilter* imageFilter); /** * @brief Creates an OH_Drawing_ImageFilter object that applies the color filter to the input. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ColorFilter Indicates the color filter that transforms the input image. - * @param OH_Drawing_ImageFilter Indicates the input filter, or uses the source bitmap if this is null. + * @param colorFilter Indicates the color filter that transforms the input image. + * @param imageFilter Indicates the input filter, or uses the source bitmap if this is null. * @return Returns the pointer to the OH_Drawing_ImageFilter object created. * If nullptr is returned, the creation fails. * The possible cause of the failure is that the available memory is empty or @@ -76,17 +76,18 @@ OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateBlur(float sigmaX, float sig * @since 12 * @version 1.0 */ -OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter*, OH_Drawing_ImageFilter*); +OH_Drawing_ImageFilter* OH_Drawing_ImageFilterCreateFromColorFilter(OH_Drawing_ColorFilter* colorFilter, + OH_Drawing_ImageFilter* imageFilter); /** * @brief Destroys an OH_Drawing_ImageFilter object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ImageFilter Indicates the pointer to an OH_Drawing_ImageFilter object. + * @param imageFilter Indicates the pointer to an OH_Drawing_ImageFilter object. * @since 12 * @version 1.0 */ -void OH_Drawing_ImageFilterDestroy(OH_Drawing_ImageFilter*); +void OH_Drawing_ImageFilterDestroy(OH_Drawing_ImageFilter* imageFilter); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_mask_filter.h b/graphic/graphic_2d/native_drawing/drawing_mask_filter.h index 86f487bfe98e88fd4dcc2a167e0132e4a8e46c35..c265e1c9098f053442ad8c364be8eaa642c58b59 100644 --- a/graphic/graphic_2d/native_drawing/drawing_mask_filter.h +++ b/graphic/graphic_2d/native_drawing/drawing_mask_filter.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_MASK_FILTER_H -#define C_INCLUDE_DRAWING_MASK_FILTER_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_MASK_FILTER_H +#define C_INCLUDE_DRAWING_MASK_FILTER_H + #include "drawing_types.h" #ifdef __cplusplus @@ -88,11 +88,11 @@ OH_Drawing_MaskFilter* OH_Drawing_MaskFilterCreateBlur(OH_Drawing_BlurType blurT * @brief Destroys an OH_Drawing_MaskFilter object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_MaskFilter Indicates the pointer to an OH_Drawing_MaskFilter object. + * @param maskFilter Indicates the pointer to an OH_Drawing_MaskFilter object. * @since 11 * @version 1.0 */ -void OH_Drawing_MaskFilterDestroy(OH_Drawing_MaskFilter*); +void OH_Drawing_MaskFilterDestroy(OH_Drawing_MaskFilter* maskFilter); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_matrix.h b/graphic/graphic_2d/native_drawing/drawing_matrix.h index f56827d8592682dfe8fd9e8517247c74de64fa18..bbf6645dfaf5910f121f92fbe67eac5150aa0eb0 100644 --- a/graphic/graphic_2d/native_drawing/drawing_matrix.h +++ b/graphic/graphic_2d/native_drawing/drawing_matrix.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_MATRIX_H -#define C_INCLUDE_DRAWING_MATRIX_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_MATRIX_H +#define C_INCLUDE_DRAWING_MATRIX_H + #include "drawing_error_code.h" #include "drawing_types.h" @@ -62,7 +62,6 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); * rotate by degrees about a pivot point at (px, py). * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param deg angle of axes relative to upright axes * @param x pivot on x-axis. * @param y pivot on y-axis. @@ -76,7 +75,6 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y); * by sx and sy, about a pivot point at (px, py). * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param sx horizontal scale factor. * @param sy vertical scale factor. * @param px pivot on x-axis. @@ -91,7 +89,6 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, fl * @brief Creates an OH_Drawing_Matrix object with translation. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param dx horizontal translation. * @param dy vertical translation. * @return Returns the pointer to the OH_Drawing_Matrix object created. @@ -104,7 +101,7 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy); * @brief Sets the params for a matrix. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param scaleX horizontal scale factor to store * @param skewX horizontal skew factor to store * @param transX horizontal translation to store @@ -117,7 +114,7 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy); * @since 11 * @version 1.0 */ -void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, +void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix* matrix, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); /** @@ -149,7 +146,7 @@ typedef enum { * @brief Sets matrix to scale and translate src rect to dst rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param src Indicates the pointer to an OH_Drawing_Rect object rect to map from. * @param dst Indicates the pointer to an OH_Drawing_Rect object rect to map to. * @param stf Scales to fit enum method. @@ -161,7 +158,7 @@ typedef enum { * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixSetRectToRect(OH_Drawing_Matrix*, const OH_Drawing_Rect* src, +bool OH_Drawing_MatrixSetRectToRect(OH_Drawing_Matrix* matrix, const OH_Drawing_Rect* src, const OH_Drawing_Rect* dst, OH_Drawing_ScaleToFit stf); /** @@ -187,14 +184,14 @@ bool OH_Drawing_MatrixSetRectToRect(OH_Drawing_Matrix*, const OH_Drawing_Rect* s * | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc G*dx+H*dy+I | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param degree Indicates the angle of axes relative to upright axes. * @param px Indicates the pivot on x-axis. * @param py Indicates the pivot on y-axis. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPreRotate(OH_Drawing_Matrix*, float degree, float px, float py); +void OH_Drawing_MatrixPreRotate(OH_Drawing_Matrix* matrix, float degree, float px, float py); /** * @brief Sets matrix to forward scale by sx and sy, about a pivot point at (px, py). @@ -216,7 +213,7 @@ void OH_Drawing_MatrixPreRotate(OH_Drawing_Matrix*, float degree, float px, floa * | G H I | | 0 0 1 | | G*sx H*sy G*dx+H*dy+I | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param sx Horizontal scale factor. * @param sy Vertical scale factor. * @param px Pivot on x-axis. @@ -224,7 +221,7 @@ void OH_Drawing_MatrixPreRotate(OH_Drawing_Matrix*, float degree, float px, floa * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPreScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); +void OH_Drawing_MatrixPreScale(OH_Drawing_Matrix* matrix, float sx, float sy, float px, float py); /** * @brief Sets forward matrix to translate by dx and dy. @@ -238,13 +235,13 @@ void OH_Drawing_MatrixPreScale(OH_Drawing_Matrix*, float sx, float sy, float px, * | G H I | | 0 0 1 | | G H G*dx+H*dy+I | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param dx Indicates the horizontal translation. * @param dy Indicates the vertical translation. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPreTranslate(OH_Drawing_Matrix*, float dx, float dy); +void OH_Drawing_MatrixPreTranslate(OH_Drawing_Matrix* matrix, float dx, float dy); /** * @brief Sets matrix to matrix constructed from rotating by degrees about pivot point(px, py), @@ -269,14 +266,14 @@ void OH_Drawing_MatrixPreTranslate(OH_Drawing_Matrix*, float dx, float dy); * |0 0 1| |P Q R| | P Q R| * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param degree Indicates the angle of axes relative to upright axes. * @param px Indicates the pivot on x-axis. * @param py Indicates the pivot on y-axis. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPostRotate(OH_Drawing_Matrix*, float degree, float px, float py); +void OH_Drawing_MatrixPostRotate(OH_Drawing_Matrix* matrix, float degree, float px, float py); /** * @brief Sets matrix to backward scale by sx and sy, about a pivot point at (px, py). @@ -293,7 +290,7 @@ void OH_Drawing_MatrixPostRotate(OH_Drawing_Matrix*, float degree, float px, flo * | 0 0 1 | | P Q R | | P Q R | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param sx Horizontal scale factor. * @param sy Vertical scale factor. * @param px Pivot on x-axis. @@ -301,7 +298,7 @@ void OH_Drawing_MatrixPostRotate(OH_Drawing_Matrix*, float degree, float px, flo * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPostScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); +void OH_Drawing_MatrixPostScale(OH_Drawing_Matrix* matrix, float sx, float sy, float px, float py); /** * @brief Sets backward matrix to translate by (dx, dy). @@ -318,13 +315,13 @@ void OH_Drawing_MatrixPostScale(OH_Drawing_Matrix*, float sx, float sy, float px * | 0 0 1 | | P Q R | | P Q R | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param dx Indicates the horizontal translation. * @param dy Indicates the vertical translation. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixPostTranslate(OH_Drawing_Matrix*, float dx, float dy); +void OH_Drawing_MatrixPostTranslate(OH_Drawing_Matrix* matrix, float dx, float dy); /** * @brief Reset matrix to identity, which has no effect on mapped point, sets matrix to: @@ -333,11 +330,11 @@ void OH_Drawing_MatrixPostTranslate(OH_Drawing_Matrix*, float dx, float dy); * | 0 0 1 | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixReset(OH_Drawing_Matrix*); +void OH_Drawing_MatrixReset(OH_Drawing_Matrix* matrix); /** * @brief Sets matrix total to matrix a multiplied by matrix b. @@ -376,45 +373,45 @@ OH_Drawing_ErrorCode OH_Drawing_MatrixGetAll(OH_Drawing_Matrix* matrix, float va /** * @brief Get one matrix value. Index is between the range of 0-8. * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param index one of 0-8. * @return Returns value corresponding to index.Returns 0 if out of range. * @since 12 * @version 1.0 */ -float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); +float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix* matrix, int index); /** * @brief Sets matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged * when mapped with matrix. Positive degrees rotates clockwise. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param degree Indicates the angle of axes relative to upright axes. * @param px Indicates the pivot on x-axis. * @param py Indicates the pivot on y-axis. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py); +void OH_Drawing_MatrixRotate(OH_Drawing_Matrix* matrix, float degree, float px, float py); /** * @brief Sets matrix to translate by (dx, dy) * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param dx Indicates the horizontal translation. * @param dy Indicates the vertical translation. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); +void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix* matrix, float dx, float dy); /** * @brief Sets matrix to scale by sx and sy, about a pivot point at (px, py). * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param sx Indicates the horizontal scale factor. * @param sy Indicates the vertical scale factor. * @param px Indicates the pivot on x-axis. @@ -422,27 +419,27 @@ void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); +void OH_Drawing_MatrixScale(OH_Drawing_Matrix* matrix, float sx, float sy, float px, float py); /** * @brief Sets inverse to reciprocal matrix, returning true if matrix can be inverted. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param inverse Indicates the pointer to an OH_Drawing_Matrix object. * @return Returns true if the matrix is not nullptr and can be inverted; * returns false if the matrix is nullptr or cannot be inverted. * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); +bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix* matrix, OH_Drawing_Matrix* inverse); /** * @brief Sets the params of matrix to map src to dst. * Count must greater than or equal to zero, and less than or equal to four. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param src Points to map from. * @param dst Points to map to. * @param count Number of point in src and dst. @@ -450,47 +447,47 @@ bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixSetPolyToPoly(OH_Drawing_Matrix*, const OH_Drawing_Point2D* src, +bool OH_Drawing_MatrixSetPolyToPoly(OH_Drawing_Matrix* matrix, const OH_Drawing_Point2D* src, const OH_Drawing_Point2D* dst, uint32_t count); /** * @brief Maps the src point array to the dst point array by matrix transformation. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param src Points to map from. * @param dst Points to map to. * @param count Number of point in src and dst. * @since 12 * @version 1.0 */ -void OH_Drawing_MatrixMapPoints(const OH_Drawing_Matrix*, const OH_Drawing_Point2D* src, +void OH_Drawing_MatrixMapPoints(const OH_Drawing_Matrix* matrix, const OH_Drawing_Point2D* src, OH_Drawing_Point2D* dst, int count); /** * @brief Sets dst to bounds of src corners mapped by matrix transformation. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param src Rect to map from. * @param dst Rect to map to. * @return Returns true if the mapped src is equal to the dst; returns false is not equal. * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixMapRect(const OH_Drawing_Matrix*, const OH_Drawing_Rect* src, OH_Drawing_Rect* dst); +bool OH_Drawing_MatrixMapRect(const OH_Drawing_Matrix* matrix, const OH_Drawing_Rect* src, OH_Drawing_Rect* dst); /** * @brief Returns true if the first matrix equals the second matrix. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param other Indicates the pointer to an OH_Drawing_Matrix object. * @return Returns true if the two matrices are equal; returns false if not equal. * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other); +bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix* matrix, OH_Drawing_Matrix* other); /** * @brief Returns true if matrix is identity. @@ -499,22 +496,22 @@ bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other); * | 0 0 1 | * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @return Returns true if matrix is identity; returns false if not identity. * @since 12 * @version 1.0 */ -bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*); +bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix* matrix); /** * @brief Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @since 11 * @version 1.0 */ -void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix*); +void OH_Drawing_MatrixDestroy(OH_Drawing_Matrix* matrix); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_memory_stream.h b/graphic/graphic_2d/native_drawing/drawing_memory_stream.h index 37c57810672fb68966915a89ade7a0b4292bdfb3..c131dc6b2bbde32e99f82d5269e2ea38fd0feefb 100644 --- a/graphic/graphic_2d/native_drawing/drawing_memory_stream.h +++ b/graphic/graphic_2d/native_drawing/drawing_memory_stream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_MEMORY_STREAM_H -#define C_INCLUDE_DRAWING_MEMORY_STREAM_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_MEMORY_STREAM_H +#define C_INCLUDE_DRAWING_MEMORY_STREAM_H + #include "drawing_types.h" #ifdef __cplusplus @@ -63,11 +63,11 @@ OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t * @brief Destroys an OH_Drawing_MemoryStream object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_MemoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. + * @param memoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. * @since 12 * @version 1.0 */ -void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*); +void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream* memoryStream); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h index e10ef145a23c5e7f70f8e652e3319bf3936dc84b..a198ec8551f97e32d57896bbe297bccc946e894c 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path.h +++ b/graphic/graphic_2d/native_drawing/drawing_path.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_PATH_H -#define C_INCLUDE_DRAWING_PATH_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,10 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_PATH_H +#define C_INCLUDE_DRAWING_PATH_H + +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -153,46 +154,46 @@ OH_Drawing_Path* OH_Drawing_PathCreate(void); * @brief Creates an OH_Drawing_Path copy object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Rect object. + * @param path Indicates the pointer to an OH_Drawing_Rect object. * @return Returns the pointer to the OH_Drawing_Path object created. * @since 12 * @version 1.0 */ -OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*); +OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path* path); /** * @brief Destroys an OH_Drawing_Path object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ -void OH_Drawing_PathDestroy(OH_Drawing_Path*); +void OH_Drawing_PathDestroy(OH_Drawing_Path* path); /** * @brief Sets the start point of a path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x Indicates the x coordinate of the start point. * @param y Indicates the y coordinate of the start point. * @since 8 * @version 1.0 */ -void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y); +void OH_Drawing_PathMoveTo(OH_Drawing_Path* path, float x, float y); /** * @brief Draws a line segment from the last point of a path to the target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x Indicates the x coordinate of the target point. * @param y Indicates the y coordinate of the target point. * @since 8 * @version 1.0 */ -void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); +void OH_Drawing_PathLineTo(OH_Drawing_Path* path, float x, float y); /** * @brief Draws an arc to a path. @@ -203,7 +204,7 @@ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); * By default, a line segment from the last point of the path to the start point of the arc is also added. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x1 Indicates the x coordinate of the upper left corner of the rectangle. * @param y1 Indicates the y coordinate of the upper left corner of the rectangle. * @param x2 Indicates the x coordinate of the lower right corner of the rectangle. @@ -213,13 +214,14 @@ void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y); * @since 8 * @version 1.0 */ -void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg); +void OH_Drawing_PathArcTo(OH_Drawing_Path* path, + float x1, float y1, float x2, float y2, float startDeg, float sweepDeg); /** * @brief Draws a quadratic Bezier curve from the last point of a path to the target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX Indicates the x coordinate of the control point. * @param ctrlY Indicates the y coordinate of the control point. * @param endX Indicates the x coordinate of the target point. @@ -227,13 +229,13 @@ void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float * @since 8 * @version 1.0 */ -void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY); +void OH_Drawing_PathQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY); /** * @brief Draws a conic from the last point of a path to the target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX Indicates the x coordinate of the control point. * @param ctrlY Indicates the y coordinate of the control point. * @param endX Indicates the x coordinate of the target point. @@ -242,13 +244,13 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end * @since 12 * @version 1.0 */ -void OH_Drawing_PathConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight); +void OH_Drawing_PathConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight); /** * @brief Draws a cubic Bezier curve from the last point of a path to the target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX1 Indicates the x coordinate of the first control point. * @param ctrlY1 Indicates the y coordinate of the first control point. * @param ctrlX2 Indicates the x coordinate of the second control point. @@ -259,37 +261,37 @@ void OH_Drawing_PathConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float en * @version 1.0 */ void OH_Drawing_PathCubicTo( - OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); + OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); /** * @brief Sets the relative starting point of a path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x Indicates the x coordinate of the relative starting point. * @param y Indicates the y coordinate of the relative starting point. * @since 12 * @version 1.0 */ -void OH_Drawing_PathRMoveTo(OH_Drawing_Path*, float x, float y); +void OH_Drawing_PathRMoveTo(OH_Drawing_Path* path, float x, float y); /** * @brief Draws a line segment from the last point of a path to the relative target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x Indicates the x coordinate of the relative target point. * @param y Indicates the y coordinate of the relative target point. * @since 12 * @version 1.0 */ -void OH_Drawing_PathRLineTo(OH_Drawing_Path*, float x, float y); +void OH_Drawing_PathRLineTo(OH_Drawing_Path* path, float x, float y); /** * @brief Draws a quadratic bezier curve from the last point of a path to the relative target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX Indicates the x coordinate of the relative control point. * @param ctrlY Indicates the y coordinate of the relative control point. * @param endX Indicates the x coordinate of the relative target point. @@ -297,13 +299,13 @@ void OH_Drawing_PathRLineTo(OH_Drawing_Path*, float x, float y); * @since 12 * @version 1.0 */ -void OH_Drawing_PathRQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY); +void OH_Drawing_PathRQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY); /** * @brief Draws a conic from the last point of a path to the relative target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX Indicates the x coordinate of the relative control point. * @param ctrlY Indicates the y coordinate of the relative control point. * @param endX Indicates the x coordinate of the relative target point. @@ -312,13 +314,13 @@ void OH_Drawing_PathRQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float en * @since 12 * @version 1.0 */ -void OH_Drawing_PathRConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight); +void OH_Drawing_PathRConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight); /** * @brief Draws a cubic bezier curve from the last point of a path to the relative target point. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param ctrlX1 Indicates the x coordinate of the first relative control point. * @param ctrlY1 Indicates the y coordinate of the first relative control point. * @param ctrlX2 Indicates the x coordinate of the second relative control point. @@ -328,76 +330,78 @@ void OH_Drawing_PathRConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float e * @since 12 * @version 1.0 */ -void OH_Drawing_PathRCubicTo(OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, +void OH_Drawing_PathRCubicTo(OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); /** * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param left Indicates the left coordinate of the upper left corner of the rectangle. * @param top Indicates the top coordinate of the upper top corner of the rectangle. * @param right Indicates the right coordinate of the lower right corner of the rectangle. * @param bottom Indicates the bottom coordinate of the lower bottom corner of the rectangle. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param pathDirection Indicates the path direction. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, float right, float bottom, - OH_Drawing_PathDirection); +void OH_Drawing_PathAddRect(OH_Drawing_Path* path, float left, float top, float right, float bottom, + OH_Drawing_PathDirection pathDirection); /** * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param pathDirection Indicates the path direction. * @param start Indicates initial corner of rect to add. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path*, const OH_Drawing_Rect*, - OH_Drawing_PathDirection, uint32_t start); +void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path* path, const OH_Drawing_Rect* rect, + OH_Drawing_PathDirection pathDirection, uint32_t start); /** * @brief Adds a new contour to the path, defined by the round rect, and wound in the specified direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param pathDirection Indicates the path direction. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection); +void OH_Drawing_PathAddRoundRect(OH_Drawing_Path* path, + const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection pathDirection); /** * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @param start Index of initial point of ellipse. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param pathDirection Indicates the path direction. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path*, const OH_Drawing_Rect*, - uint32_t start, OH_Drawing_PathDirection); +void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path* path, const OH_Drawing_Rect* rect, + uint32_t start, OH_Drawing_PathDirection pathDirection); /** * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. + * @param pathDirection Indicates the path direction. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddOval(OH_Drawing_Path*, const OH_Drawing_Rect*, OH_Drawing_PathDirection); +void OH_Drawing_PathAddOval(OH_Drawing_Path* path, + const OH_Drawing_Rect* rect, OH_Drawing_PathDirection pathDirection); /** * @brief Appends arc to path, as the start of new contour.Arc added is part of ellipse bounded by oval, @@ -407,27 +411,27 @@ void OH_Drawing_PathAddOval(OH_Drawing_Path*, const OH_Drawing_Rect*, OH_Drawing * values are treated modulo 360, and arc may or may not draw depending on numeric rounding. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @param startAngle Indicates the starting angle of arc in degrees. * @param sweepAngle Indicates the sweep, in degrees. Positive is clockwise. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); +void OH_Drawing_PathAddArc(OH_Drawing_Path* path, const OH_Drawing_Rect* rect, float startAngle, float sweepAngle); /** * @brief Appends src path to path, transformed by matrix. Transformed curves may have different verbs, * point, and conic weights. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param src Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Matrix Indicates the length of the OH_Drawing_Matrix object. + * @param matrix Indicates the length of the OH_Drawing_Matrix object. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*); +void OH_Drawing_PathAddPath(OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix); /** * @brief Appends src path to path, transformed by matrix and mode. Transformed curves may have different verbs, @@ -436,13 +440,13 @@ void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param path Indicates the pointer to an OH_Drawing_Path object. * @param src Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Matrix Indicates the length of the OH_Drawing_Matrix object. - * @param OH_Drawing_PathAddMode Indicates the add path's add mode. + * @param matrix Indicates the length of the OH_Drawing_Matrix object. + * @param pathAddMode Indicates the add path's add mode. * @since 12 * @version 1.0 */ void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, - const OH_Drawing_Matrix*, OH_Drawing_PathAddMode); + const OH_Drawing_Matrix* matrix, OH_Drawing_PathAddMode pathAddMode); /** * @brief Appends src path to path, transformed by mode. Transformed curves may have different verbs, @@ -451,11 +455,12 @@ void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Dra * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param path Indicates the pointer to an OH_Drawing_Path object. * @param src Indicates the pointer to an OH_Drawing_Path object, which is Appends src path to path. - * @param OH_Drawing_PathAddMode Indicates the add path's add mode. + * @param pathAddMode Indicates the add path's add mode. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode); +void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, + const OH_Drawing_Path* src, OH_Drawing_PathAddMode pathAddMode); /** * @brief Appends src path to path, transformed by offset and mode. Transformed curves may have different verbs, @@ -466,12 +471,12 @@ void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path * @param src Indicates the pointer to an OH_Drawing_Path object. * @param dx Indicates offset added to src path x-axis coordinates. * @param dy Indicates offset added to src path y-axis coordinates. - * @param OH_Drawing_PathAddMode Indicates the add path's add mode. + * @param pathAddMode Indicates the add path's add mode. * @since 12 * @version 1.0 */ void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy, - OH_Drawing_PathAddMode); + OH_Drawing_PathAddMode pathAddMode); /** * @brief Adds contour created from point array, adding (count - 1) line segments. @@ -494,11 +499,12 @@ void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* * @param x Indicates the x coordinate of the center of the circle. * @param y Indicates the y coordinate of the center of the circle. * @param radius Indicates the radius of the circle. - * @param OH_Drawing_PathDirection Indicates the path direction. + * @param pathDirection Indicates the path direction. * @since 12 * @version 1.0 */ -void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection); +void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, + float x, float y, float radius, OH_Drawing_PathDirection pathDirection); /** * @brief Parses the svg path from the string. @@ -516,26 +522,26 @@ bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str); * @brief Return the status that point (x, y) is contained by path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param x Indicates the x-axis value of containment test. * @param y Indicates the y-axis value of containment test. * @return Returns true if the point (x, y) is contained by path. * @since 12 * @version 1.0 */ -bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y); +bool OH_Drawing_PathContains(OH_Drawing_Path* path, float x, float y); /** * @brief Transforms verb array, point array, and weight by matrix. transform may change verbs * and increase their number. path is replaced by transformed data. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @since 12 * @version 1.0 */ -void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*); +void OH_Drawing_PathTransform(OH_Drawing_Path* path, const OH_Drawing_Matrix* matrix); /** * @brief Transforms verb array, point array, and weight by matrix. @@ -543,58 +549,58 @@ void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param src Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * @param dst Indicates the pointer to an OH_Drawing_Path object. * @param applyPerspectiveClip Indicates whether to apply perspective clip. * @since 12 * @version 1.0 */ -void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix*, +void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix, OH_Drawing_Path* dst, bool applyPerspectiveClip); /** * @brief Sets FillType, the rule used to fill path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_PathFillType Indicates the add path's fill type. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param pathFillType Indicates the add path's fill type. * @since 12 * @version 1.0 */ -void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType); +void OH_Drawing_PathSetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType pathFillType); /** * @brief Gets the length of the current path object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @param forceClosed Indicates whether free to modify/delete the path after this call. * @return Returns the length of the current path object. * @since 12 * @version 1.0 */ -float OH_Drawing_PathGetLength(OH_Drawing_Path*, bool forceClosed); +float OH_Drawing_PathGetLength(OH_Drawing_Path* path, bool forceClosed); /** * @brief Gets the smallest bounding box that contains the path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 12 * @version 1.0 */ -void OH_Drawing_PathGetBounds(OH_Drawing_Path*, OH_Drawing_Rect*); +void OH_Drawing_PathGetBounds(OH_Drawing_Path* path, OH_Drawing_Rect* rect); /** * @brief Closes a path. A line segment from the start point to the last point of the path is added. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ -void OH_Drawing_PathClose(OH_Drawing_Path*); +void OH_Drawing_PathClose(OH_Drawing_Path* path); /** * @brief Offset path replaces dst. @@ -613,11 +619,11 @@ void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx * @brief Resets path data. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param path Indicates the pointer to an OH_Drawing_Path object. * @since 8 * @version 1.0 */ -void OH_Drawing_PathReset(OH_Drawing_Path*); +void OH_Drawing_PathReset(OH_Drawing_Path* path); /** * @brief Determines whether the path current contour is closed. @@ -647,6 +653,27 @@ bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed); bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed, float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent); +/** + * @brief Gets the path between the start and end points. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param forceClosed Whether to close the path. + * @param start The distance from the starting point of the segment to the starting point of the path. + * @param stop The distance from the end point of the segment to the starting point of the path. + * @param startWithMoveTo Whether the path obtained moveTo to the starting segment. + * @param dst The path obtained. + * @param result Indicates the result of getting the path segment. + * The value is false if the segment is zero-length or start >= stop, and true otherwise. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of path, dst and result is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathGetSegment(OH_Drawing_Path* path, bool forceClosed, + float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result); + /** * @brief Combines two paths. * diff --git a/graphic/graphic_2d/native_drawing/drawing_path_effect.h b/graphic/graphic_2d/native_drawing/drawing_path_effect.h index b3260d576e27c033b8091db77e436454def765c9..214cea663c5a3ccd3f454c76b4e0e7faca62d578 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_path_effect.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_PATH_EFFECT_H -#define C_INCLUDE_DRAWING_PATH_EFFECT_H - /** * @addtogroup Drawing * @{ @@ -40,12 +37,57 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_PATH_EFFECT_H +#define C_INCLUDE_DRAWING_PATH_EFFECT_H + #include "drawing_types.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief Enumerate path dash style. + * + * @since 18 + * @version 1.0 + */ +typedef enum { + /** Indicates translation effect. */ + DRAWING_PATH_DASH_STYLE_TRANSLATE, + /** Indicates rotation effect. */ + DRAWING_PATH_DASH_STYLE_ROTATE, + /** Indicates morph effect. */ + DRAWING_PATH_DASH_STYLE_MORPH, +} OH_Drawing_PathDashStyle; + +/** + * @brief Creates an OH_Drawing_PathEffect object that is a combination of paths, + * applying the inner path effect first and then the outer path effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param outer Indicates an OH_Drawing_PathEffect object + * @param inner Indicates an OH_Drawing_PathEffect object + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 18 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateComposePathEffect(OH_Drawing_PathEffect* outer, OH_Drawing_PathEffect* inner); + +/** + * @brief Creates an OH_Drawing_PathEffect object + * that turns the included angle of the path into a fillet of a specified radius. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param radius Indicates the degree of curvature of the arc, the radius must be greater than zero. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is radius is zero or less. + * @since 18 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateCornerPathEffect(float radius); + /** * @brief Creates an OH_Drawing_PathEffect object. * @@ -59,15 +101,58 @@ extern "C" { */ OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); +/** + * @brief Creates an OH_Drawing_PathEffect object + * that breaks the path and creates an irregular distribution on the path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param segLength Indicates the maximum segment length of the path. + * @param deviation Indicates the deviation during drawing. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 18 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateDiscretePathEffect(float segLength, float deviation); + +/** + * @brief Creates an OH_Drawing_PathEffect object and sets the path effect to a dash effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param advance Indicates the distance between the dashed segments. + * @param phase Indicates the offset into intervals array. + * @param type Indicates the type of the path dash effect. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is advance and phase are zero or less. + * @since 18 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreatePathDashEffect(const OH_Drawing_Path* path, float advance, float phase, + OH_Drawing_PathDashStyle type); + +/** + * @brief Creates an OH_Drawing_PathEffect object by overlaying two path effects. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param firstPathEffect Indicates the pointer to an OH_Drawing_PathEffect object. + * @param secondPathEffect Indicates the pointer to an OH_Drawing_PathEffect object. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 18 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateSumPathEffect(OH_Drawing_PathEffect* firstPathEffect, + OH_Drawing_PathEffect* secondPathEffect); + /** * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_PathEffect Indicates the pointer to an OH_Drawing_PathEffect object. + * @param pathEffect Indicates the pointer to an OH_Drawing_PathEffect object. * @since 12 * @version 1.0 */ -void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect*); +void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect* pathEffect); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h index 304439aa94d347df86f1ebe7de33009f60e02381..7465f4ebafab88b6f35210b83fa11910015328ba 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pen.h +++ b/graphic/graphic_2d/native_drawing/drawing_pen.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_PEN_H -#define C_INCLUDE_DRAWING_PEN_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_PEN_H +#define C_INCLUDE_DRAWING_PEN_H + #include "drawing_types.h" #ifdef __cplusplus @@ -60,115 +60,115 @@ OH_Drawing_Pen* OH_Drawing_PenCreate(void); * @brief Creates an OH_Drawing_Pen copy object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns the pointer to the OH_Drawing_Pen object created. * If nullptr is returned, the creation fails. * The possible cause of the failure is that the available memory is empty or a nullptr is passed. * @since 12 * @version 1.0 */ -OH_Drawing_Pen* OH_Drawing_PenCopy(OH_Drawing_Pen*); +OH_Drawing_Pen* OH_Drawing_PenCopy(OH_Drawing_Pen* pen); /** * @brief Destroys an OH_Drawing_Pen object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @since 8 * @version 1.0 */ -void OH_Drawing_PenDestroy(OH_Drawing_Pen*); +void OH_Drawing_PenDestroy(OH_Drawing_Pen* pen); /** * @brief Checks whether anti-aliasing is enabled for a pen. If anti-aliasing is enabled, * edges will be drawn with partial transparency. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns true if anti-aliasing is enabled; returns false otherwise. * @since 8 * @version 1.0 */ -bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen*); +bool OH_Drawing_PenIsAntiAlias(const OH_Drawing_Pen* pen); /** * @brief Enables or disables anti-aliasing for a pen. If anti-aliasing is enabled, * edges will be drawn with partial transparency. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param bool Specifies whether to enable anti-aliasing. The value true means + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param antiAlias Specifies whether to enable anti-aliasing. The value true means * to enable anti-aliasing, and false means the opposite. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen*, bool); +void OH_Drawing_PenSetAntiAlias(OH_Drawing_Pen* pen, bool antiAlias); /** * @brief Obtains the color of a pen. The color is used by the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns a 32-bit (ARGB) variable that describes the color. * @since 8 * @version 1.0 */ -uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen*); +uint32_t OH_Drawing_PenGetColor(const OH_Drawing_Pen* pen); /** * @brief Sets the color for a pen. The color is used by the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @param color Indicates the color to set, which is a 32-bit (ARGB) variable. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetColor(OH_Drawing_Pen*, uint32_t color); +void OH_Drawing_PenSetColor(OH_Drawing_Pen* pen, uint32_t color); /** * @brief Obtains the alpha of a pen. The alpha is used by the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns a 8-bit variable that describes the alpha. * @since 11 * @version 1.0 */ -uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen*); +uint8_t OH_Drawing_PenGetAlpha(const OH_Drawing_Pen* pen); /** * @brief Sets the alpha for a pen. The alpha is used by the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @param alpha Indicates the alpha to set, which is a 8-bit variable. * @since 11 * @version 1.0 */ -void OH_Drawing_PenSetAlpha(OH_Drawing_Pen*, uint8_t alpha); +void OH_Drawing_PenSetAlpha(OH_Drawing_Pen* pen, uint8_t alpha); /** * @brief Obtains the thickness of a pen. This thickness determines the width of the outline of a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns the thickness. * @since 8 * @version 1.0 */ -float OH_Drawing_PenGetWidth(const OH_Drawing_Pen*); +float OH_Drawing_PenGetWidth(const OH_Drawing_Pen* pen); /** * @brief Sets the thickness for a pen. This thickness determines the width of the outline of a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @param width Indicates the thickness to set, which is a variable. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); +void OH_Drawing_PenSetWidth(OH_Drawing_Pen* pen, float width); /** * @brief Obtains the stroke miter limit of a polyline drawn by a pen. @@ -177,12 +177,12 @@ void OH_Drawing_PenSetWidth(OH_Drawing_Pen*, float width); * and a mitered corner is displayed if the miter limit is not exceeded. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns the miter limit. * @since 8 * @version 1.0 */ -float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); +float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen* pen); /** * @brief Sets the stroke miter limit for a polyline drawn by a pen. @@ -191,12 +191,12 @@ float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); * and a mitered corner is displayed if the miter limit is not exceeded. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @param miter Indicates a variable that describes the miter limit. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); +void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen* pen, float miter); /** * @brief Enumerates line cap styles of a pen. The line cap style defines @@ -226,23 +226,23 @@ typedef enum { * @brief Obtains the line cap style of a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns the line cap style. * @since 8 * @version 1.0 */ -OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen*); +OH_Drawing_PenLineCapStyle OH_Drawing_PenGetCap(const OH_Drawing_Pen* pen); /** * @brief Sets the line cap style for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_PenLineCapStyle Indicates a variable that describes the line cap style. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param capStyle Indicates a variable that describes the line cap style. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); +void OH_Drawing_PenSetCap(OH_Drawing_Pen* pen, OH_Drawing_PenLineCapStyle capStyle); /** * @brief Enumerates pen line join styles. The line join style defines @@ -267,117 +267,117 @@ typedef enum { * @brief Obtains the line join style of a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @return Returns the line join style. * @since 8 * @version 1.0 */ -OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen*); +OH_Drawing_PenLineJoinStyle OH_Drawing_PenGetJoin(const OH_Drawing_Pen* pen); /** * @brief Sets the line join style for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_PenLineJoinStyle Indicates a variable that describes the line join style. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param joinStyle Indicates a variable that describes the line join style. * @since 8 * @version 1.0 */ -void OH_Drawing_PenSetJoin(OH_Drawing_Pen*, OH_Drawing_PenLineJoinStyle); +void OH_Drawing_PenSetJoin(OH_Drawing_Pen* pen, OH_Drawing_PenLineJoinStyle joinStyle); /** * @brief Sets the shaderEffect for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_ShaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param shaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. * @since 11 * @version 1.0 */ -void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); +void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen* pen, OH_Drawing_ShaderEffect* shaderEffect); /** * @brief Sets the shadowLayer for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_ShadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param shadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. * @since 12 * @version 1.0 */ -void OH_Drawing_PenSetShadowLayer(OH_Drawing_Pen*, OH_Drawing_ShadowLayer*); +void OH_Drawing_PenSetShadowLayer(OH_Drawing_Pen* pen, OH_Drawing_ShadowLayer* shadowLayer); /** * @brief Sets the pathEffect for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_PathEffect Indicates the pointer to an OH_Drawing_PathEffect object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pathEffect Indicates the pointer to an OH_Drawing_PathEffect object. * @since 12 * @version 1.0 */ -void OH_Drawing_PenSetPathEffect(OH_Drawing_Pen*, OH_Drawing_PathEffect*); +void OH_Drawing_PenSetPathEffect(OH_Drawing_Pen* pen, OH_Drawing_PathEffect* pathEffect); /** * @brief Sets the filter for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. * @since 11 * @version 1.0 */ -void OH_Drawing_PenSetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*); +void OH_Drawing_PenSetFilter(OH_Drawing_Pen* pen, OH_Drawing_Filter* filter); /** * @brief Gets the filter from a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_Filter Indicates the pointer to an OH_Drawing_Filter object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param filter Indicates the pointer to an OH_Drawing_Filter object. * @since 12 * @version 1.0 */ -void OH_Drawing_PenGetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*); +void OH_Drawing_PenGetFilter(OH_Drawing_Pen* pen, OH_Drawing_Filter* filter); /** * @brief Sets a blender that implements the specified blendmode enum for a pen. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. - * @param OH_Drawing_BlendMode Indicates the blend mode. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. + * @param blendMode Indicates the blend mode. * @since 12 * @version 1.0 */ -void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode); +void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen* pen, OH_Drawing_BlendMode blendMode); /** * @brief Gets the filled equivalent of the src path. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @param src Indicates the Path read to create a filled version. * @param dst Indicates the resulting Path. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object that limits the PathEffect area if + * @param rect Indicates the pointer to an OH_Drawing_Rect object that limits the PathEffect area if Pen has PathEffect. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object that tranfomation applied to + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object that tranfomation applied to PathEffect if Pen has PathEffect. * @return Returns true if get successes; false if get fails. * @since 12 * @version 1.0 */ -bool OH_Drawing_PenGetFillPath(OH_Drawing_Pen*, const OH_Drawing_Path* src, OH_Drawing_Path* dst, - const OH_Drawing_Rect*, const OH_Drawing_Matrix*); +bool OH_Drawing_PenGetFillPath(OH_Drawing_Pen* pen, const OH_Drawing_Path* src, OH_Drawing_Path* dst, + const OH_Drawing_Rect* rect, const OH_Drawing_Matrix* matrix); /** * @brief Resets all pen contents to their initial values. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param pen Indicates the pointer to an OH_Drawing_Pen object. * @since 12 * @version 1.0 */ -void OH_Drawing_PenReset(OH_Drawing_Pen*); +void OH_Drawing_PenReset(OH_Drawing_Pen* pen); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_pixel_map.h b/graphic/graphic_2d/native_drawing/drawing_pixel_map.h index ef29ce5b42a542cb6ab169201284adfba58fd86b..0c0eb5e091d22d20d84864bd2989dd2ce2bc68a5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pixel_map.h +++ b/graphic/graphic_2d/native_drawing/drawing_pixel_map.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_PIXEL_MAP_H -#define C_INCLUDE_DRAWING_PIXEL_MAP_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_PIXEL_MAP_H +#define C_INCLUDE_DRAWING_PIXEL_MAP_H + #include "drawing_types.h" #ifdef __cplusplus @@ -64,36 +64,36 @@ typedef struct OH_PixelmapNative OH_PixelmapNative; * @brief Gets an OH_Drawing_PixelMap object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param NativePixelMap_ Indicates a pointer to an native pixelmap supported by image framework. + * @param nativePixelMap Indicates a pointer to an native pixelmap supported by image framework. * @return Returns the pointer to the OH_Drawing_PixelMap object. * @since 12 * @version 1.0 */ -OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap(NativePixelMap_*); +OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromNativePixelMap(NativePixelMap_* nativePixelMap); /** * @brief Gets an OH_Drawing_PixelMap object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_PixelmapNative Indicates a pointer to the OH_PixelmapNative object supported by image framework. + * @param pixelmapNative Indicates a pointer to the OH_PixelmapNative object supported by image framework. * @return Returns the pointer to the OH_Drawing_PixelMap object. * If nullptr is returned, the get operation fails. * The possible cause of the failure is that a nullptr is passed. * @since 12 * @version 1.0 */ -OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative(OH_PixelmapNative*); +OH_Drawing_PixelMap* OH_Drawing_PixelMapGetFromOhPixelMapNative(OH_PixelmapNative* pixelmapNative); /** * @brief Dissolves the relationship between OH_Drawing_PixelMap object and NativePixelMap_ or OH_PixelmapNative which is build by 'GetFrom' function. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_PixelMap Indicates a pointer to the OH_Drawing_PixelMap. + * @param pixelMap Indicates a pointer to the OH_Drawing_PixelMap. * @since 12 * @version 1.0 */ -void OH_Drawing_PixelMapDissolve(OH_Drawing_PixelMap*); +void OH_Drawing_PixelMapDissolve(OH_Drawing_PixelMap* pixelMap); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_point.h b/graphic/graphic_2d/native_drawing/drawing_point.h index 47756fb6537b3deedb9da34b59b62d94389bc291..d3c8f5a46109bef056ca5279f887575386e2bb1e 100644 --- a/graphic/graphic_2d/native_drawing/drawing_point.h +++ b/graphic/graphic_2d/native_drawing/drawing_point.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_POINT_H -#define C_INCLUDE_DRAWING_POINT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_POINT_H +#define C_INCLUDE_DRAWING_POINT_H + #include "drawing_error_code.h" #include "drawing_types.h" @@ -106,11 +106,11 @@ OH_Drawing_ErrorCode OH_Drawing_PointSet(OH_Drawing_Point* point, float x, float * @brief Destroys an OH_Drawing_Point object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @param point Indicates the pointer to an OH_Drawing_Point object. * @since 11 * @version 1.0 */ -void OH_Drawing_PointDestroy(OH_Drawing_Point*); +void OH_Drawing_PointDestroy(OH_Drawing_Point* point); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_record_cmd.h b/graphic/graphic_2d/native_drawing/drawing_record_cmd.h index 63c03f03b1d348ef47eb9d7af70e3385a27ebc39..95ae7338598da711677fd7b17b128664f6e290e4 100644 --- a/graphic/graphic_2d/native_drawing/drawing_record_cmd.h +++ b/graphic/graphic_2d/native_drawing/drawing_record_cmd.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_RECORD_CMD_H -#define C_INCLUDE_DRAWING_RECORD_CMD_H - /** * @addtogroup Drawing * @{ @@ -33,11 +30,16 @@ * * @brief Declares functions related to the RecordCmd object in the drawing module. * + * @kit ArkGraphics2D * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @since 13 * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_RECORD_CMD_H +#define C_INCLUDE_DRAWING_RECORD_CMD_H + #include "drawing_types.h" #include "drawing_error_code.h" diff --git a/graphic/graphic_2d/native_drawing/drawing_rect.h b/graphic/graphic_2d/native_drawing/drawing_rect.h index e07abff68df1f0ac2cd19ec03a9dacac6565144f..27dd05fea58e466336e16849b20773da2a2b4f47 100644 --- a/graphic/graphic_2d/native_drawing/drawing_rect.h +++ b/graphic/graphic_2d/native_drawing/drawing_rect.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_RECT_H -#define C_INCLUDE_DRAWING_RECT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,10 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_RECT_H +#define C_INCLUDE_DRAWING_RECT_H + +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -133,65 +134,66 @@ void OH_Drawing_RectSetBottom(OH_Drawing_Rect* rect, float bottom); * @brief Get the left position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Return the left position of the rect. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetLeft(OH_Drawing_Rect*); +float OH_Drawing_RectGetLeft(OH_Drawing_Rect* rect); /** * @brief Get the top position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Return the top position of the rect. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetTop(OH_Drawing_Rect*); +float OH_Drawing_RectGetTop(OH_Drawing_Rect* rect); /** * @brief Get the right position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Return the right position of the rect. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetRight(OH_Drawing_Rect*); +float OH_Drawing_RectGetRight(OH_Drawing_Rect* rect); /** * @brief Get the bottom position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Return the bottom position of the rect. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetBottom(OH_Drawing_Rect*); +float OH_Drawing_RectGetBottom(OH_Drawing_Rect* rect); /** * @brief Get the height position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetHeight(OH_Drawing_Rect*); +float OH_Drawing_RectGetHeight(OH_Drawing_Rect* rect); -/* @brief Get the width position of the rect. +/** + * @brief Get the width position of the rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Returns the width. * @since 12 * @version 1.0 */ -float OH_Drawing_RectGetWidth(OH_Drawing_Rect*); +float OH_Drawing_RectGetWidth(OH_Drawing_Rect* rect); /** * @brief Copy the original rectangular object to the destination rectangular object. @@ -208,11 +210,69 @@ void OH_Drawing_RectCopy(OH_Drawing_Rect* src, OH_Drawing_Rect* dst); * @brief Destroys an OH_Drawing_Rect object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 11 * @version 1.0 */ -void OH_Drawing_RectDestroy(OH_Drawing_Rect*); +void OH_Drawing_RectDestroy(OH_Drawing_Rect* rect); + +/** + * @brief Creates an OH_Drawing_Array object, which is used to store multiple OH_Drawing_Rect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param size Indicates the size of the array object. + * @return Returns the pointer to the OH_Drawing_Array object created. + * If nullptr is returned, the creation fails. + * The possible cause of the failure is that the available memory is empty, + * or size is invalid. + * @since 18 + * @version 1.0 + */ +OH_Drawing_Array* OH_Drawing_RectCreateArray(size_t size); + +/** + * @brief Gets the size of an OH_Drawing_Array object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param rectArray Indicates the array object. + * @param pSize Indicates the size pointer. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if rectArray or pSize is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RectGetArraySize(OH_Drawing_Array* rectArray, size_t* pSize); + +/** + * @brief Gets the specified OH_Drawing_Rect object from OH_Drawing_Array object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param rectArray Indicates the array object. + * @param index Indicates the index of array, caller must make sure the index is valid. + * @param rect Pointers to Pointer of OH_Drawing_Rect object, returned to the caller. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if rectArray or rect is nullptr, + * or index is valid. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RectGetArrayElement(OH_Drawing_Array* rectArray, size_t index, + OH_Drawing_Rect** rect); + +/** + * @brief Destroys an array OH_Drawing_Rect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param rectArray Indicates the pointer to an OH_Drawing_Array object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if rectArray is nullptr. + * @since 18 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RectDestroyArray(OH_Drawing_Array* rectArray); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index 39eb09315f1966fd014b9e50d8220cb145a6eac9..ea27f3bcef0a16ec05c722ade28d511fed68fdbf 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_REGION_H -#define C_INCLUDE_DRAWING_REGION_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_REGION_H +#define C_INCLUDE_DRAWING_REGION_H + #include "drawing_types.h" #ifdef __cplusplus @@ -94,8 +94,8 @@ OH_Drawing_Region* OH_Drawing_RegionCreate(void); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param region Indicates the pointer to an OH_Drawing_Region object. - * @param int32_t x-coordinate. - * @param int32_t y-coordinate. + * @param x x-coordinate. + * @param y y-coordinate. * @return Returns true if (x, y) is inside region; returns false otherwise. * @since 12 * @version 1.0 @@ -119,8 +119,8 @@ bool OH_Drawing_RegionOp(OH_Drawing_Region* region, const OH_Drawing_Region* oth * @brief Sets the region to the specified rect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Region Indicates the pointer to an OH_Drawing_Region object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param region Indicates the pointer to an OH_Drawing_Region object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @return Return true if constructed Region is not empty. * @since 12 * @version 1.0 @@ -144,11 +144,11 @@ bool OH_Drawing_RegionSetPath(OH_Drawing_Region* region, const OH_Drawing_Path* * @brief Destroys an OH_Drawing_Region object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Region Indicates the pointer to an OH_Drawing_Region object. + * @param region Indicates the pointer to an OH_Drawing_Region object. * @since 12 * @version 1.0 */ -void OH_Drawing_RegionDestroy(OH_Drawing_Region*); +void OH_Drawing_RegionDestroy(OH_Drawing_Region* region); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_register_font.h b/graphic/graphic_2d/native_drawing/drawing_register_font.h index 02f0e982643031df63aaf239e97472ec009521d8..2ffdbbfec66f1ff8bdee46f3aa5969d7e6aef0ba 100644 --- a/graphic/graphic_2d/native_drawing/drawing_register_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_register_font.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_REGISTER_FONT_H -#define C_INCLUDE_DRAWING_REGISTER_FONT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_REGISTER_FONT_H +#define C_INCLUDE_DRAWING_REGISTER_FONT_H + #include "drawing_text_declaration.h" #include "drawing_types.h" diff --git a/graphic/graphic_2d/native_drawing/drawing_round_rect.h b/graphic/graphic_2d/native_drawing/drawing_round_rect.h index b60f491832c87f8c0e84f6a8522aa6b3c8764ca0..e3dec061fcde5f4d778ac639aa799bb147bde934 100644 --- a/graphic/graphic_2d/native_drawing/drawing_round_rect.h +++ b/graphic/graphic_2d/native_drawing/drawing_round_rect.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_ROUND_RECT_H -#define C_INCLUDE_DRAWING_ROUND_RECT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_ROUND_RECT_H +#define C_INCLUDE_DRAWING_ROUND_RECT_H + #include "drawing_error_code.h" #include "drawing_types.h" @@ -76,48 +76,49 @@ typedef enum { * @brief Creates an OH_Drawing_RoundRect object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @param xRad Indicates the corner radii on x-axis. * @param yRad Indicates the corner radii on y-axis. * @return Returns the pointer to the OH_Drawing_RoundRect object created. * @since 11 * @version 1.0 */ -OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect*, float xRad, float yRad); +OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect* rect, float xRad, float yRad); /** * @brief Sets the radiusX and radiusY for a specific corner position. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_Rect object. + * @param roundRect Indicates the pointer to an OH_Drawing_Rect object. * @param pos Indicates the corner radii position. - * @param OH_Drawing_Corner_Radii Indicates the corner radii on x-axis and y-axis. + * @param radii Indicates the corner radii on x-axis and y-axis. * @since 12 * @version 1.0 */ -void OH_Drawing_RoundRectSetCorner(OH_Drawing_RoundRect*, OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii); +void OH_Drawing_RoundRectSetCorner(OH_Drawing_RoundRect* roundRect, + OH_Drawing_CornerPos pos, OH_Drawing_Corner_Radii radii); /** * @brief Gets an OH_Drawing_Corner_Radii struct, the point is round corner radiusX and radiusY. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object. * @param pos Indicates the corner radii position. * @return Returns the corner radii of OH_Drawing_Corner_Radii struct. * @since 12 * @version 1.0 */ -OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner(OH_Drawing_RoundRect*, OH_Drawing_CornerPos pos); +OH_Drawing_Corner_Radii OH_Drawing_RoundRectGetCorner(OH_Drawing_RoundRect* roundRect, OH_Drawing_CornerPos pos); /** * @brief Destroys an OH_Drawing_RoundRect object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object. * @since 11 * @version 1.0 */ -void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect*); +void OH_Drawing_RoundRectDestroy(OH_Drawing_RoundRect* roundRect); /** * @brief Translates round rect by (dx, dy). diff --git a/graphic/graphic_2d/native_drawing/drawing_sampling_options.h b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h index b613776cf1a7f4019b1cf681f21c4a1c359b94ff..12a90a087976fd9ac76ee607786ac032dc9b9d44 100644 --- a/graphic/graphic_2d/native_drawing/drawing_sampling_options.h +++ b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H -#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H +#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H + #include "drawing_types.h" #ifdef __cplusplus @@ -78,23 +78,24 @@ typedef enum { * @brief Creates an OH_Drawing_SamplingOptions object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FilterMode sampling filter mode. - * @param OH_Drawing_MipmapMode sampling mipmap mode.. + * @param filterMode sampling filter mode. + * @param mipmapMode sampling mipmap mode.. * @return Returns the pointer to the OH_Drawing_SamplingOptions object created. * @since 12 * @version 1.0 */ -OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode, OH_Drawing_MipmapMode); +OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode filterMode, + OH_Drawing_MipmapMode mipmapMode); /** * @brief Destroys an OH_Drawing_SamplingOptions object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param samplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. * @since 12 * @version 1.0 */ -void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions*); +void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions* samplingOptions); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h index f3a6245c008d20e5a40266080094b6e5b49728bf..b42156a5fcde2a861d16cb6ea73164452a1059fb 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shader_effect.h +++ b/graphic/graphic_2d/native_drawing/drawing_shader_effect.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_SHADER_EFFECT_H -#define C_INCLUDE_DRAWING_SHADER_EFFECT_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_SHADER_EFFECT_H +#define C_INCLUDE_DRAWING_SHADER_EFFECT_H + #include "drawing_types.h" #ifdef __cplusplus @@ -94,13 +94,14 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateColorShader(const uint32_t * @param colors Indicates the colors to be distributed between the two points. * @param pos Indicates the relative position of each corresponding color in the colors array. * @param size Indicates the number of colors and pos. - * @param OH_Drawing_TileMode Indicates the tile mode. + * @param tileMode Indicates the tile mode. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. * @since 11 * @version 1.0 */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Drawing_Point* startPt, - const OH_Drawing_Point* endPt, const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode); + const OH_Drawing_Point* endPt, const uint32_t* colors, + const float* pos, uint32_t size, OH_Drawing_TileMode tileMode); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a linear gradient between the two specified points. @@ -112,8 +113,8 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Dr * @param pos Indicates the relative position of each corresponding color in the colors array. * If pos is nullptr, the colors are evenly distributed between the start and end point. * @param size Indicates the number of colors and pos(if pos is not nullptr). - * @param OH_Drawing_TileMode Indicates the tile mode. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object, + * @param tileMode Indicates the tile mode. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object, which represents the local matrix of the created OH_Drawing_ShaderEffect object. If matrix is nullptr, defaults to the identity matrix. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. @@ -124,7 +125,7 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradient(const OH_Dr */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMatrix( const OH_Drawing_Point2D* startPt, const OH_Drawing_Point2D* endPt, const uint32_t* colors, const float* pos, - uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*); + uint32_t size, OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a radial gradient given the center and radius. @@ -135,13 +136,13 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateLinearGradientWithLocalMat * @param colors Indicates the colors to be distributed between the two points. * @param pos Indicates the relative position of each corresponding color in the colors array. * @param size Indicates the number of colors and pos. - * @param OH_Drawing_TileMode Indicates the tile mode. + * @param tileMode Indicates the tile mode. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. * @since 11 * @version 1.0 */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Drawing_Point* centerPt, float radius, - const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode); + const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode tileMode); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a radial gradient given the center and radius. @@ -152,8 +153,8 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Dr * @param colors Indicates the colors to be distributed between the two points. * @param pos Indicates the relative position of each corresponding color in the colors array. * @param size Indicates the number of colors and pos. - * @param OH_Drawing_TileMode Indicates the tile mode. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object, + * @param tileMode Indicates the tile mode. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object, which represents the local matrix of the created OH_Drawing_ShaderEffect object. If matrix is nullptr, defaults to the identity matrix. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. @@ -164,7 +165,7 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradient(const OH_Dr */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMatrix( const OH_Drawing_Point2D* centerPt, float radius, const uint32_t* colors, const float* pos, uint32_t size, - OH_Drawing_TileMode, const OH_Drawing_Matrix*); + OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a sweep gradient given a center. @@ -174,30 +175,31 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateRadialGradientWithLocalMat * @param colors Indicates the colors to be distributed between the two points. * @param pos Indicates the relative position of each corresponding color in the colors array. * @param size Indicates the number of colors and pos. - * @param OH_Drawing_TileMode Indicates the tile mode. + * @param tileMode Indicates the tile mode. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. * @since 11 * @version 1.0 */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateSweepGradient(const OH_Drawing_Point* centerPt, - const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode); + const uint32_t* colors, const float* pos, uint32_t size, OH_Drawing_TileMode tileMode); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a image shader. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param image Indicates the pointer to an OH_Drawing_Image object. * @param tileX Indicates the tileX. * @param tileY Indicates the tileY. - * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param samplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. * If matrix is nullptr, defaults to the identity matrix. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. * @since 12 * @version 1.0 */ -OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Image*, - OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions*, const OH_Drawing_Matrix*); +OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Image* image, + OH_Drawing_TileMode tileX, OH_Drawing_TileMode tileY, const OH_Drawing_SamplingOptions* samplingOptions, + const OH_Drawing_Matrix* matrix); /** * @brief Creates an OH_Drawing_ShaderEffect that generates a conical gradient given two circles. @@ -210,8 +212,8 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Ima * @param colors Indicates the colors to be distributed between the two points. * @param pos Indicates the relative position of each corresponding color in the colors array. * @param size Indicates the number of colors and pos. - * @param OH_Drawing_TileMode Indicates the tile mode. - * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object, + * @param tileMode Indicates the tile mode. + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object, which represents the local matrix of the created OH_Drawing_ShaderEffect object. If matrix is nullptr, defaults to the identity matrix. * @return Returns the pointer to the OH_Drawing_ShaderEffect object created. @@ -222,17 +224,17 @@ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateImageShader(OH_Drawing_Ima */ OH_Drawing_ShaderEffect* OH_Drawing_ShaderEffectCreateTwoPointConicalGradient(const OH_Drawing_Point2D* startPt, float startRadius, const OH_Drawing_Point2D* endPt, float endRadius, const uint32_t* colors, const float* pos, - uint32_t size, OH_Drawing_TileMode, const OH_Drawing_Matrix*); + uint32_t size, OH_Drawing_TileMode tileMode, const OH_Drawing_Matrix* matrix); /** * @brief Destroys an OH_Drawing_ShaderEffect object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ShaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. + * @param shaderEffect Indicates the pointer to an OH_Drawing_ShaderEffect object. * @since 11 * @version 1.0 */ -void OH_Drawing_ShaderEffectDestroy(OH_Drawing_ShaderEffect*); +void OH_Drawing_ShaderEffectDestroy(OH_Drawing_ShaderEffect* shaderEffect); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h b/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h index 6b78e034ac4a1b868894ad65c667bfe638740de7..143e7280142b0f3d0c59c92456c2b865982873eb 100644 --- a/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h +++ b/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_SHADOW_LAYER_H -#define C_INCLUDE_DRAWING_SHADOW_LAYER_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_SHADOW_LAYER_H +#define C_INCLUDE_DRAWING_SHADOW_LAYER_H + #include "drawing_types.h" #ifdef __cplusplus @@ -64,11 +64,11 @@ OH_Drawing_ShadowLayer* OH_Drawing_ShadowLayerCreate(float blurRadius, float x, * @brief Destroys an OH_Drawing_ShadowLayer object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_ShadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. + * @param shadowLayer Indicates the pointer to an OH_Drawing_ShadowLayer object. * @since 12 * @version 1.0 */ -void OH_Drawing_ShadowLayerDestroy(OH_Drawing_ShadowLayer*); +void OH_Drawing_ShadowLayerDestroy(OH_Drawing_ShadowLayer* shadowLayer); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_surface.h b/graphic/graphic_2d/native_drawing/drawing_surface.h index b388ead2a4df398b27b6794dce2ac7da551bab99..67f951f74e6ec4ae8a0a1523af3bdcc427f33c10 100644 --- a/graphic/graphic_2d/native_drawing/drawing_surface.h +++ b/graphic/graphic_2d/native_drawing/drawing_surface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_GPU_SURFACE_H -#define C_INCLUDE_DRAWING_GPU_SURFACE_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,10 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_SURFACE_H +#define C_INCLUDE_DRAWING_SURFACE_H + +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -50,37 +51,64 @@ extern "C" { * @brief Creates an OH_Drawing_Surface object on GPU indicated by context. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_GpuContext Indicates the pointer to an OH_Drawing_GpuContext object. - * @param bool Indicates whether an allocation should count against a cache budget. - * @param OH_Drawing_Image_Info Indicates the image info. + * @param gpuContext Indicates the pointer to an OH_Drawing_GpuContext object. + * @param flag Indicates whether an allocation should count against a cache budget. + * @param imageInfo Indicates the image info. * @return Returns the pointer to the OH_Drawing_Surface object created. * @since 12 * @version 1.0 */ OH_Drawing_Surface* OH_Drawing_SurfaceCreateFromGpuContext( - OH_Drawing_GpuContext*, bool, OH_Drawing_Image_Info); + OH_Drawing_GpuContext* gpuContext, bool flag, OH_Drawing_Image_Info imageInfo); + +/** + * @brief Creates an OH_Drawing_Surface object on GPU indicated by context which is on-screen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param gpuContext Indicates the pointer to an OH_Drawing_GpuContext object. + * @param imageInfo Indicates the image info. + * @param window Indicates the pointer of the screen window. + * @return Returns the pointer to the OH_Drawing_Surface object created. + * @since 16 + * @version 1.0 + */ +OH_Drawing_Surface* OH_Drawing_SurfaceCreateOnScreen( + OH_Drawing_GpuContext* gpuContext, OH_Drawing_Image_Info imageInfo, void* window); /** * @brief Gets the canvas that draws into surface. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Surface Indicates the pointer to an OH_Drawing_Surface object. + * @param surface Indicates the pointer to an OH_Drawing_Surface object. * @return Returns the pointer to the OH_Drawing_Canvas object. The returned pointer does not need to be managed * by the caller. * @since 12 * @version 1.0 */ -OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas(OH_Drawing_Surface*); +OH_Drawing_Canvas* OH_Drawing_SurfaceGetCanvas(OH_Drawing_Surface* surface); + +/** + * @brief Resolves all pending GPU operations on the surface. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param surface Indicates the pointer to an OH_Drawing_Surface object. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if surface is nullptr. + * @since 16 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_SurfaceFlush(OH_Drawing_Surface* surface); /** * @brief Destroys an OH_Drawing_Surface object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Surface Indicates the pointer to an OH_Drawing_Surface object. + * @param surface Indicates the pointer to an OH_Drawing_Surface object. * @since 12 * @version 1.0 */ -void OH_Drawing_SurfaceDestroy(OH_Drawing_Surface*); +void OH_Drawing_SurfaceDestroy(OH_Drawing_Surface* surface); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_blob.h b/graphic/graphic_2d/native_drawing/drawing_text_blob.h index b5b11d7afb650686acf24bc411d8759215821469..5a0dbdfd6fcd7e2dabb803489953c87d1d24bde6 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_blob.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_blob.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_TEXT_BLOB_H -#define C_INCLUDE_DRAWING_TEXT_BLOB_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_TEXT_BLOB_H +#define C_INCLUDE_DRAWING_TEXT_BLOB_H + #include "drawing_types.h" #ifdef __cplusplus @@ -62,14 +62,14 @@ OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param text Indicates the the pointer to text. * @param byteLength Indicates the text length. - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param textEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. * @return Returns the pointer to the OH_Drawing_TextBlob object created. * @since 12 * @version 1.0 */ OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t byteLength, - const OH_Drawing_Font*, OH_Drawing_TextEncoding); + const OH_Drawing_Font* font, OH_Drawing_TextEncoding textEncoding); /** * @brief Creates an OH_Drawing_TextBlob object from pos text. @@ -77,51 +77,51 @@ OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param text Indicates the the pointer to text. * @param byteLength Indicates the text length. - * @param OH_Drawing_Point2D Indicates the pointer to an OH_Drawing_Point2D array object. - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @param point2D Indicates the pointer to an OH_Drawing_Point2D array object. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param textEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. * @return Returns the pointer to the OH_Drawing_TextBlob object created. * @since 12 * @version 1.0 */ OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText(const void* text, size_t byteLength, - OH_Drawing_Point2D*, const OH_Drawing_Font*, OH_Drawing_TextEncoding); + OH_Drawing_Point2D* point2D, const OH_Drawing_Font* font, OH_Drawing_TextEncoding textEncoding); /** * @brief Creates an OH_Drawing_TextBlob object from pos text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param str Indicates the the pointer to text. - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. - * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param textEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. * @return Returns the pointer to the OH_Drawing_TextBlob object created. * @since 12 * @version 1.0 */ OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString(const char* str, - const OH_Drawing_Font*, OH_Drawing_TextEncoding); + const OH_Drawing_Font* font, OH_Drawing_TextEncoding textEncoding); /** * @brief Gets the bounds of textblob, assigned to the pointer to an OH_Drawing_Rect object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlob Indicates the pointer to an OH_Drawing_TextBlob object. - * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param textBlob Indicates the pointer to an OH_Drawing_TextBlob object. + * @param rect Indicates the pointer to an OH_Drawing_Rect object. * @since 12 * @version 1.0 */ -void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*); +void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob* textBlob, OH_Drawing_Rect* rect); /** * @brief Gets a non-zero value unique among all OH_Drawing_TextBlob objects. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlob Indicates the pointer to an OH_Drawing_TextBlob object. + * @param textBlob Indicates the pointer to an OH_Drawing_TextBlob object. * @return Returns identifier for the OH_Drawing_TextBlob object. * @since 12 * @version 1.0 */ -uint32_t OH_Drawing_TextBlobUniqueID(const OH_Drawing_TextBlob*); +uint32_t OH_Drawing_TextBlobUniqueID(const OH_Drawing_TextBlob* textBlob); /** * @brief Defines a run, supplies storage for glyphs and positions. @@ -145,46 +145,46 @@ typedef struct { * by the caller and is forbidden to be used after OH_Drawing_TextBlobBuilderMake is called. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. - * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param textBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. + * @param font Indicates the pointer to an OH_Drawing_Font object. * @param count Indicates the number of glyphs. - * @param OH_Drawing_Rect Indicates the optional run bounding box. + * @param rect Indicates the optional run bounding box. * @since 11 * @version 1.0 */ -const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_TextBlobBuilder*, const OH_Drawing_Font*, - int32_t count, const OH_Drawing_Rect*); +const OH_Drawing_RunBuffer* OH_Drawing_TextBlobBuilderAllocRunPos(OH_Drawing_TextBlobBuilder* textBlobBuilder, + const OH_Drawing_Font* font, int32_t count, const OH_Drawing_Rect* rect); /** * @brief Make an OH_Drawing_TextBlob from OH_Drawing_TextBlobBuilder. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. + * @param textBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. * @return Returns the pointer to the OH_Drawing_TextBlob object. * @since 11 * @version 1.0 */ -OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder*); +OH_Drawing_TextBlob* OH_Drawing_TextBlobBuilderMake(OH_Drawing_TextBlobBuilder* textBlobBuilder); /** * @brief Destroys an OH_Drawing_TextBlob object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlob Indicates the pointer to an OH_Drawing_TextBlob object. + * @param textBlob Indicates the pointer to an OH_Drawing_TextBlob object. * @since 11 * @version 1.0 */ -void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob*); +void OH_Drawing_TextBlobDestroy(OH_Drawing_TextBlob* textBlob); /** * @brief Destroys an OH_Drawing_TextBlobBuilder object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. + * @param textBlobBuilder Indicates the pointer to an OH_Drawing_TextBlobBuilder object. * @since 11 * @version 1.0 */ -void OH_Drawing_TextBlobBuilderDestroy(OH_Drawing_TextBlobBuilder*); +void OH_Drawing_TextBlobBuilderDestroy(OH_Drawing_TextBlobBuilder* textBlobBuilder); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index 9a324c807a683863d649a9e7bc6ec5139a59f919..a005e95af4f44867078ede00750e8eb4db91cca7 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_TEXT_DECLARATION_H -#define C_INCLUDE_DRAWING_TEXT_DECLARATION_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_TEXT_DECLARATION_H +#define C_INCLUDE_DRAWING_TEXT_DECLARATION_H + #ifdef __cplusplus extern "C" { #endif @@ -60,6 +60,14 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection; */ typedef struct OH_Drawing_Typography OH_Drawing_Typography; +/** + * @brief Defines an OH_Drawing_LineTypography, which is used to perform line layout. + * + * @since 18 + * @version 1.0 + */ +typedef struct OH_Drawing_LineTypography OH_Drawing_LineTypography; + /** * @brief Defines an OH_Drawing_TextStyle, which is used to manage text colors and decorations. * @@ -125,6 +133,30 @@ typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; */ typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; +/** + * @brief Defines an OH_Drawing_TextTab, which is used to to store the tab alignment type and position. + * + * @since 18 + * @version 1.0 + */ +typedef struct OH_Drawing_TextTab OH_Drawing_TextTab; + +/** + * @brief Defines an OH_Drawing_TextLine, which is used to manage text line. + * + * @since 18 + * @version 1.0 + */ +typedef struct OH_Drawing_TextLine OH_Drawing_TextLine; + +/** + * @brief Defines an OH_Drawing_Run, which is used to manage run. + * + * @since 18 + * @version 1.0 + */ +typedef struct OH_Drawing_Run OH_Drawing_Run; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h b/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h new file mode 100644 index 0000000000000000000000000000000000000000..e89a96b06dcf0679b729f05f3879325e3c2fc971 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2021-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 Drawing + * @{ + * + * @brief Provides the font descriptor capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 14 + * @version 1.0 + */ + +/** + * @file drawing_text_font_descriptor.h + * + * @brief Provide the ability to provide OH_Drawing_FontDescriptor. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 14 + * @version 1.0 + */ + +#ifndef DRAWING_TEXT_FONT_DESCRIPTOR_H +#define DRAWING_TEXT_FONT_DESCRIPTOR_H + +#include "drawing_text_typography.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief An enumeration of system font types. + * + * @since 14 + */ +typedef enum { + /** All font types */ + ALL = 1 << 0, + /** System generic font type */ + GENERIC = 1 << 1, + /** Stylish font type */ + STYLISH = 1 << 2, + /** Installed font types */ + INSTALLED = 1 << 3, + /** + * Customized font types + * @since 18 + */ + CUSTOMIZED = 1 << 4, +} OH_Drawing_SystemFontType; + +/** + * @brief Obtain all system font descriptive symbols that match the specified font descriptor. Where the 'path' + * fields are not considered as valid matching values, It takes effect when the remaining fields are not + * default values, If all the fields of the parameters OH_Drawing_FontDescriptor are default, obtain all system + * font descriptors. If the match fails, return nullptr. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param desc The pointer to the OH_Drawing_FontDescriptor object. It is recommended to + * use OH_Drawing_CreateFontDescriptor to obtain a valid OH_Drawing_FontDescriptor instance. + * If you create your own OH_Drawing_FontDescriptor object, ensure that fields not intended for matching are + * set to their default values. + * @param num Indicates the count of obtained OH_Drawing_FontDescriptor. + * @return Returns an array of OH_Drawing_FontDescriptor. Released through the + * OH_Drawing_DestroyFontDescriptors interface after use. + * @since 18 + */ +OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors(OH_Drawing_FontDescriptor* desc, size_t* num); + +/** + * @brief Releases the OH_Drawing_FontDescriptor array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param descriptors OH_Drawing_FontDescriptor object array. + * @param num Represents the number of members of the OH_Drawing_FontDescriptor array. + * @since 18 + */ +void OH_Drawing_DestroyFontDescriptors(OH_Drawing_FontDescriptor* descriptors, size_t num); + +/** + * @brief Get the OH_Drawing_FontDescriptor object by the font full name and the font type, supporting generic + * fonts, stylish fonts, and installed fonts. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fullName Indicates the full name object OH_Drawing_String. + * @param fontType Indicates enumerates of system font type object OH_Drawing_SystemFontType. + * @return Returns the pointer to a font descriptor object OH_Drawing_FontDescriptor. + * @since 14 + */ +OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName(const OH_Drawing_String* fullName, + OH_Drawing_SystemFontType fontType); + +/** + * @brief Obtain the corresponding font full name array by the font type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fontType Indicates enumerates of system font type object OH_Drawing_SystemFontType. + * @return Returns the pointer to full name array object OH_Drawing_Array. + * @since 14 + */ +OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType(OH_Drawing_SystemFontType fontType); + +/** + * @brief Get the specified full name object OH_Drawing_String by index from the + * OH_Drawing_Array object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fullNameArray Indicates an array of full name object OH_Drawing_Array. + * @param index The index of full name. + * @return Returns a full name object OH_Drawing_String. + * @since 14 + */ +const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Array* fullNameArray, size_t index); + +/** + * @brief Releases the memory occupied by an array of font full names. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param fullNameArray Indicates an array of full name object OH_Drawing_Array. + * @since 14 + */ +void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array* fullNameArray); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/graphic/graphic_2d/native_drawing/drawing_text_line.h b/graphic/graphic_2d/native_drawing/drawing_text_line.h new file mode 100644 index 0000000000000000000000000000000000000000..ca57c57d83b7ec0443d454d28b4c5d7fefce90bd --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_line.h @@ -0,0 +1,279 @@ +/* + * 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 Drawing + * @{ + * + * @brief Provides the 2D drawing capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 18 + * @version 1.0 + */ + +/** + * @file drawing_text_line.h + * + * @brief Declares functions related to textLine in the drawing module. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 18 + * @version 1.0 + */ + +#ifndef C_INCLUDE_DRAWING_TEXT_LINE_H +#define C_INCLUDE_DRAWING_TEXT_LINE_H + +#include "drawing_text_declaration.h" +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Get text line information. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @return Indicates the pointer to a text line array object OH_Drawing_Array. + * @since 18 + */ +OH_Drawing_Array* OH_Drawing_TypographyGetTextLines(OH_Drawing_Typography* typography); + +/** + * @brief Releases the memory occupied by the text line array object OH_Drawing_Array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param lines Indicates the pointer to the text line array object OH_Drawing_Array. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_DestroyTextLines(OH_Drawing_Array* lines); + +/** + * @brief Releases the memory occupied by the text line object OH_Drawing_TextLine. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to the text line object OH_Drawing_TextLine. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_DestroyTextLine(OH_Drawing_TextLine* line); + +/** + * @brief Get the text line object by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param lines Indicates the pointer to the text line array object OH_Drawing_Array. + * @param index The text line object index. + * @return Indicates the pointer to a text line object OH_Drawing_TextLine. + * @since 18 + */ +OH_Drawing_TextLine* OH_Drawing_GetTextLineByIndex(OH_Drawing_Array* lines, size_t index); + +/** + * @brief Get the count of glyphs. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @return Returns the count of glyphs. + * @since 18 + * @version 1.0 + */ +double OH_Drawing_TextLineGetGlyphCount(OH_Drawing_TextLine* line); + +/** + * @brief Get the range of text line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param start Indicates the pointer to text line start position. + * @param end Indicates the pointer to text line end position. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_TextLineGetTextRange(OH_Drawing_TextLine* line, size_t* start, size_t* end); + +/** + * @brief Get the glyph runs array of text line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @return Indicates the pointer to a glyph runs array object of text line OH_Drawing_Array. + * @since 18 + * @version 1.0 + */ +OH_Drawing_Array* OH_Drawing_TextLineGetGlyphRuns(OH_Drawing_TextLine* line); + +/** + * @brief Releases the memory occupied by the run array object OH_Drawing_Array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param runs Indicates the pointer to the run array object OH_Drawing_Array. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_DestroyRuns(OH_Drawing_Array* runs); + +/** + * @brief Get the run object by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param runs Indicates the pointer to the run array object OH_Drawing_Array. + * @param index The run object index. + * @return Indicates the pointer to a run object OH_Drawing_Run. + * @since 18 + */ +OH_Drawing_Run* OH_Drawing_GetRunByIndex(OH_Drawing_Array* runs, size_t index); + +/** + * @brief Paint the range of text line. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param x Represents the X-axis position on the canvas. + * @param y Represents the Y-axis position on the canvas. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_TextLinePaint(OH_Drawing_TextLine* line, OH_Drawing_Canvas* canvas, double x, double y); + +/** + * @brief Creates a truncated text line object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param width Indicates the text line width to set. + * @param mode Indicates the ellipsis model to set, EllipsisMode:MIDDLE is not supported. + * For details, see the enum OH_Drawing_EllipsisModal. + * @param ellipsis Indicates the ellipsis string to set. + * @return Returns the pointer to the OH_Drawing_TextLine object created. + * @since 18 + * @version 1.0 + */ +OH_Drawing_TextLine* OH_Drawing_TextLineCreateTruncatedLine(OH_Drawing_TextLine* line, double width, int mode, + const char* ellipsis); + +/** + * @brief Gets the text line typographic bounds. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param ascent Indicates the distance that the pointer points to remain above the baseline. + * @param descent Indicates the pointer to the distance that remains below the baseline. + * @param leading Indicates the pointer to the line Spacing. + * @return Returns The total width of the typesetting border. + * @since 18 + * @version 1.0 + */ +double OH_Drawing_TextLineGetTypographicBounds(OH_Drawing_TextLine* line, double* ascent, double* descent, + double* leading); + +/** + * @brief Gets the text line image bounds. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @return Returns the pointer to the OH_Drawing_Rect struct created. + * @since 18 + * @version 1.0 + */ +OH_Drawing_Rect* OH_Drawing_TextLineGetImageBounds(OH_Drawing_TextLine* line); + +/** + * @brief Gets the tail space width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @return Returns the tail space width. + * @since 18 + * @version 1.0 + */ +double OH_Drawing_TextLineGetTrailingSpaceWidth(OH_Drawing_TextLine* line); + +/** + * @brief Gets the string index of the given position. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param point Indicates the pointer to an OH_Drawing_Point object. + * @return Returns the string index for a given position. + * @since 18 + */ +int32_t OH_Drawing_TextLineGetStringIndexForPosition(OH_Drawing_TextLine* line, OH_Drawing_Point* point); + +/** + * @brief Gets the offset of the given string index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param index The given string index. + * @return Returns the offset for a given string index. + * @since 18 + */ +double OH_Drawing_TextLineGetOffsetForStringIndex(OH_Drawing_TextLine* line, int32_t index); + +/** + * @brief User-defined callback functions for using offsets and indexes. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param offset Character offset is traversed as an argument to the callback function. + * @param index Character index is traversed as an argument to the callback function. + * @param leadingEdge Whether the current offset is at the character front, as an argument to the callback function. + * @return The return value of the user-defined callback function. + * If false is returned, the traversal continues. + * If true is returned, the traversal stops. + * @since 18 + * @version 1.0 + */ +typedef bool (*Drawing_CaretOffsetsCallback)(double offset, int32_t index, bool leadingEdge); + +/** + * @brief Enumerate caret offset and index in text lines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param callback User-defined callback functions, see Drawing_CaretOffsetsCallback. + * @since 18 + */ +void OH_Drawing_TextLineEnumerateCaretOffsets(OH_Drawing_TextLine* line, Drawing_CaretOffsetsCallback callback); + +/** + * @brief Gets the text offset based on the given alignment factor and alignment width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param line Indicates the pointer to an OH_Drawing_TextLine object. + * @param alignmentFactor The coefficients that text needs to be aligned. + * Less than or equal to 0 is left justified, 0.5 is center justified, + * and greater than or equal to 1 is right justified. + * @param alignmentWidth The width of the text to be aligned. + * Returns 0 if it is less than the actual width of the text. + * @return Returns the offset of the aligned text. + * @since 18 + * @version 1.0 + */ +double OH_Drawing_TextLineGetAlignmentOffset(OH_Drawing_TextLine* line, double alignmentFactor, double alignmentWidth); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // C_INCLUDE_DRAWING_TEXT_LINE_H \ No newline at end of file diff --git a/graphic/graphic_2d/native_drawing/drawing_text_lineTypography.h b/graphic/graphic_2d/native_drawing/drawing_text_lineTypography.h new file mode 100644 index 0000000000000000000000000000000000000000..1d594b13c3be395f4dd2406f6d2afd6010d0f772 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_lineTypography.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd.. 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. + */ + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the 2D drawing capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 18 + * @version 1.0 + */ + +/** + * @file drawing_text_linetypography.h + * + * @brief Declares functions related to lineTypography in the drawing module. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 18 + * @version 1.0 + */ + +#ifndef DRAWING_TEXT_LINETYPOGRAPHY_H +#define DRAWING_TEXT_LINETYPOGRAPHY_H + +#include "drawing_text_declaration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_LineTypography object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @return Returns the pointer to the OH_Drawing_LineTypography object created. + * @since 18 + */ +OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler); + +/** + * @brief Releases the memory occupied by an OH_Drawing_LineTypography object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param lineTypography Indicates the pointer to an OH_Drawing_LineTypography object. + * @since 18 + */ +void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography); + +/** + * @brief Calculate the line breakpoint based on the width provided. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param lineTypography Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param startIndex Indicates the starting point for the line-break calculations. + * @param width Indicates the requested line-break width. + * @return Returns the count of the characters from startIndex that would cause the line break. + * @since 18 + */ +size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography, + size_t startIndex, double width); + +/** + * @brief Creates a text line object based on the text range provided. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param lineTypography Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param startIndex Indicates the starting index of the text range. + * @param count Indicates the characters count of the text range. + * @return Returns the pointer to the OH_Drawing_TextLine object created. + * @since 18 + */ +OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography, + size_t startIndex, size_t count); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_run.h b/graphic/graphic_2d/native_drawing/drawing_text_run.h new file mode 100644 index 0000000000000000000000000000000000000000..8873eaaf23e7389d04a20395f7281ebdd6a0ba39 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_run.h @@ -0,0 +1,215 @@ +/* + * 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 Drawing + * @{ + * + * @brief Provides the text run capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 18 + * @version 1.0 + */ + +/** + * @file drawing_text_run.h + * + * @brief Declares functions related to run in the drawing module. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 18 + * @version 1.0 + */ + +#ifndef C_INCLUDE_DRAWING_TEXT_RUN_H +#define C_INCLUDE_DRAWING_TEXT_RUN_H + +#include "drawing_text_declaration.h" +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif +/** + * @brief Gets the run glyph indices ,the offset of the index relative to the entire paragraph. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param start The run of start index. + * @param length The run of length, if start and length are set to 0, then get all of the current run. + * @return Run of glyph indices array object OH_Drawing_Array. + * @since 18 + */ +OH_Drawing_Array* OH_Drawing_GetRunStringIndices(OH_Drawing_Run* run, int64_t start, int64_t length); + +/** + * @brief Gets the run glyph indices by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param stringIndices the run glyph indices array object OH_Drawing_Array. + * @param index The run of glyph index. + * @return Run of glyph indices element. + * @since 18 + */ +uint64_t OH_Drawing_GetRunStringIndicesByIndex(OH_Drawing_Array* stringIndices, size_t index); + +/** + * @brief Releases the memory run glyph indices array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param stringIndices glyph indices array object OH_Drawing_Array. + * @since 18 + */ +void OH_Drawing_DestroyRunStringIndices(OH_Drawing_Array* stringIndices); + +/** + * @brief Gets the range run glyph location and length. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param location The run of glyph location. + * @param length The run of glyph length. + * @since 18 + */ +void OH_Drawing_GetRunStringRange(OH_Drawing_Run* run, uint64_t* location, uint64_t* length); + +/** + * @brief Gets the run typographic bound. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param ascent The run of ascent. + * @param descent The run of descent. + * @param leading The run of leading. + * @return run typographic width. + * @since 18 + */ +float OH_Drawing_GetRunTypographicBounds(OH_Drawing_Run* run, float* ascent, float* descent, float* leading); + +/** + * @brief Paints text on the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param x Indicates the x coordinate. + * @param y Indicates the y coordinate. + * @since 18 + */ +void OH_Drawing_RunPaint(OH_Drawing_Canvas* canvas, OH_Drawing_Run* run, double x, double y); + +/** + * @brief Gets the run image bound. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @return The run image bounds to an OH_Drawing_Rect object. + * @since 18 + */ +OH_Drawing_Rect* OH_Drawing_GetRunImageBounds(OH_Drawing_Run* run); + + /** + * @brief Releases the memory run image bounds pointer. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param rect Run image bounds to an OH_Drawing_Rect object. + * @since 18 + */ +void OH_Drawing_DestroyRunImageBounds(OH_Drawing_Rect* rect); + +/** + * @brief Gets the range glyph identifier for each character. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param start The run of start index. + * @param length The run of length, if start and length are set to 0, then get all of the current run. + * @return Run of glyph array object OH_Drawing_ArrayOH_Drawing_Array. + * @param index The run of glyph index. + * @return Run of glyph element. + * @since 18 + * @version 1.0 + */ +uint16_t OH_Drawing_GetRunGlyphsByIndex(OH_Drawing_Array* glyphs, size_t index); + +/** + * @brief Releases the memory run glyph array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param glyphs The run of glyph array object OH_Drawing_Array. + * @since 18 + */ +void OH_Drawing_DestroyRunGlyphs(OH_Drawing_Array* glyphs); + +/** + * @brief Gets the range glyph position array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @param start The run of start index. + * @param length The run of length, if start and length are set to 0, then get all of the current run. + * @return Run of position array object OH_Drawing_Array. + * @since 18 + */ +OH_Drawing_Array* OH_Drawing_GetRunPositions(OH_Drawing_Run* run, int64_t start, int64_t length); + +/** + * @brief Gets the glyph position by index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param positions The run of position array object OH_Drawing_Array. + * @param index The run of glyph index. + * @return Run of glyph position pointer to an OH_Drawing_Point object. + * @since 18 + * @version 1.0 + */ +OH_Drawing_Point* OH_Drawing_GetRunPositionsByIndex(OH_Drawing_Array* positions, size_t index); + +/** + * @brief Releases the memory run of position array. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param positions The run of position array object OH_Drawing_Array. + * @since 18 + */ +void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions); + +/** + * @brief Gets the number of glyph. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @return The number of glyph. + * @since 18 + */ +uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // C_INCLUDE_DRAWING_TEXT_RUN_H diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index e4546ed6c55aa81547e3f2f9732506a6b4002859..9666217288d549c081114e2ed343c13d6a8f6973 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H -#define C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H - /** * @addtogroup Drawing * @{ @@ -40,14 +37,22 @@ * @version 1.0 */ -#include "cstddef" +#ifndef C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H +#define C_INCLUDE_DRAWING_TEXT_TYPOGRAPHY_H + +#ifdef __cplusplus +#include +#include +#else +#include +#include +#endif #include "drawing_canvas.h" #include "drawing_color.h" #include "drawing_font.h" #include "drawing_text_declaration.h" #include "drawing_types.h" -#include "stdint.h" #ifdef __cplusplus extern "C" { @@ -55,6 +60,9 @@ extern "C" { /** * @brief Enumerates text directions. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_TextDirection { /** Right to left (RTL) */ @@ -65,6 +73,9 @@ enum OH_Drawing_TextDirection { /** * @brief Enumerates text alignment modes. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_TextAlign { /** Left-aligned */ @@ -96,6 +107,9 @@ enum OH_Drawing_TextAlign { /** * @brief Enumerates font weights. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_FontWeight { /** Thin */ @@ -120,6 +134,9 @@ enum OH_Drawing_FontWeight { /** * @brief Enumerates text baselines. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_TextBaseline { /** Alphabetic, where the letters in alphabets like English sit on. */ @@ -130,6 +147,9 @@ enum OH_Drawing_TextBaseline { /** * @brief Enumerates text decorations. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_TextDecoration { /** No decoration. */ @@ -144,6 +164,9 @@ enum OH_Drawing_TextDecoration { /** * @brief Enumerates font styles. + * + * @since 8 + * @version 1.0 */ enum OH_Drawing_FontStyle { /** Normal style */ @@ -256,6 +279,11 @@ typedef enum { WORD_BREAK_TYPE_BREAK_ALL = 1, /** Break Word type */ WORD_BREAK_TYPE_BREAK_WORD = 2, + /** + * Break word with hyphens + * @since 18 + */ + WORD_BREAK_TYPE_BREAK_HYPHEN = 3, } OH_Drawing_WordBreakType; /** @@ -620,44 +648,44 @@ OH_Drawing_TypographyStyle* OH_Drawing_CreateTypographyStyle(void); * @brief Releases the memory occupied by an OH_Drawing_TypographyStyle object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @since 8 * @version 1.0 */ -void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle*); +void OH_Drawing_DestroyTypographyStyle(OH_Drawing_TypographyStyle* style); /** * @brief Sets the text direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the text direction to set. For details, see the enum OH_Drawing_TextDirection. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param direction Indicates the text direction to set. For details, see the enum OH_Drawing_TextDirection. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextDirection */); +void OH_Drawing_SetTypographyTextDirection(OH_Drawing_TypographyStyle* style, int direction); /** * @brief Sets the text alignment mode. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the text alignment mode to set. For details, see the enum OH_Drawing_TextAlign. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param align Indicates the text alignment mode to set. For details, see the enum OH_Drawing_TextAlign. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle*, int /* OH_Drawing_TextAlign */); +void OH_Drawing_SetTypographyTextAlign(OH_Drawing_TypographyStyle* style, int align); /** * @brief Sets the maximum number of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the maximum number of lines to set. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param lineNumber Indicates the maximum number of lines to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle*, int /* maxLines */); +void OH_Drawing_SetTypographyTextMaxLines(OH_Drawing_TypographyStyle* style, int lineNumber); /** * @brief Creates an OH_Drawing_TextStyle object. @@ -673,349 +701,372 @@ OH_Drawing_TextStyle* OH_Drawing_CreateTextStyle(void); * @brief Releases the memory occupied by an OH_Drawing_TextStyle object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @since 8 * @version 1.0 */ -void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle*); +void OH_Drawing_DestroyTextStyle(OH_Drawing_TextStyle* style); /** * @brief Sets the text color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param uint32_t Indicates the color to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param color Indicates the color to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle*, uint32_t /* color */); +void OH_Drawing_SetTextStyleColor(OH_Drawing_TextStyle* style, uint32_t color); /** * @brief Sets the font size. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param double Indicates the font size to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontSize Indicates the font size to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle*, double /* fontSize */); +void OH_Drawing_SetTextStyleFontSize(OH_Drawing_TextStyle* style, double fontSize); /** * @brief Sets the font weight. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the font weight to set. For details, see the enum OH_Drawing_FontWeight. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontWeight Indicates the font weight to set. For details, see the enum OH_Drawing_FontWeight. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle*, int /* OH_Drawing_FontWeight */); +void OH_Drawing_SetTextStyleFontWeight(OH_Drawing_TextStyle* style, int fontWeight); /** * @brief Sets the text baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the text baseline to set. For details, see the enum OH_Drawing_TextBaseline. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param baseline Indicates the text baseline to set. For details, see the enum OH_Drawing_TextBaseline. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle*, int /* OH_Drawing_TextBaseline */); +void OH_Drawing_SetTextStyleBaseLine(OH_Drawing_TextStyle* style, int baseline); /** * @brief Sets the text decoration. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the text decoration to set. For details, see the enum OH_Drawing_TextDecoration. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param decoration Indicates the text decoration to set. For details, see the enum OH_Drawing_TextDecoration. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle*, int /* OH_Drawing_TextDecoration */); +void OH_Drawing_SetTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); + +/** + * @brief Add the text decoration. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param decoration Indicates the text decoration to add. For details, see the enum OH_Drawing_TextDecoration. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_AddTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); + +/** + * @brief Remove the text decoration. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param decoration Indicates the text decoration to remove, shoud be match existing text decorations. + * For details, see the enum OH_Drawing_TextDecoration. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_RemoveTextStyleDecoration(OH_Drawing_TextStyle* style, int decoration); /** * @brief Sets the color for the text decoration. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param uint32_t Indicates the color to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param color Indicates the color to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle*, uint32_t /* color */); +void OH_Drawing_SetTextStyleDecorationColor(OH_Drawing_TextStyle* style, uint32_t color); /** * @brief Sets the font height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param double Indicates the font height to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontHeight Indicates the font height to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle*, double /* fontHeight */); +void OH_Drawing_SetTextStyleFontHeight(OH_Drawing_TextStyle* style, double fontHeight); /** * @brief Sets the font families. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the number of font families to set. - * @param char Indicates the pointer to the font families to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontFamiliesNumber Indicates the number of font families to set. + * @param fontFamilies Indicates the pointer to the font families to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle*, - int /* fontFamiliesNumber */, const char* fontFamilies[]); +void OH_Drawing_SetTextStyleFontFamilies(OH_Drawing_TextStyle* style, + int fontFamiliesNumber, const char* fontFamilies[]); /** * @brief Sets the font style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the font style to set. For details, see the enum OH_Drawing_FontStyle. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontStyle Indicates the font style to set. For details, see the enum OH_Drawing_FontStyle. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_FontStyle */); +void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle* style, int fontStyle); /** * @brief Sets the locale. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param char Indicates the pointer to the locale to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param locale Indicates the pointer to the locale to set. * @since 8 * @version 1.0 */ -void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*); +void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle* style, const char* locale); /** * @brief Sets the foreground brush style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param foregroundBrush Indicates the pointer to a brush object OH_Drawing_Brush. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); +void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundBrush); /** * @brief Gets the foreground brush style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param foregroundBrush Indicates the pointer to a brush object OH_Drawing_Brush. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); +void OH_Drawing_TextStyleGetForegroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundBrush); /** * @brief Sets the foreground pen style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param foregroundPen Indicates the pointer to a pen object OH_Drawing_Pen. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); +void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* foregroundPen); /** * @brief Gets the foreground pen style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param foregroundPen Indicates the pointer to a pen object OH_Drawing_Pen. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); +void OH_Drawing_TextStyleGetForegroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* foregroundPen); /** * @brief Sets the background brush style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param foregroundPen Indicates the pointer to a brush object OH_Drawing_Brush. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); +void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* foregroundPen); /** * @brief Gets the background brush style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Brush Indicates the pointer to a brush object OH_Drawing_Brush. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param backgroundBrush Indicates the pointer to a brush object OH_Drawing_Brush. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*); +void OH_Drawing_TextStyleGetBackgroundBrush(OH_Drawing_TextStyle* style, OH_Drawing_Brush* backgroundBrush); /** * @brief Sets the background pen style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param backgroundPen Indicates the pointer to a pen object OH_Drawing_Pen. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); +void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* backgroundPen); /** * @brief Gets the background pen style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Pen Indicates the pointer to a pen object OH_Drawing_Pen. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param backgroundPen Indicates the pointer to a pen object OH_Drawing_Pen. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*); +void OH_Drawing_TextStyleGetBackgroundPen(OH_Drawing_TextStyle* style, OH_Drawing_Pen* backgroundPen); /** * @brief Creates a pointer to an OH_Drawing_TypographyCreate object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param OH_Drawing_FontCollection Indicates the pointer to an OH_Drawing_FontCollection object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param fontCollection Indicates the pointer to an OH_Drawing_FontCollection object. * @return Returns the pointer to the OH_Drawing_TypographyCreate object created. * @since 8 * @version 1.0 */ -OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_TypographyStyle*, - OH_Drawing_FontCollection*); +OH_Drawing_TypographyCreate* OH_Drawing_CreateTypographyHandler(OH_Drawing_TypographyStyle* style, + OH_Drawing_FontCollection* fontCollection); /** * @brief Releases the memory occupied by an OH_Drawing_TypographyCreate object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. * @since 8 * @version 1.0 */ -void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate*); +void OH_Drawing_DestroyTypographyHandler(OH_Drawing_TypographyCreate* handler); /** * @brief Sets the text style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @since 8 * @version 1.0 */ -void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate*, OH_Drawing_TextStyle*); +void OH_Drawing_TypographyHandlerPushTextStyle(OH_Drawing_TypographyCreate* handler, OH_Drawing_TextStyle* style); /** * @brief Sets the text content. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. - * @param char Indicates the pointer to the text content to set. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param text Indicates the pointer to the text content to set. * @since 8 * @version 1.0 */ -void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate*, const char*); +void OH_Drawing_TypographyHandlerAddText(OH_Drawing_TypographyCreate* handler, const char* text); /** * @brief Removes the topmost style in the stack, leaving the remaining styles in effect. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. * @since 8 * @version 1.0 */ -void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate*); +void OH_Drawing_TypographyHandlerPopTextStyle(OH_Drawing_TypographyCreate* handler); /** * @brief Creates an OH_Drawing_Typography object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. * @return Returns the pointer to the OH_Drawing_Typography object created. * @since 8 * @version 1.0 */ -OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate*); +OH_Drawing_Typography* OH_Drawing_CreateTypography(OH_Drawing_TypographyCreate* handler); /** * @brief Releases the memory occupied by an OH_Drawing_Typography object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @since 8 * @version 1.0 */ -void OH_Drawing_DestroyTypography(OH_Drawing_Typography*); +void OH_Drawing_DestroyTypography(OH_Drawing_Typography* typography); /** * @brief Lays out the typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param double Indicates the maximum text width to set. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param maxWidth Indicates the maximum text width to set. * @since 8 * @version 1.0 */ -void OH_Drawing_TypographyLayout(OH_Drawing_Typography*, double /* maxWidth */); +void OH_Drawing_TypographyLayout(OH_Drawing_Typography* typography, double maxWidth); /** * @brief Paints text on the canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param double Indicates the x coordinate. - * @param double Indicates the y coordinate. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param potisionX Indicates the x coordinate. + * @param potisionY Indicates the y coordinate. * @since 8 * @version 1.0 */ -void OH_Drawing_TypographyPaint(OH_Drawing_Typography*, OH_Drawing_Canvas*, - double /* potisionX */, double /* potisionY */); +void OH_Drawing_TypographyPaint(OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, + double potisionX, double potisionY); /** * @brief Paints path text on the canvas. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. - * @param OH_Drawing_Path Indicates path information. - * @param double Indicates the distance along the path to add to the text's starting position. - * @param double Indicates the distance above(-) or below(+) the path to position the text. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param path Indicates path information. + * @param hOffset Indicates the distance along the path to add to the text's starting position. + * @param vOffset Indicates the distance above(-) or below(+) the path to position the text. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyPaintOnPath(OH_Drawing_Typography*, OH_Drawing_Canvas*, OH_Drawing_Path*, - double /* hOffset */, double /* vOffset */); +void OH_Drawing_TypographyPaintOnPath(OH_Drawing_Typography* typography, OH_Drawing_Canvas* canvas, + OH_Drawing_Path* path, double hOffset, double vOffset); /** * @brief Gets the max width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the max width. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetMaxWidth(OH_Drawing_Typography* typography); /** * @brief Gets the height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the height. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography* typography); /** * @brief Obtains the width of the longest line. You are advised to round up the return value in actual use. @@ -1023,13 +1074,13 @@ double OH_Drawing_TypographyGetHeight(OH_Drawing_Typography*); * that is, -340282346638528859811704183484516925440.000000, is returned. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param typography Pointer to an OH_Drawing_Typography object, which is obtained by * {@link OH_Drawing_CreateTypography}. * @return Returns the width of the longest line. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography* typography); /** * @brief Obtains the width of the longest line with indent. You are advised to @@ -1037,422 +1088,423 @@ double OH_Drawing_TypographyGetLongestLine(OH_Drawing_Typography*); * minimum float value, that is, 0.0, is returned. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Pointer to an OH_Drawing_Typography object, which is obtained by + * @param typography Pointer to an OH_Drawing_Typography object, which is obtained by * {@link OH_Drawing_CreateTypography}. * @return Returns the width of the longest line with indent. * @since 13 * @version 1.1 */ -double OH_Drawing_TypographyGetLongestLineWithIndent(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetLongestLineWithIndent(OH_Drawing_Typography* typography); /** * @brief Gets the min intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography the pointer to an OH_Drawing_Typography object. * @return Returns the min intrinsic width. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetMinIntrinsicWidth(OH_Drawing_Typography* typography); /** * @brief Gets the max intrinsic width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the max intrinsic width. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetMaxIntrinsicWidth(OH_Drawing_Typography* typography); /** * @brief Gets the alphabetic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the alphabetic baseline. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography* typography); /** * @brief Gets the ideographic baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the ideographic baseline. * @since 9 * @version 1.1 */ -double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography* typography); /** * @brief Sets the placeholder. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. - * @param OH_Drawing_PlaceholderSpan Indicates the pointer to an OH_Drawing_PlaceholderSpan object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param span Indicates the pointer to an OH_Drawing_PlaceholderSpan object. * @since 11 * @version 1.0 */ -void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); +void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate* handler, OH_Drawing_PlaceholderSpan* span); /** * @brief Gets the exceed maxLines. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the exceed maxLines. * @since 11 * @version 1.0 */ -bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); +bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography* typography); /** * @brief Gets the rects for range. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param size_t Indicates the start of range to set. - * @param size_t Indicates the end of range to set. - * @param OH_Drawing_RectHeightStyle Indicates the height style to set. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param start Indicates the start of range to set. + * @param end Indicates the end of range to set. + * @param heightStyle Indicates the height style to set. * For details, see the enum OH_Drawing_RectHeightStyle. - * @param OH_Drawing_RectWidthStyle Indicates the width style to set. + * @param widthStyle Indicates the width style to set. * For details, see the enum OH_Drawing_RectWidthStyle. * @return Returns the rects for range. * @since 11 * @version 1.0 */ -OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*, - size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* typography, + size_t start, size_t end, OH_Drawing_RectHeightStyle heightStyle, OH_Drawing_RectWidthStyle widthStyle); /** * @brief Gets the rects for placeholders. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the rects for placeholders. * @since 11 * @version 1.0 */ -OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography* typography); /** * @brief Gets left from textbox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @param int Indicates the index of textbox. + * @param textbox Indicates the pointer to an OH_Drawing_TextBox object. + * @param index Indicates the index of textbox. * @return Returns left from textbox. * @since 11 * @version 1.0 */ -float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); +float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox* textbox, int index); /** * @brief Gets right from textbox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @param int Indicates the index of textbox. + * @param textbox Indicates the pointer to an OH_Drawing_TextBox object. + * @param index Indicates the index of textbox. * @return Returns right from textbox. * @since 11 * @version 1.0 */ -float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); +float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox* textbox, int index); /** * @brief Gets top from textbox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @param int Indicates the index of textbox. + * @param textbox Indicates the pointer to an OH_Drawing_TextBox object. + * @param index Indicates the index of textbox. * @return Returns top from textbox. * @since 11 * @version 1.0 */ -float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); +float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox* textbox, int index); /** * @brief Gets bottom from textbox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @param int Indicates the index of textbox. + * @param textbox Indicates the pointer to an OH_Drawing_TextBox object. + * @param index Indicates the index of textbox. * @return Returns bottom from textbox. * @since 11 * @version 1.0 */ -float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); +float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox* textbox, int index); /** * @brief Gets direction from textbox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @param int Indicates the index of textbox. + * @param textbox Indicates the pointer to an OH_Drawing_TextBox object. + * @param index Indicates the index of textbox. * @return Returns direction from textbox. * @since 11 * @version 1.0 */ -int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); +int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox* textbox, int index); /** - * @brief Gets size of textbox. + * @brief Gets size of textBox. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. - * @return Returns size of textbox. + * @param textBox Indicates the pointer to an OH_Drawing_TextBox object. + * @return Returns size of textBox. * @since 11 * @version 1.0 */ -size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); +size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox* textBox); /** * @brief Gets the glyphposition at coordinate. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param double Indicates the positionX of typography to set. - * @param double Indicates the positionY of typography to set. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param dx Indicates the positionX of typography to set. + * @param dy Indicates the positionY of typography to set. * @return Returns the glyphposition at coordinate. * @since 11 * @version 1.0 */ -OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, - double, double); +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography* typography, + double dx, double dy); /** * @brief Gets the glyphposition at coordinate with cluster. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param double Indicates the positionX of typography to set. - * @param double Indicates the positionY of typography to set. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param dx Indicates the positionX of typography to set. + * @param dy Indicates the positionY of typography to set. * @return Returns the glyphposition at coordinate with cluster. * @since 11 * @version 1.0 */ -OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, - double, double); +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster( + OH_Drawing_Typography* typography, double dx, double dy); /** * @brief Gets position from position and affinity. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @param positionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. * @return Returns position from position and affinity. * @since 11 * @version 1.0 */ -size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); +size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity* positionAndAffinity); /** * @brief Gets affinity from position and affinity. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @param positionandaffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. * @return Returns affinity from position and affinity. * @since 11 * @version 1.0 */ -int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); +int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity* positionandaffinity); /** * @brief Gets the word boundary. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param size_t Indicates the size of text to set. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param offset Indicates the size of text to set. * @return Returns the word boundary. * @since 11 * @version 1.0 */ -OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); +OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography* typography, size_t offset); /** * @brief Gets start from range. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @param range Indicates the pointer to an OH_Drawing_Range object. * @return Returns start from range. * @since 11 * @version 1.0 */ -size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); +size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range* range); /** * @brief Gets end from range. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @param range Indicates the pointer to an OH_Drawing_Range object. * @return Returns end from range. * @since 11 * @version 1.0 */ -size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); +size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range* range); /** * @brief Gets the line count. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. * @return Returns the line count. * @since 11 * @version 1.0 */ -size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); +size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography* typography); /** * @brief Sets the decoration style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the text decoration style to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param decorationStyle Indicates the text decoration style to set. * For details, see the enum OH_Drawing_TextDecorationStyle. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); +void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle* style, int decorationStyle); /** * @brief Sets the decoration thickness scale. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param double Indicates the thickness scale of text decoration to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param decorationThicknessScale Indicates the thickness scale of text decoration to set. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); +void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle* style, double decorationThicknessScale); /** * @brief Sets the letter spacing. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param double Indicates the letter space to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param letterSpacing Indicates the letter space to set. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); +void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle* style, double letterSpacing); /** * @brief Sets the word spacing. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param double Indicates the word space to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param wordSpacing Indicates the word space to set. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); +void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle* style, double wordSpacing); /** * @brief Sets the half leading. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param bool Indicates the half leading to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param halfLeading Indicates the half leading to set. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); +void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle* style, bool halfLeading); /** * @brief Sets the ellipsis. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param char* Indicates the pointer to ellipsis style. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param ellipsis Indicates the pointer to ellipsis style. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle* style, const char* ellipsis); /** * @brief Sets the ellipsis modal. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the ellipsis model to set. For details, see the enum OH_Drawing_EllipsisModal. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param ellipsisModal Indicates the ellipsis model to set. For details, see the enum OH_Drawing_EllipsisModal. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); +void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle* style, int ellipsisModal); /** * @brief Sets the break strategy. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the break strategy to set. For details, see the enum OH_Drawing_BreakStrategy. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param breakStrategy Indicates the break strategy to set. For details, see the enum OH_Drawing_BreakStrategy. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle* style, int breakStrategy); /** * @brief Sets the word break type. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the word break type to set. For details, see the enum OH_Drawing_WordBreakType. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param wordBreakType Indicates the word break type to set. For details, see the enum OH_Drawing_WordBreakType. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle* style, int wordBreakType); /** * @brief Sets the ellipsis modal. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param int Indicates the ellipsis modal to set. For details, see the enum OH_Drawing_EllipsisModal. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param ellipsisModal Indicates the ellipsis modal to set. For details, see the enum OH_Drawing_EllipsisModal. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle* style, int ellipsisModal); /** * @brief get line height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param int Indicates the line number. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param lineNumber Indicates the line number. * @return Returns line height. * @since 11 * @version 1.0 */ -double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); +double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography* typography, int lineNumber); /** * @brief get line width. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param int Indicates the line number. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param lineNumber Indicates the line number. * @return Returns line width. * @since 11 * @version 1.0 */ -double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); +double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography* typography, int lineNumber); /** * @brief get line text range. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. - * @param int Indicates the line number. - * @param bool Indicates whether spaces are contained. + * @param typography Indicates the pointer to an OH_Drawing_Typography object. + * @param lineNumber Indicates the line number. + * @param includeSpaces Indicates whether spaces are contained. * @return Returns line text range. * @since 12 * @version 1.0 */ -OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); +OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography* typography, + int lineNumber, bool includeSpaces); /** * @brief Creates an OH_Drawing_FontDescriptor object. @@ -1468,11 +1520,11 @@ OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void); * @brief Releases the memory occupied by an OH_Drawing_FontDescriptor object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontDescriptor the pointer to the font descriptor object OH_Drawing_FontDescriptor. + * @param descriptor the pointer to the font descriptor object OH_Drawing_FontDescriptor. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*); +void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor* descriptor); /** * @brief Creates an OH_Drawing_FontParser object. @@ -1488,401 +1540,405 @@ OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void); * @brief Releases the memory occupied by an OH_Drawing_FontParser object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @param parser Indicates the pointer to the font parser object OH_Drawing_FontParser. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*); +void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser* parser); /** * @brief Gets a list of system font names. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. - * @param size_t Returns the number of obtained system font names. + * @param fontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @param num Returns the number of obtained system font names. * @return Returns a list of obtained system fonts. * @since 12 * @version 1.0 */ -char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); +char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser* fontParser, size_t* num); /** * @brief Releases the memory occupied by a list of system font names. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param char** Indicates the pointer to a list of system font names. - * @param size_t The number of obtained system font names. + * @param fontList Indicates the pointer to a list of system font names. + * @param num The number of obtained system font names. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroySystemFontList(char**, size_t); +void OH_Drawing_DestroySystemFontList(char** fontList, size_t num); /** * @brief Gets information about the system font by font name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. - * @param char** font name. + * @param fontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. + * @param name font name. * @return Returns system fonts information. * @since 12 * @version 1.0 */ -OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser*, const char*); +OH_Drawing_FontDescriptor* OH_Drawing_FontParserGetFontByName(OH_Drawing_FontParser* fontParser, const char* name); /** * @brief Get line metrics information. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. * @return Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. * @since 12 * @version 1.0 */ -OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography*); +OH_Drawing_LineMetrics* OH_Drawing_TypographyGetLineMetrics(OH_Drawing_Typography* typography); /** * @brief Get the number of lines. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. + * @param lineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. * @return Returns the number of lines. * @since 12 * @version 1.0 */ -size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics*); +size_t OH_Drawing_LineMetricsGetSize(OH_Drawing_LineMetrics* lineMetrics); /** * @brief Releases the memory occupied by line metrics. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_LineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. + * @param lineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics*); +void OH_Drawing_DestroyLineMetrics(OH_Drawing_LineMetrics* lineMetrics); /** * @brief Gets the specified line by line number. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param int Line number. - * @param OH_Drawing_LineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param lineNumber Line number. + * @param lineMetric Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. * @return Whether the line metrics was obtained. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography*, int, OH_Drawing_LineMetrics*); +bool OH_Drawing_TypographyGetLineMetricsAt(OH_Drawing_Typography* typography, + int lineNumber, OH_Drawing_LineMetrics* lineMetric); /** * @brief Sets the ellipsis of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param char Indicates the line textellipsis. + * @param style Indicates the pointer to a typography object OH_Drawing_Typography. + * @param ellipsis Indicates the line textellipsis. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle*, const char*); +void OH_Drawing_SetTypographyTextEllipsis(OH_Drawing_TypographyStyle* style, const char* ellipsis); /** * @brief Sets the locale of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param char Indicates the pointer to the locale to set. + * @param locale Indicates the pointer to the locale to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle*, const char*); +void OH_Drawing_SetTypographyTextLocale(OH_Drawing_TypographyStyle* style, const char* locale); /** * @brief Sets the textSplitRatio of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param float Indicates the textSplitRatio of lines to set. + * @param textSplitRatio Indicates the textSplitRatio of lines to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle*, float); +void OH_Drawing_SetTypographyTextSplitRatio(OH_Drawing_TypographyStyle* style, float textSplitRatio); /** * @brief Gets the TextStyle of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Returns line text textstyle. * @since 12 * @version 1.0 */ -OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle*); +OH_Drawing_TextStyle* OH_Drawing_TypographyGetTextStyle(OH_Drawing_TypographyStyle* style); /** * @brief Gets the EffectiveAlign of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Returns line text align. * @since 12 * @version 1.0 */ -int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle*); +int OH_Drawing_TypographyGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); /** * @brief Gets the UnlimitedLines of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Returns whether the text has a maximum line limit, * with true indicating a maximum line limit and false indicating no maximum line limit. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyIsLineUnlimited(OH_Drawing_TypographyStyle* style); /** * @brief Gets the IsEllipsized of lines in a text file. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Returns whether the text has ellipsis, * true meaning there is an ellipsis and false meaning there is no ellipsis. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyIsEllipsized(OH_Drawing_TypographyStyle* style); /** * @brief set line textstyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param handler Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle*, OH_Drawing_TextStyle*); +void OH_Drawing_SetTypographyTextStyle(OH_Drawing_TypographyStyle* handler, OH_Drawing_TextStyle* style); /** * @brief get line fontmetrics. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_Font_Metrics Indicates the pointer to a font metrics object OH_Drawing_Font_Metrics. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param fontmetrics Indicates the pointer to a font metrics object OH_Drawing_Font_Metrics. * @return Whether the font metrics was obtained. * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography*, OH_Drawing_TextStyle*, OH_Drawing_Font_Metrics*); +bool OH_Drawing_TextStyleGetFontMetrics(OH_Drawing_Typography* typography, + OH_Drawing_TextStyle* style, OH_Drawing_Font_Metrics* fontmetrics); /** * @brief Gets the position of the specified line or the first text of the specified line. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param int Line number. - * @param bool True is the information for the whole line, and false is the information to get the first character - * @param bool Whether the text width contains whitespace. - * @param OH_Drawing_LineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param lineNumber Line number. + * @param oneLine True is the information for the whole line, and false is the information to get the first character + * @param includeWhitespace Whether the text width contains whitespace. + * @param drawingLineMetrics Indicates the pointer to a line metrics object OH_Drawing_LineMetrics. * @return return whether the information was successfully fetched. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool, OH_Drawing_LineMetrics*); +bool OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography* typography, int lineNumber, bool oneLine, + bool includeWhitespace, OH_Drawing_LineMetrics* drawingLineMetrics); /** * @brief Sets the font weight of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param int Indicates the font weight of text typography to set. For details, + * @param weight Indicates the font weight of text typography to set. For details, * see the enum OH_Drawing_FontWeight. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextFontWeight(OH_Drawing_TypographyStyle* style, int weight); /** * @brief Sets the font style of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param int Indicates the font style of text typography to set. For details, + * @param fontStyle Indicates the font style of text typography to set. For details, * see the enum OH_Drawing_FontStyle. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextFontStyle(OH_Drawing_TypographyStyle* style, int fontStyle); /** * @brief Sets the font family of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param char Indicates the pointer to the font family of text typography to set. + * @param fontFamily Indicates the pointer to the font family of text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle*, const char*); +void OH_Drawing_SetTypographyTextFontFamily(OH_Drawing_TypographyStyle* style, const char* fontFamily); /** * @brief Sets the font size of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param double Indicates the font size of text typography to set. + * @param fontSize Indicates the font size of text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextFontSize(OH_Drawing_TypographyStyle* style, double fontSize); /** * @brief Sets the font height of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param double Indicates the font height of text typography to set. + * @param fontHeight Indicates the font height of text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextFontHeight(OH_Drawing_TypographyStyle* style, double fontHeight); /** * @brief Sets the half leading of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param bool Indicates the half leading of text typography to set. + * @param halfLeading Indicates the half leading of text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle*, bool); +void OH_Drawing_SetTypographyTextHalfLeading(OH_Drawing_TypographyStyle* style, bool halfLeading); /** * @brief Sets whether to enable line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param bool Indicates whether the line style for text typography is used. + * @param useLineStyle Indicates whether the line style for text typography is used. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle*, bool); +void OH_Drawing_SetTypographyTextUseLineStyle(OH_Drawing_TypographyStyle* style, bool useLineStyle); /** * @brief Sets the font weight of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param int Indicates the font weight of line style for text typography to set. + * @param weight Indicates the font weight of line style for text typography to set. * For details, see the enum OH_Drawing_FontWeight. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextLineStyleFontWeight(OH_Drawing_TypographyStyle* style, int weight); /** * @brief Sets the font style of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param int Indicates the font style of line style for text typography to set. For details, + * @param fontStyle Indicates the font style of line style for text typography to set. For details, * see the enum OH_Drawing_FontStyle. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, int); +void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle* style, int fontStyle); /** * @brief Sets the font families of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param int Indicates the number of font families to set. - * @param char Indicates the pointer to the font families of line style for text typography to set. + * @param fontFamiliesNumber Indicates the number of font families to set. + * @param fontFamilies Indicates the pointer to the font families of line style for text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, int, const char* fontFamilies[]); +void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle* style, + int fontFamiliesNumber, const char* fontFamilies[]); /** * @brief Sets the font size of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param double Indicates the font size of line style for text typography to set. + * @param lineStyleFontSize Indicates the font size of line style for text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextLineStyleFontSize(OH_Drawing_TypographyStyle* style, double lineStyleFontSize); /** * @brief Sets the font height of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param double Indicates the font height of line style for text typography to set. + * @param lineStyleFontHeight Indicates the font height of line style for text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextLineStyleFontHeight(OH_Drawing_TypographyStyle* style, double lineStyleFontHeight); /** * @brief Sets the half leading of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param bool Indicates the half leading of line for text typography to set. + * @param lineStyleHalfLeading Indicates the half leading of line for text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle*, bool); +void OH_Drawing_SetTypographyTextLineStyleHalfLeading(OH_Drawing_TypographyStyle* style, bool lineStyleHalfLeading); /** * @brief Sets the spacing scale of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param double Indicates the space scale of line for text typography to set. + * @param spacingScale Indicates the space scale of line for text typography to set. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle*, double); +void OH_Drawing_SetTypographyTextLineStyleSpacingScale(OH_Drawing_TypographyStyle* style, double spacingScale); /** * @brief Sets whether only line style is enabled for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. - * @param bool Indicates the line style for text typography to set only. + * @param lineStyleOnly Indicates the line style for text typography to set only. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle*, bool); +void OH_Drawing_SetTypographyTextLineStyleOnly(OH_Drawing_TypographyStyle* style, bool lineStyleOnly); /** * @brief Creates an OH_Drawing_TextShadow object. @@ -1898,304 +1954,307 @@ OH_Drawing_TextShadow* OH_Drawing_CreateTextShadow(void); * @brief Releases the memory occupied by the text shadow object OH_Drawing_TextShadow. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @param shadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow*); +void OH_Drawing_DestroyTextShadow(OH_Drawing_TextShadow* shadow); /** * @brief Gets the vector of TextShadow in TextStyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. * @param int Indicates the number in vector to set. - * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @param style Indicates the pointer to the text shadow object OH_Drawing_TextShadow. * @return Returns the vector of TextShadow. * @since 12 * @version 1.0 */ -OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle*); +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadows(OH_Drawing_TextStyle* style); /** * @brief Gets the size of vector of TextShadow in TextStyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. * @return Returns the size of vector. * @since 12 * @version 1.0 */ -int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle*); +int OH_Drawing_TextStyleGetShadowCount(OH_Drawing_TextStyle* style); /** * @brief Adds element in vector of TextShadow in TextStyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param OH_Drawing_TextShadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param shadow Indicates the pointer to the text shadow object OH_Drawing_TextShadow. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle*, const OH_Drawing_TextShadow*); +void OH_Drawing_TextStyleAddShadow(OH_Drawing_TextStyle* style, const OH_Drawing_TextShadow* shadow); /** * @brief clear elements in vector of TextShadow in TextStyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle*); +void OH_Drawing_TextStyleClearShadows(OH_Drawing_TextStyle* style); /** * @brief Gets element in vector of TextShadow with index. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to a text style object OH_Drawing_TextStyle. - * @param int Indicates the index to set. + * @param style Indicates the pointer to a text style object OH_Drawing_TextStyle. + * @param index Indicates the index to set. * @return Returns the pointer to element with the index in vector of the text style object * OH_Drawing_TextStyle. * @since 12 * @version 1.0 */ -OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle*, int); +OH_Drawing_TextShadow* OH_Drawing_TextStyleGetShadowWithIndex(OH_Drawing_TextStyle* style, int index); /** * @brief Set indents of the typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param float Indicates the pointer to the indents to set. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param indentsNumber Indicates the pointer to the indents to set. + * @param indents Indicates the pointer to the indents to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographySetIndents(OH_Drawing_Typography*, int, const float indents[]); +void OH_Drawing_TypographySetIndents(OH_Drawing_Typography* typography, int indentsNumber, const float indents[]); /** * @brief Gets element with index in vector of Indents. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography. - * @param int Indicates the index to set. + * @param typography Indicates the pointer to a typography object OH_Drawing_Typography. + * @param index Indicates the index to set. * @return float Indicates the element with the index in vector of Indents. * @since 12 * @version 1.0 */ -float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); +float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography* typography, int index); /** * @brief Releases the memory occupied by vector with the text shadow object OH_Drawing_TextShadow. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param Indicates the pointer to the text shadow object OH_Drawing_TextShadow. + * @param shadow the pointer to the text shadow object OH_Drawing_TextShadow. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); +void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow* shadow); /** * @brief Set mode of applying the leading over and under text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @param heightMode Indicates the mode to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle*, OH_Drawing_TextHeightBehavior heightMode); +void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle* style, + OH_Drawing_TextHeightBehavior heightMode); /** * @brief Get mode of applying the leading over and under text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @return Returns the mode. * @since 12 * @version 1.0 */ -OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle*); +OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle* style); /** * @brief Set struct of background rect and styleId of text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param OH_Drawing_RectStyle_Info Indicates the pointer to an OH_Drawing_RectStyle_Info object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param rectStyleInfo Indicates the pointer to an OH_Drawing_RectStyle_Info object. * @param styleId Indicates the styleId of text to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId); +void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle* style, + const OH_Drawing_RectStyle_Info* rectStyleInfo, int styleId); /** * @brief Add symbols in creating typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param handler Indicates the pointer to an OH_Drawing_TypographyCreate object. * @param symbol Indicates the symbol to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol); +void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate* handler, uint32_t symbol); /** * @brief Add font feature. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @param tag Indicates the pointer to the tag to set. * @param value Indicates the value to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value); +void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle* style, const char* tag, int value); /** * @brief Add font variation. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param char* Indicates the pointer to font variation axis. - * @param float Indicates the font variation value to set. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. + * @param axis Indicates the pointer to font variation axis. + * @param value Indicates the font variation value to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleAddFontVariation(OH_Drawing_TextStyle*, const char* /* axis */, const float /* value */); +void OH_Drawing_TextStyleAddFontVariation(OH_Drawing_TextStyle* style, const char* axis, const float value); /** * @brief Get all font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. * Get size of font feature by OH_Drawing_TextStyleGetFontFeatureSize. * @since 12 * @version 1.0 */ -OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*); +OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle* style); /** * @brief Release the memory occupied by array of structures of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. + * @param fontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. * @param fontFeatureSize Indicates the size of array of structures of OH_Drawing_FontFeature. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature*, size_t fontFeatureSize); +void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature* fontFeature, size_t fontFeatureSize); /** * @brief Get size of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the size of fontfeatures map. * @since 12 * @version 1.0 */ -size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*); +size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle* style); /** * @brief Clear font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle*); +void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle* style); /** * @brief Set baseline shift of text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @param lineShift Indicates the baseline shift to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle*, double lineShift); +void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle* style, double lineShift); /** * @brief Get baseline shift of text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the baseline shift. * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle* style); /** * @brief Gets the text color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the text color. * @since 12 * @version 1.0 */ -uint32_t OH_Drawing_TextStyleGetColor(OH_Drawing_TextStyle*); +uint32_t OH_Drawing_TextStyleGetColor(OH_Drawing_TextStyle* style); /** * @brief Gets text decoration style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns text decoration style. * @since 12 * @version 1.0 */ -OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle(OH_Drawing_TextStyle*); +OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle(OH_Drawing_TextStyle* style); /** * @brief Gets font weight. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns font Weight. * @since 12 * @version 1.0 */ -OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight(OH_Drawing_TextStyle*); +OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight(OH_Drawing_TextStyle* style); /** * @brief Gets font style. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns font style. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle(OH_Drawing_TextStyle*); +OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle(OH_Drawing_TextStyle* style); /** * @brief Gets the font baseline. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the font baseline. * @since 12 * @version 1.0 */ -OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline(OH_Drawing_TextStyle*); +OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline(OH_Drawing_TextStyle* style); /** * @brief Gets a list of font families. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @param num Indicates count of font families result. * @return Returns a list of font families. * @since 12 * @version 1.0 */ -char** OH_Drawing_TextStyleGetFontFamilies(OH_Drawing_TextStyle*, size_t* num); +char** OH_Drawing_TextStyleGetFontFamilies(OH_Drawing_TextStyle* style, size_t* num); /** * @brief Releases the memory occupied by a list of font families. @@ -2212,76 +2271,76 @@ void OH_Drawing_TextStyleDestroyFontFamilies(char** fontFamilies, size_t num); * @brief Gets font size. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns font size. * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetFontSize(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetFontSize(OH_Drawing_TextStyle* style); /** * @brief Gets the letter spacing of the text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the size of the letter spacing. * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetLetterSpacing(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetLetterSpacing(OH_Drawing_TextStyle* style); /** * @brief Gets the word spacing of the text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns word spacing size. * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetWordSpacing(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetWordSpacing(OH_Drawing_TextStyle* style); /** * @brief Gets font height. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns font height. * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetFontHeight(OH_Drawing_TextStyle* style); /** * @brief Gets whether to set the text to half line spacing. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns true indicates that the spacing takes effect, * false indicates that the spacing does not take effect. * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle*); +bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle* style); /** * @brief Gets the locale. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns a locale of data type as a pointer to a char. As with the TextStyle lifecycle. * No release is required and the return value is invalidated after the set method is called. * @since 12 * @version 1.0 */ -const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle*); +const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle* style); /** * @brief Sets the text style, including font weight, font width and font slant. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @param drawingTextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param fontStyle Indicates an OH_Drawing_FontStyleStruct object. * @since 12 * @version 1.0 */ @@ -2292,7 +2351,7 @@ void OH_Drawing_SetTextStyleFontStyleStruct(OH_Drawing_TextStyle* drawingTextSty * @brief Gets the text style, including font weight, font width and font slant. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param drawingTextStyle Indicates the pointer to an OH_Drawing_TextStyle object. * @return Returns the OH_Drawing_FontStyleStruct object getted. * @since 12 * @version 1.0 @@ -2303,8 +2362,8 @@ OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_Tex * @brief Sets the typography style, including font weight, font width and font slant. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @param drawingStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param fontStyle Indicates an OH_Drawing_FontStyleStruct object. * @since 12 * @version 1.0 */ @@ -2315,7 +2374,7 @@ void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* dr * @brief Gets the typography style, including font weight, font width and font slant. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param drawingStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. * @return Returns the OH_Drawing_FontStyleStruct object getted. * @since 12 * @version 1.0 @@ -2350,9 +2409,9 @@ bool OH_Drawing_TextStyleIsEqualByFont(const OH_Drawing_TextStyle* style, const * @brief Gets whether two TextStyle objects match attributes * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param textStyleType Indicates enumerates of text style type. - * @param style Indicates source of comparison OH_Drawing_TextStyle object. - * @param comparedStyle Indicates comparison OH_Drawing_TextStyle object. + * @param style Indicates enumerates of text style type. + * @param comparedStyle Indicates source of comparison OH_Drawing_TextStyle object. + * @param textStyleType Indicates comparison OH_Drawing_TextStyle object. * @return Match attributes result. * @since 12 * @version 1.0 @@ -2364,7 +2423,7 @@ bool OH_Drawing_TextStyleIsAttributeMatched(const OH_Drawing_TextStyle* style, * @brief Set placeholder of TextStyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @since 12 * @version 1.0 */ @@ -2374,7 +2433,7 @@ void OH_Drawing_TextStyleSetPlaceholder(OH_Drawing_TextStyle* style); * @brief Gets whether placeholder is enable. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param style Indicates the pointer to an OH_Drawing_TextStyle object. * @return Whether placeholder is enable. * @since 12 * @version 1.0 @@ -2385,7 +2444,7 @@ bool OH_Drawing_TextStyleIsPlaceholder(OH_Drawing_TextStyle* style); * @brief Gets text alignment mode. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @return Returns text alignment mode. * @since 12 * @version 1.0 @@ -2396,7 +2455,7 @@ OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment(OH_Drawing_ * @brief Gets whether the hinting is enabled. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @return True, if the hinting takes effect; False, if the hinting does not take effect. * @since 12 * @version 1.0 @@ -2407,7 +2466,7 @@ bool OH_Drawing_TypographyStyleIsHintEnabled(OH_Drawing_TypographyStyle* style); * @brief Gets system font configuration information. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontConfigInfoErrorCode Indicates error code returned, based on the error code to + * @param errorCode Indicates error code returned, based on the error code to * release the memory of system font configuration information. * For details, see the enum OH_Drawing_FontConfigInfoErrorCode. * @return Returns a pointer to system font configuration information. @@ -2415,49 +2474,49 @@ bool OH_Drawing_TypographyStyleIsHintEnabled(OH_Drawing_TypographyStyle* style); * @since 12 * @version 1.0 */ -OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo(OH_Drawing_FontConfigInfoErrorCode*); +OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo(OH_Drawing_FontConfigInfoErrorCode* errorCode); /** * @brief Releases the memory occupied by system font configuration information. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_FontConfigInfo Indicates the pointer to an OH_Drawing_FontConfigInfo object. + * @param drawFontCfgInfo Indicates the pointer to an OH_Drawing_FontConfigInfo object. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroySystemFontConfigInfo(OH_Drawing_FontConfigInfo*); +void OH_Drawing_DestroySystemFontConfigInfo(OH_Drawing_FontConfigInfo* drawFontCfgInfo); /** * @brief Sets the strut style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param OH_Drawing_StrutStyle Indicates the pointer of OH_Drawing_StrutStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param strutstyle Indicates the pointer of OH_Drawing_StrutStyle object. * @since 12 * @version 1.0 */ -void OH_Drawing_SetTypographyStyleTextStrutStyle(OH_Drawing_TypographyStyle*, OH_Drawing_StrutStyle*); +void OH_Drawing_SetTypographyStyleTextStrutStyle(OH_Drawing_TypographyStyle* style, OH_Drawing_StrutStyle* strutstyle); /** * @brief Releases the memory occupied by an OH_Drawing_StrutStyle object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_StrutStyle Indicates the pointer of OH_Drawing_StrutStyle object. + * @param strutstyle Indicates the pointer of OH_Drawing_StrutStyle object. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyStyleDestroyStrutStyle(OH_Drawing_StrutStyle*); +void OH_Drawing_TypographyStyleDestroyStrutStyle(OH_Drawing_StrutStyle* strutstyle); /** * @brief Gets the strut style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @return Returns the pointer of OH_Drawing_StrutStyle object. * @since 12 * @version 1.0 */ -OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle(OH_Drawing_TypographyStyle*); +OH_Drawing_StrutStyle* OH_Drawing_TypographyStyleGetStrutStyle(OH_Drawing_TypographyStyle* style); /** * @brief Overriding the struct StrutStyle equals operator. @@ -2474,119 +2533,120 @@ bool OH_Drawing_TypographyStyleStrutStyleEquals(OH_Drawing_StrutStyle* from, OH_ * @brief Sets the hinting of text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. * @param hintsEnabled Indicates the hinting of text typography.. * @since 12 * @version 1.0 */ void OH_Drawing_TypographyStyleSetHintsEnabled(OH_Drawing_TypographyStyle* style, bool hintsEnabled); -/* @brief Getting all font metrics from target row. +/** + * @brief Getting all font metrics from target row. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates a pointer to a typesetting object. + * @param typography Indicates a pointer to a typesetting object. * @param lineNumber Indicates specifies the number of rows. * @param fontMetricsSize Indicates the return size of font metrics struct from current line. * @return Returns all character measures for the current row. * @since 12 * @version 1.0 */ -OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics(OH_Drawing_Typography*, +OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics(OH_Drawing_Typography* typography, size_t lineNumber, size_t* fontMetricsSize); /** * @brief Free up all the space taken up by the lineFontMetric. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Font_Metrics Indicates the first address of the lineFontMetric gather to be destroyed. + * @param lineFontMetric Indicates the first address of the lineFontMetric gather to be destroyed. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyDestroyLineFontMetrics(OH_Drawing_Font_Metrics*); +void OH_Drawing_TypographyDestroyLineFontMetrics(OH_Drawing_Font_Metrics* lineFontMetric); /** * @brief Mark the Typography as dirty, and initially state the Typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography*); +void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography* typography); /** * @brief Get the unresolved Glyphs count of lines in a text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. * @return Returns unresolved Glyphs count. * @since 12 * @version 1.0 */ -int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography*); +int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography* typography); /** * @brief Update the font size of lines in a text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. * @param from Indicates the source of the original font size. * @param to Indicates the destination of the updated font size. * @param fontSize Indicates the size of the font. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography*, size_t from, size_t to, float fontSize); +void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography* typography, size_t from, size_t to, float fontSize); /** * @brief Get whether the text layout enables line styles. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to the text OH_Drawing_TypographyStyle object. + * @param style Indicates the pointer to the text OH_Drawing_TypographyStyle object. * @return Whether or not to enable line styles in text layout only, true means enable, false means disable. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle* style); /** * @brief Get the font weight of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the font weight of line style for text typography. * For details, see the enum OH_Drawing_FontWeight. * @since 12 * @version 1.0 */ -OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle*); +OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle* style); /** * @brief Get the font style of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the font style of line style for text typography. * For details, see the enum OH_Drawing_FontStyle. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle*); +OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle* style); /** * @brief Get the font families of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @param num The number of obtained font names. * @return Return the font families of line style for text typography. * @since 12 * @version 1.0 */ -char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle*, size_t* num); +char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle* style, size_t* num); /** * @brief Releases the memory occupied by a list of font families names. @@ -2603,123 +2663,123 @@ void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies(char** fontFamilies, * @brief Get the font size of font size for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the font size of font size for text typography. * @since 12 * @version 1.0 */ -double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle*); +double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle* style); /** * @brief Get the font height scale in text layout. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Retrun the font height scale in text layout. * @since 12 * @version 1.0 */ -double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle*); +double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle* style); /** * @brief Get whether to enable font height for line styles in text layout only. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Whether or not to enable the font height for line styles in text layout only, * true means enable, false means disable. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle* style); /** * @brief Get the half leading of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Whether to enable the text line half leading style, true means enable, false means disable. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle* style); /** * @brief Get the spacing scale of line style for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the spacing scale of line style for text typography. * @since 12 * @version 1.0 */ -double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle*); +double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle* style); /** * @brief Get whether only line style is enabled for text typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Returns whether only line style is enabled for text layout, true means it is enabled, * false means it is not. * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle*); +bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle* style); /** * @brief Get the text alignment mode. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the text alignment mode. For details, see the enum OH_Drawing_TextAlign. * @since 12 * @version 1.0 */ -OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle*); +OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle* style); /** * @brief Get the text direction. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the text direction. For details, see the enum OH_Drawing_TextDirection. * @since 12 * @version 1.0 */ -OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle*); +OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle* style); /** * @brief Sets the maximum number of lines in a text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the maximum number of lines in a text. * @since 12 * @version 1.0 */ -size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle*); +size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle* style); /** * @brief Get the ellipsis of lines in a text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object + * @param style Indicates the pointer to a typography style object * OH_Drawing_TypographyStyle. * @return Return the ellipsis of lines in a text. * @since 12 * @version 1.0 */ -char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle*); +char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle* style); /** * @brief Releases the memory occupied by a list of Ellipsis names. @@ -2747,19 +2807,19 @@ bool OH_Drawing_TypographyStyleEquals(OH_Drawing_TypographyStyle* from, OH_Drawi * @brief Releases the memory occupied by text box. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextBox Indicates the pointer to a text box object OH_Drawing_TextBox. + * @param textBox Indicates the pointer to a text box object OH_Drawing_TextBox. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox*); +void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox* textBox); /** * @brief Sets the parameter of text-shadow. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextShadow Indicates the pointer to an OH_Drawing_TextShadow object. + * @param shadow Indicates the pointer to an OH_Drawing_TextShadow object. * @param color Indicates the color setting of text-shadow. - * @param OH_Drawing_Point Indicates the pointer to an OH_Drawing_Point object. + * @param offset Indicates the pointer to an OH_Drawing_Point object. * @param blurRadius Indicates the radius of blur for text-shadow. * @since 12 * @version 1.0 @@ -2767,6 +2827,78 @@ void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox*); void OH_Drawing_SetTextShadow(OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius); +/** + * @brief Creates an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param alignment Indicates enumerates text tab alignment modes. TAB alignment, Support left alignment + * right alignment center alignment, other enumeration values are left alignment effect. + * @param location Indicates location of text tab. + * @return Returns the pointer to the OH_Drawing_TextTab object created. If the object returns NULL, + * the creation failed. The possible cause of the failure is that the application address space is used up. + * As a result, space cannot be allocated. + * @since 18 + * @version 1.0 + */ +OH_Drawing_TextTab* OH_Drawing_CreateTextTab(OH_Drawing_TextAlign alignment, float location); + +/** + * @brief Releases the memory occupied by an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param tab Indicates the pointer to an OH_Drawing_TextTab object. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_DestroyTextTab(OH_Drawing_TextTab* tab); + +/** + * @brief Get alignment of an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param tab Indicates the pointer to an OH_Drawing_TextTab object. + * @return Returns align of an OH_Drawing_TextTab object. + * @since 18 + * @version 1.0 + */ +OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment(OH_Drawing_TextTab* tab); + +/** + * @brief Get location of an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param tab Indicates the pointer to an OH_Drawing_TextTab object. + * @return Returns location of an OH_Drawing_TextTab object. + * @since 18 + * @version 1.0 + */ +float OH_Drawing_GetTextTabLocation(OH_Drawing_TextTab* tab); + +/** + * @brief Sets the text tab of OH_Drawing_TypographyStyle object. + * Tab alignment does not take effect when text alignment is also set, Or when the ellipsis style is configured. + * When the tab is not set or the tab's location property is less than or equal to 0, it is the default space effect. + * And all tabs in the paragraph after the setting are aligned according to this tab effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param tab Indicates the pointer to an OH_Drawing_TextTab object. + * @since 18 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle* style, OH_Drawing_TextTab* tab); + +/** + * @brief Get DrawingArray size. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param drawingArray Indicates the pointer to the array object OH_Drawing_Array. + * @return Size of array. + * @since 14 + * @version 1.0 + */ +size_t OH_Drawing_GetDrawingArraySize(OH_Drawing_Array* drawingArray); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_typeface.h b/graphic/graphic_2d/native_drawing/drawing_typeface.h index fa3d016e98bf069bb4f1725181c220b38283bbb4..0b5e8d965f6bb04fcb2bb7cca885b30d952d6f83 100644 --- a/graphic/graphic_2d/native_drawing/drawing_typeface.h +++ b/graphic/graphic_2d/native_drawing/drawing_typeface.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_TYPEFACE_H -#define C_INCLUDE_DRAWING_TYPEFACE_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_TYPEFACE_H +#define C_INCLUDE_DRAWING_TYPEFACE_H + #include "drawing_error_code.h" #include "drawing_types.h" @@ -112,23 +112,23 @@ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromCurrent(const OH_Drawing_Typef * it or free it again. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_MemoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. + * @param memoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. * @param index memory stream index. * @return Returns the pointer to the OH_Drawing_Typeface object created. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index); +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream* memoryStream, int32_t index); /** * @brief Destroys an OH_Drawing_Typeface object and reclaims the memory occupied by the object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_Typeface Indicates the pointer to an OH_Drawing_Typeface object. + * @param typeface Indicates the pointer to an OH_Drawing_Typeface object. * @since 11 * @version 1.0 */ -void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface*); +void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface* typeface); /** * @brief Creates an OH_Drawing_FontArguments object. diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index a505833ac3281dc28d93e59f30f0f1dd7b963f61..65a39f67298c7ddae2e31dad9a64bc39d7314fc7 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_DRAWING_TYPES_H -#define C_INCLUDE_DRAWING_TYPES_H - /** * @addtogroup Drawing * @{ @@ -40,6 +37,9 @@ * @version 1.0 */ +#ifndef C_INCLUDE_DRAWING_TYPES_H +#define C_INCLUDE_DRAWING_TYPES_H + #include #include #include @@ -106,20 +106,20 @@ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; typedef struct OH_Drawing_Point OH_Drawing_Point; /** - * @brief Define color space to determine color information. + * @brief Defines a pixelmap, which is used to wrap real pixelmap supported by image framework. * * @since 12 * @version 1.0 */ -typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace; +typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap; /** - * @brief Defines a pixelmap, which is used to wrap real pixelmap supported by image framework. + * @brief Define color space to determine color information. * * @since 12 * @version 1.0 */ -typedef struct OH_Drawing_PixelMap OH_Drawing_PixelMap; +typedef struct OH_Drawing_ColorSpace OH_Drawing_ColorSpace; /** * @brief Defines a point of 2d. @@ -479,6 +479,19 @@ typedef struct { double leftBottomRadius; } OH_Drawing_RectStyle_Info; +/** + * @brief Defines the string information struct. + * + * @since 14 + * @version 1.0 + */ +typedef struct { + /** A pointer to a byte string containing UTF-16 encoded entities */ + uint8_t* strData; + /** The length of `strData` in bytes */ + uint32_t strLen; +} OH_Drawing_String; + /** * @brief Enumerates text encoding types. * @since 12 @@ -526,6 +539,14 @@ typedef struct OH_Drawing_RecordCmdUtils OH_Drawing_RecordCmdUtils; * @version 1.0 */ typedef struct OH_Drawing_RecordCmd OH_Drawing_RecordCmd; + +/** + * @brief Defines an array object, which is used to store multiple NDK object. + * + * @since 14 + * @version 1.0 + */ +typedef struct OH_Drawing_Array OH_Drawing_Array; #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e81640a3fa4218b59fb9dc031eb4e7b90db2a47b..e13687d429e5ac4b5fe5f166a49471ba61797534 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -122,13 +122,10 @@ "first_introduced": "12", "name": "OH_Drawing_CanvasSkew" }, - { "name": "OH_Drawing_CanvasSetMatrix" }, { "first_introduced": "12", "name": "OH_Drawing_CanvasResetMatrix" }, - { "name": "OH_Drawing_CanvasReadPixels" }, - { "name": "OH_Drawing_CanvasReadPixelsToBitmap" }, { "name": "OH_Drawing_CanvasGetWidth" }, { "name": "OH_Drawing_CanvasGetHeight" }, { "name": "OH_Drawing_CanvasGetLocalClipBounds" }, @@ -139,6 +136,9 @@ "name": "OH_Drawing_MatrixGetAll" }, { "name": "OH_Drawing_CanvasDrawShadow" }, + { "name": "OH_Drawing_CanvasSetMatrix" }, + { "name": "OH_Drawing_CanvasReadPixels" }, + { "name": "OH_Drawing_CanvasReadPixelsToBitmap" }, { "first_introduced": "12", "name": "OH_Drawing_CanvasIsClipEmpty" @@ -152,7 +152,27 @@ "name": "OH_Drawing_CanvasGetImageInfo" }, { "name": "OH_Drawing_CreateDashPathEffect" }, + { + "first_introduced": "18", + "name": "OH_Drawing_CreatePathDashEffect" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_CreateSumPathEffect" + }, { "name": "OH_Drawing_PathEffectDestroy" }, + { + "first_introduced": "18", + "name":"OH_Drawing_CreateDiscretePathEffect" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_CreateCornerPathEffect" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_CreateComposePathEffect" + }, { "name": "OH_Drawing_ColorFilterCreateBlendMode" }, { "name": "OH_Drawing_ColorFilterCreateCompose" }, { "name": "OH_Drawing_ColorFilterCreateLinearToSrgbGamma" }, @@ -164,6 +184,10 @@ "first_introduced": "12", "name": "OH_Drawing_ErrorCodeGet" }, + { + "first_introduced": "18", + "name": "OH_Drawing_ErrorCodeReset" + }, { "name": "OH_Drawing_FilterCreate" }, { "name": "OH_Drawing_FilterSetColorFilter" }, { @@ -238,6 +262,10 @@ "first_introduced": "12", "name": "OH_Drawing_FontIsSubpixel" }, + { + "first_introduced": "15", + "name": "OH_Drawing_FontIsThemeFontFollowed" + }, { "first_introduced": "12", "name": "OH_Drawing_FontMeasureSingleCharacter" @@ -276,6 +304,10 @@ "first_introduced": "12", "name": "OH_Drawing_FontSetSubpixel" }, + { + "first_introduced": "15", + "name": "OH_Drawing_FontSetThemeFontFollowed" + }, { "first_introduced": "12", "name": "OH_Drawing_FontTextToGlyphs" @@ -284,12 +316,16 @@ { "name": "OH_Drawing_FontCountText" }, { "name": "OH_Drawing_FontSetTextSkewX" }, { "name": "OH_Drawing_FontSetTypeface" }, - { "name": "OH_Drawing_FontGetMetrics" }, { "name": "OH_Drawing_FontGetTypeface" }, + { "name": "OH_Drawing_FontGetMetrics" }, { "first_introduced": "12", "name": "OH_Drawing_GpuContextCreateFromGL" }, + { + "first_introduced": "16", + "name": "OH_Drawing_GpuContextCreate" + }, { "first_introduced": "12", "name": "OH_Drawing_GpuContextDestroy" @@ -467,6 +503,10 @@ "first_introduced": "12", "name": "OH_Drawing_PathGetPositionTangent" }, + { + "first_introduced": "18", + "name": "OH_Drawing_PathGetSegment" + }, { "first_introduced": "12", "name": "OH_Drawing_PathOp" @@ -627,6 +667,14 @@ { "name": "OH_Drawing_SetTextStyleFontWeight" }, { "name": "OH_Drawing_SetTextStyleBaseLine" }, { "name": "OH_Drawing_SetTextStyleDecoration" }, + { + "first_introduced": "18", + "name": "OH_Drawing_AddTextStyleDecoration" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_RemoveTextStyleDecoration" + }, { "name": "OH_Drawing_SetTextStyleDecorationColor" }, { "name": "OH_Drawing_SetTextStyleFontHeight" }, { "name": "OH_Drawing_SetTextStyleFontFamilies" }, @@ -668,10 +716,18 @@ "first_introduced": "12", "name": "OH_Drawing_SurfaceCreateFromGpuContext" }, + { + "first_introduced": "16", + "name": "OH_Drawing_SurfaceCreateOnScreen" + }, { "first_introduced": "12", "name": "OH_Drawing_SurfaceGetCanvas" }, + { + "first_introduced": "16", + "name": "OH_Drawing_SurfaceFlush" + }, { "first_introduced": "12", "name": "OH_Drawing_SurfaceDestroy" @@ -744,6 +800,12 @@ { "name": "OH_Drawing_ImageBuildFromBitmap" }, { "name": "OH_Drawing_ImageGetWidth" }, { "name": "OH_Drawing_ImageGetHeight" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageGetImageInfo" + }, + { "name": "OH_Drawing_SamplingOptionsCreate" }, + { "name": "OH_Drawing_SamplingOptionsDestroy" }, { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetShadowWithIndex" @@ -780,12 +842,6 @@ "first_introduced": "12", "name": "OH_Drawing_TypographySetIndents" }, - { - "first_introduced": "12", - "name": "OH_Drawing_ImageGetImageInfo" - }, - { "name": "OH_Drawing_SamplingOptionsCreate" }, - { "name": "OH_Drawing_SamplingOptionsDestroy" }, { "first_introduced": "11", "name": "OH_Drawing_TypographyHandlerAddPlaceholder" @@ -926,6 +982,14 @@ "first_introduced": "12", "name": "OH_Drawing_DestroyFontDescriptor" }, + { + "first_introduced": "18", + "name": "OH_Drawing_MatchFontDescriptors" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_DestroyFontDescriptors" + }, { "first_introduced": "12", "name": "OH_Drawing_CreateFontParser" @@ -934,6 +998,22 @@ "first_introduced": "12", "name": "OH_Drawing_DestroyFontParser" }, + { + "first_introduced": "14", + "name": "OH_Drawing_GetFontDescriptorByFullName" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_GetSystemFontFullNamesByType" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_GetSystemFontFullNameByIndex" + }, + { + "first_introduced": "14", + "name": "OH_Drawing_DestroySystemFontFullNames" + }, { "first_introduced": "12", "name": "OH_Drawing_FontParserGetSystemFontList" @@ -1489,5 +1569,229 @@ { "first_introduced": "13", "name":"OH_Drawing_RecordCmdDestroy" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_CreateLineTypography" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_DestroyLineTypography" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_LineTypographyGetLineBreak" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_LineTypographyCreateLine" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_FontGetBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_FontGetPathForGlyph" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_RectCreateArray" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_RectGetArraySize" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_RectGetArrayElement" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_RectDestroyArray" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_CreateTextTab" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyTextTab" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetTextTabAlignment" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetTextTabLocation" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_SetTypographyTextTab" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_FontGetTextPath" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_GetDrawingArraySize" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TypographyGetTextLines" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyTextLines" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyTextLine" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetTextLineByIndex" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetGlyphCount" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetTextRange" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetGlyphRuns" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyRuns" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunByIndex" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLinePaint" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineCreateTruncatedLine" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetTypographicBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetImageBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetTrailingSpaceWidth" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetStringIndexForPosition" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetOffsetForStringIndex" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_TextLineEnumerateCaretOffsets" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_TextLineGetAlignmentOffset" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunStringIndices" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunStringIndicesByIndex" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyRunStringIndices" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunStringRange" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunTypographicBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_RunPaint" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunImageBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyRunImageBounds" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunGlyphs" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunGlyphsByIndex" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyRunGlyphs" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunPositions" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunPositionsByIndex" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_DestroyRunPositions" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_GetRunGlyphCount" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_GetFontCollectionGlobalInstance" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_CanvasQuickRejectPath" + }, + { + "first_introduced": "18", + "name":"OH_Drawing_CanvasQuickRejectRect" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_CanvasDrawNestedRoundRect" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_CanvasDrawArcWithCenter" + }, + { + "first_introduced": "18", + "name": "OH_Drawing_CanvasDrawPixelMapNine" } ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_effect/effect_filter.h b/graphic/graphic_2d/native_effect/effect_filter.h index f743d587ed3bae6854b5b852604f4b10866a003a..065643a8f76d7470e4107daa7fa0d809d53b4908 100644 --- a/graphic/graphic_2d/native_effect/effect_filter.h +++ b/graphic/graphic_2d/native_effect/effect_filter.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_EFFECT_FILTER_H -#define C_INCLUDE_EFFECT_FILTER_H - /** * @addtogroup image * @{ @@ -37,6 +34,9 @@ * @since 12 */ +#ifndef C_INCLUDE_EFFECT_FILTER_H +#define C_INCLUDE_EFFECT_FILTER_H + #include "effect_types.h" #ifdef __cplusplus extern "C" { @@ -77,6 +77,20 @@ EffectErrorCode OH_Filter_Release(OH_Filter* filter); */ EffectErrorCode OH_Filter_Blur(OH_Filter* filter, float radius); +/** + * @brief Creates a blur effect and then add to the filter. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @param filter The OH_Filter pointer will be operated. + * @param radius The radius of the blur effect. + * @param tileMode The tileMode of the blur effect. + * @return BlurWithTileMode result code. + * {@link EFFECT_SUCCESS} if the operation is successful. + * {@link EFFECT_BAD_PARAMETER} if parameter is invalid. + * @since 14 + */ +EffectErrorCode OH_Filter_BlurWithTileMode(OH_Filter* filter, float radius, EffectTileMode tileMode); + /** * @brief Creates a brighten effect and then add to the filter. * diff --git a/graphic/graphic_2d/native_effect/effect_types.h b/graphic/graphic_2d/native_effect/effect_types.h index 3d40a63fb8b4d467b3c839812814a1e92496f5e0..d84b05e134f1e9bc292defe4b0d6ddd80e0d4236 100644 --- a/graphic/graphic_2d/native_effect/effect_types.h +++ b/graphic/graphic_2d/native_effect/effect_types.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef C_INCLUDE_EFFECT_TYPES_H -#define C_INCLUDE_EFFECT_TYPES_H - /** * @addtogroup image * @{ @@ -37,6 +34,9 @@ * @since 12 */ +#ifndef C_INCLUDE_EFFECT_TYPES_H +#define C_INCLUDE_EFFECT_TYPES_H + #include #include @@ -88,6 +88,24 @@ typedef enum { EFFECT_UNKNOWN_ERROR = 7600901, } EffectErrorCode; +/** + * @brief Defines a effect filter tile mode. + * + * @since 14 + */ +typedef enum { + /** Replicate the edge color if the shader draws outside of its original bounds */ + CLAMP = 0, + /** Repeat the shader's image horizontally and vertically */ + REPEAT, + /** Repeat the shader's image horizontally and vertically, + * alternating mirror images so that adjacent images always seam + */ + MIRROR, + /** Only draw within the original domain, return transparent-black everywhere else */ + DECAL, +} EffectTileMode; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_effect/libnative_effect.ndk.json b/graphic/graphic_2d/native_effect/libnative_effect.ndk.json index 83a34f0a782411e09fdb9a8c930070d29465e94c..c97ec522d64f85da66fe3d3745a9d1acb5342b51 100644 --- a/graphic/graphic_2d/native_effect/libnative_effect.ndk.json +++ b/graphic/graphic_2d/native_effect/libnative_effect.ndk.json @@ -2,6 +2,7 @@ { "name": "OH_Filter_CreateEffect" }, { "name": "OH_Filter_Release" }, { "name": "OH_Filter_Blur" }, + { "name": "OH_Filter_BlurWithTileMode" }, { "name": "OH_Filter_Brighten" }, { "name": "OH_Filter_GrayScale" }, { "name": "OH_Filter_Invert" }, diff --git a/graphic/graphic_2d/native_image/libnative_image.ndk.json b/graphic/graphic_2d/native_image/libnative_image.ndk.json index 1a8c6688deed4d6b3103e20d66bb88dafaee707b..1b40db3aafe575c466ec47ad9d4c2a83a71e8e2d 100644 --- a/graphic/graphic_2d/native_image/libnative_image.ndk.json +++ b/graphic/graphic_2d/native_image/libnative_image.ndk.json @@ -11,6 +11,10 @@ { "name": "OH_NativeImage_UnsetOnFrameAvailableListener" }, { "name": "OH_NativeImage_Destroy" }, { "name": "OH_NativeImage_GetTransformMatrixV2" }, + { + "first_introduced": "15", + "name": "OH_NativeImage_GetBufferMatrix" + }, { "first_introduced": "12", "name": "OH_NativeImage_AcquireNativeWindowBuffer" diff --git a/graphic/graphic_2d/native_image/native_image.h b/graphic/graphic_2d/native_image/native_image.h index 25d33544165961542b1fcd4a92800be77c1ddc7a..83d30d81ff180b3b6c41b8106f567a36484f80c3 100644 --- a/graphic/graphic_2d/native_image/native_image.h +++ b/graphic/graphic_2d/native_image/native_image.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NDK_INCLUDE_NATIVE_IMAGE_H_ -#define NDK_INCLUDE_NATIVE_IMAGE_H_ - /** * @addtogroup OH_NativeImage * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef NDK_INCLUDE_NATIVE_IMAGE_H_ +#define NDK_INCLUDE_NATIVE_IMAGE_H_ + #include #ifdef __cplusplus @@ -79,7 +79,7 @@ typedef struct OH_OnFrameAvailableListener { /** * @brief Create a OH_NativeImage related to an Opengl ES texture and target. \n - * This interface needs to be used in conjunction with OH_NativeImage_Destroy<\b>, + * This interface needs to be used in conjunction with OH_NativeImage_Destroy, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -135,7 +135,7 @@ int32_t OH_NativeImage_DetachContext(OH_NativeImage* image); /** * @brief Update the related Opengl ES texture with the OH_NativeImage acquired buffer.\n * This interface needs to be called in the Opengl ES context thread.\n - * This interface needs to be called after receiving the OH_OnFrameAvailableListener<\b> callback.\n + * This interface needs to be called after receiving the OH_OnFrameAvailableListener callback.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage @@ -226,7 +226,7 @@ void OH_NativeImage_Destroy(OH_NativeImage** image); /** * @brief Obtains the transform matrix of the texture image by producer transform type.\n - * The matrix will not be update until OH_NativeImage_UpdateSurfaceImage<\b> is called.\n + * The matrix will not be update until OH_NativeImage_UpdateSurfaceImage is called.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage @@ -239,6 +239,24 @@ void OH_NativeImage_Destroy(OH_NativeImage** image); */ int32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[16]); +/** + * @brief Obtains the transform matrix that combines with crop rect. + * + * This API returns a transform matrix that combines the crop rect. + * Note that the matrix will not be updated until OH_NativeImage_UpdateSurfaceImage is called.\n + * This interface is a non-thread-safe type interface.\n + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeImage + * @param image Indicates the pointer to a OH_NativeImage instance. + * @param matrix Indicates the retrieved 4*4 transform matrix . + * @return {@link NATIVE_ERROR_OK} 0 - Success. + * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - image is NULL. + * {@link NATIVE_ERROR_MEM_OPERATION_ERROR} 30001000 - Memory operation error, failed to get transform matrix. + * @since 15 + * @version 1.0 + */ +int32_t OH_NativeImage_GetBufferMatrix(OH_NativeImage* image, float matrix[16]); + /** * @brief Acquire an OHNativeWindowBuffer through an OH_NativeImage instance for content consumer.\n * This method can not be used at the same time with OH_NativeImage_UpdateSurfaceImage.\n @@ -247,7 +265,7 @@ int32_t OH_NativeImage_GetTransformMatrixV2(OH_NativeImage* image, float matrix[ * by OH_NativeWindow_NativeObjectReference.\n * When the OHNativeWindowBuffer is used up, its reference count needs to be decremented * by OH_NativeWindow_NativeObjectUnreference.\n - * This interface needs to be used in conjunction with OH_NativeImage_ReleaseNativeWindowBuffer<\b>, + * This interface needs to be used in conjunction with OH_NativeImage_ReleaseNativeWindowBuffer, * otherwise memory leaks will occur.\n * When the fenceFd is used up, you need to close it.\n * This interface is a non-thread-safe type interface.\n @@ -268,7 +286,7 @@ int32_t OH_NativeImage_AcquireNativeWindowBuffer(OH_NativeImage* image, /** * @brief Release the OHNativeWindowBuffer to the buffer queue through an * OH_NativeImage instance for reuse.\n - * The fenceFd will be close by system.\n + * The fenceFd will be closed by system.\n * This interface is a non-thread-safe type interface.\n * * @syscap SystemCapability.Graphic.Graphic2D.NativeImage @@ -290,9 +308,9 @@ int32_t OH_NativeImage_ReleaseNativeWindowBuffer(OH_NativeImage* image, * This interface is only used for memory rotation on the surface consumer, * the OH_NativeImage will not actively perform memory rendering processing.\n * This method can not be used at the same time with OH_NativeImage_UpdateSurfaceImage.\n - * This interface is used in conjunction with OH_NativeImage_AcquireNativeWindowBuffer<\b> and - * OH_NativeImage_ReleaseNativeWindowBuffer<\b>.\n - * This interface needs to be used in conjunction with OH_NativeImage_Destroy<\b>, + * This interface is used in conjunction with OH_NativeImage_AcquireNativeWindowBuffer and + * OH_NativeImage_ReleaseNativeWindowBuffer.\n + * This interface needs to be used in conjunction with OH_NativeImage_Destroy, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * diff --git a/graphic/graphic_2d/native_vsync/libnative_vsync.ndk.json b/graphic/graphic_2d/native_vsync/libnative_vsync.ndk.json index 196fab5242b37ac6412a7b28f14a277c3e549da6..5362d474e0217b0a4b53c0ed0924b05a53e69d88 100644 --- a/graphic/graphic_2d/native_vsync/libnative_vsync.ndk.json +++ b/graphic/graphic_2d/native_vsync/libnative_vsync.ndk.json @@ -3,5 +3,10 @@ { "name": "OH_NativeVSync_Destroy" }, { "name": "OH_NativeVSync_RequestFrame" }, { "name": "OH_NativeVSync_RequestFrameWithMultiCallback" }, - { "name": "OH_NativeVSync_GetPeriod" } + { "name": "OH_NativeVSync_GetPeriod" }, + { "name": "OH_NativeVSync_Create_ForAssociatedWindow" }, + { + "first_introduced": "14", + "name": "OH_NativeVSync_DVSyncSwitch" + } ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_vsync/native_vsync.h b/graphic/graphic_2d/native_vsync/native_vsync.h index 610fe1debc2c44e035005c71cd5a060d19a7eb2d..d9ef7562e336b80f72e0cfb492d42ab1587a945b 100644 --- a/graphic/graphic_2d/native_vsync/native_vsync.h +++ b/graphic/graphic_2d/native_vsync/native_vsync.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NDK_INCLUDE_NATIVE_VSYNC_H_ -#define NDK_INCLUDE_NATIVE_VSYNC_H_ - /** * @addtogroup NativeVsync * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef NDK_INCLUDE_NATIVE_VSYNC_H_ +#define NDK_INCLUDE_NATIVE_VSYNC_H_ + #ifdef __cplusplus extern "C" { #endif @@ -61,15 +61,30 @@ typedef void (*OH_NativeVSync_FrameCallback)(long long timestamp, void *data); OH_NativeVSync* OH_NativeVSync_Create(const char* name, unsigned int length); /** - * @brief Delete the NativeVsync instance. + * @brief Destroys an OH_NativeVSync instance. + * Once the OH_NativeVSync pointer is destroyed, it must not be used to prevent dangling pointer problems. + * Pay special attention to the management of the OH_NativeVSync pointer in concurrent multithreaded scenarios. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync - * @param window Indicates the pointer to a NativeVsync instance. + * @param nativeVsync Pointer to an OH_NativeVSync instance. * @since 9 * @version 1.0 */ void OH_NativeVSync_Destroy(OH_NativeVSync* nativeVsync); +/** + * @brief Creates a NativeVsync instance.\n + * A new NativeVsync instance is created each time this function is called. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync + * @param windowID Indicates the id of the associated window. + * @param name Indicates the vsync connection name. + * @param length Indicates the name's length. + * @return Returns the pointer to the NativeVsync instance created. + * @since 14 + * @version 1.0 + */ +OH_NativeVSync* OH_NativeVSync_Create_ForAssociatedWindow(uint64_t windowID, const char* name, unsigned int length); /** * @brief Request next vsync with callback. * If you call this interface multiple times in one frame, it will only call the last callback. @@ -104,7 +119,12 @@ int OH_NativeVSync_RequestFrameWithMultiCallback( OH_NativeVSync* nativeVsync, OH_NativeVSync_FrameCallback callback, void* data); /** - * @brief Get vsync period. + * @brief Obtains the VSync period. + * The VSync period is refreshed only when the OH_NativeVSync_FrameCallback callback is received + * following a request for a VSync signal via OH_NativeVSync_RequestFrame. + * To obtain the VSync period for the first time using this function, + * you need to call OH_NativeVSync_RequestFrame to request a VSync signal. + * Once the OH_NativeVSync_FrameCallback callback is received, the vsync period can be obtained. * * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync * @param nativeVsync Indicates the pointer to a NativeVsync. @@ -114,8 +134,36 @@ int OH_NativeVSync_RequestFrameWithMultiCallback( * @version 1.0 */ int OH_NativeVSync_GetPeriod(OH_NativeVSync* nativeVsync, long long* period); + +/** + * @brief Enables DVSync to improve the smoothness of self-drawing animations. + * DVSync, short for Decoupled VSync, is a frame timing management policy that is decoupled from the hardware's VSync. + * DVSync drives the early rendering of upcoming animation frames by sending VSync signals with future timestamps. + * These frames are stored in a frame buffer queue. This helps DVSync reduce potential frame drop and therefore + * enhances the smoothness of animations. + * DVSync requires free self-drawing frame buffers to store these pre-rendered animation frames. + * Therefore, you must ensure that at least one free frame buffer is available. Otherwise, do not enable DVSync. + * After DVSync is enabled, you must correctly respond to the early VSync signals and request the subsequent VSync + * after the animation frame associated with the previous VSync is complete. In addition, the self-drawing frames must + * carry timestamps that align with VSync. + * After the animation ends, disable DVSync. + * Only phones and tablets support DVSync. + * On a platform that does not support DVSync or if another application has enabled DVSync, the attempt to enable it + * will not take effect, and the application still receives normal VSync signals. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeVsync + * @param nativeVsync Indicates the pointer to a NativeVsync. + * @param enable Whether to enable DVSync.The value true means to enable DVSync, and false means the opposite. + * @return {@link NATIVE_ERROR_OK} 0 - Success. + * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - the parameter nativeVsync is NULL. + * {@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed. + * @since 14 + * @version 1.0 + */ +int OH_NativeVSync_DVSyncSwitch(OH_NativeVSync* nativeVsync, bool enable); #ifdef __cplusplus } #endif +/** @} */ #endif \ No newline at end of file diff --git a/graphic/graphic_2d/native_window/buffer_handle.h b/graphic/graphic_2d/native_window/buffer_handle.h index a5e3a13cfb1f06aba4b3abd67eb1c413711d8e32..bf1651335da6085f692dfa093ded8ee72f37da91 100644 --- a/graphic/graphic_2d/native_window/buffer_handle.h +++ b/graphic/graphic_2d/native_window/buffer_handle.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef INCLUDE_BUFFER_HANDLE_H -#define INCLUDE_BUFFER_HANDLE_H - /** * @addtogroup NativeWindow * @{ @@ -39,12 +36,19 @@ * @version 1.0 */ +#ifndef INCLUDE_BUFFER_HANDLE_H +#define INCLUDE_BUFFER_HANDLE_H + #include #ifdef __cplusplus extern "C" { #endif +/** + * @brief Buffer handle used to transfer and obtain information about the buffer. + * @since 8 + */ typedef struct { int32_t fd; /**< buffer fd, -1 if not supported */ int32_t width; /**< the width of memory */ @@ -65,4 +69,5 @@ typedef struct { } #endif +/** @} */ #endif // INCLUDE_BUFFER_HANDLE_H diff --git a/graphic/graphic_2d/native_window/external_window.h b/graphic/graphic_2d/native_window/external_window.h index 23d98d2077098e01bbb2f385401021ce15c45233..41b01ce8d0503a1eb63d77c705c13fb120de7c2e 100644 --- a/graphic/graphic_2d/native_window/external_window.h +++ b/graphic/graphic_2d/native_window/external_window.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NDK_INCLUDE_EXTERNAL_NATIVE_WINDOW_H_ -#define NDK_INCLUDE_EXTERNAL_NATIVE_WINDOW_H_ - /** * @addtogroup NativeWindow * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef NDK_INCLUDE_EXTERNAL_NATIVE_WINDOW_H_ +#define NDK_INCLUDE_EXTERNAL_NATIVE_WINDOW_H_ + #include #include "buffer_handle.h" #include "../native_buffer/buffer_common.h" @@ -142,12 +142,16 @@ typedef enum NativeWindowOperation { * set native window buffer stride, * variable parameter in function is * [in] int32_t stride. + * @deprecated since 16 */ SET_STRIDE, /** * get native window buffer stride, * variable parameter in function is * [out] int32_t *stride. + * @deprecated since 16 + * @useinstead Use {@link OH_NativeWindow_GetBufferHandleFromNative} to get a {@link BufferHandleand} from a buffer + * and then retrieve the stride from the {@link BufferHandle}. */ GET_STRIDE, /** @@ -163,15 +167,17 @@ typedef enum NativeWindowOperation { */ GET_SWAP_INTERVAL, /** - * set native window buffer timeout, + * set the timeout in milliseconds when the native window requests a buffer, + * the default value is 3000 milliseconds when not set, * variable parameter in function is - * [in] int32_t timeout. + * [in] int32_t timeout, in milliseconds. */ SET_TIMEOUT, /** - * get native window buffer timeout, + * get the timeout in milliseconds when the native window requests a buffer, + * the default value is 3000 milliseconds when not set, * variable parameter in function is - * [out] int32_t *timeout. + * [out] int32_t *timeout, in milliseconds. */ GET_TIMEOUT, /** @@ -183,7 +189,7 @@ typedef enum NativeWindowOperation { /** * get native window buffer colorGamut, * variable parameter in function is - * [out int32_t *colorGamut], the enumeration value refers to {@link OH_NativeBuffer_ColorGamut}. + * [out] int32_t *colorGamut, the enumeration value refers to {@link OH_NativeBuffer_ColorGamut}. */ GET_COLOR_GAMUT, /** @@ -273,6 +279,7 @@ typedef enum NativeWindowOperation { * @brief Indicates Scaling Mode. * @since 9 * @deprecated(since = "10") + * @useinstead OHScalingModeV2 */ typedef enum { /** @@ -440,7 +447,7 @@ OHNativeWindowBuffer* OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer( /** * @brief Creates a OHNativeWindowBuffer instance.\n * A new OHNativeWindowBuffer instance is created each time this function is called.\n - * This interface needs to be used in conjunction with OH_NativeWindow_DestroyNativeWindowBuffer<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_DestroyNativeWindowBuffer, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -468,7 +475,7 @@ void OH_NativeWindow_DestroyNativeWindowBuffer(OHNativeWindowBuffer* buffer); * @brief Requests a OHNativeWindowBuffer through a OHNativeWindow instance for content production.\n * Before calling this interface, you need to set the width and height of * OHNativeWindow through SET_BUFFER_GEOMETRY.\n - * This interface needs to be used in conjunction with OH_NativeWindow_NativeWindowFlushBuffer<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_NativeWindowFlushBuffer, * otherwise buffer will be exhausted.\n * When the fenceFd is used up, you need to close it.\n * This interface is a non-thread-safe type interface.\n @@ -561,7 +568,7 @@ BufferHandle *OH_NativeWindow_GetBufferHandleFromNative(OHNativeWindowBuffer *bu /** * @brief Adds the reference count of a native object.\n - * This interface needs to be used in conjunction with OH_NativeWindow_NativeObjectUnreference<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_NativeObjectUnreference, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -609,6 +616,7 @@ int32_t OH_NativeWindow_GetNativeObjectMagic(void *obj); * @since 9 * @version 1.0 * @deprecated(since = "10") + * @useinstead OH_NativeWindow_NativeWindowSetScalingModeV2 */ int32_t OH_NativeWindow_NativeWindowSetScalingMode(OHNativeWindow *window, uint32_t sequence, OHScalingMode scalingMode); @@ -661,7 +669,7 @@ int32_t OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow *window, cons /** * @brief Attach a buffer to an OHNativeWindow instance.\n - * This interface needs to be used in conjunction with OH_NativeWindow_NativeWindowDetachBuffer<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_NativeWindowDetachBuffer, * otherwise buffer management will be chaotic.\n * This interface is a non-thread-safe type interface.\n * @@ -702,11 +710,11 @@ int32_t OH_NativeWindow_GetSurfaceId(OHNativeWindow *window, uint64_t *surfaceId /** * @brief Creates an OHNativeWindow instance.\n - * This interface needs to be used in conjunction with OH_NativeWindow_DestroyNativeWindow<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_DestroyNativeWindow, * otherwise memory leaks will occur.\n * If there is a concurrent destroy OHNativeWindow, you need to add once and decrement once to the - * OHNativeWindow reference count through OH_NativeWindow_NativeObjectReference<\b> and - * OH_NativeWindow_NativeObjectUnreference<\b>.\n + * OHNativeWindow reference count through OH_NativeWindow_NativeObjectReference and + * OH_NativeWindow_NativeObjectUnreference.\n * If the surface obtained through surfaceId is created in this process, the surface cannot be obtained * across processes.\n * This interface is a non-thread-safe type interface.\n @@ -775,7 +783,7 @@ int32_t OH_NativeWindow_ReadFromParcel(OHIPCParcel *parcel, OHNativeWindow **win /** * @brief Get the last flushed OHNativeWindowBuffer from an OHNativeWindow instance.\n * When the fenceFd is used up, you need to close it.\n - * This interface needs to be used in conjunction with OH_NativeWindow_NativeObjectUnreference<\b>, + * This interface needs to be used in conjunction with OH_NativeWindow_NativeObjectUnreference, * otherwise memory leaks will occur.\n * This interface is a non-thread-safe type interface.\n * @@ -860,6 +868,21 @@ int32_t OH_NativeWindow_SetMetadataValue(OHNativeWindow *window, OH_NativeBuffer */ int32_t OH_NativeWindow_GetMetadataValue(OHNativeWindow *window, OH_NativeBuffer_MetadataKey metadataKey, int32_t *size, uint8_t **metadata); + +/** + * @brief Clean all OHNativeWindowBuffer caches of this OHNativeWindow + * This interface is a non-thread-safe type interface.\n + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeWindow + * @param window Indicates the pointer to a OHNativeWindow instance. + * @return {@link NATIVE_ERROR_OK} 0 - Success. + * {@link NATIVE_ERROR_INVALID_ARGUMENTS} 40001000 - window is NULL. + * {@link NATIVE_ERROR_CONSUMER_DISCONNECTED} 41211000 - the consumer is disconnected. + * {@link NATIVE_ERROR_BINDER_ERROR} 50401000 - ipc send failed. + * @since 18 + * @version 1.0 + */ +int32_t OH_NativeWindow_CleanCache(OHNativeWindow *window); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_window/graphic_error_code.h b/graphic/graphic_2d/native_window/graphic_error_code.h index 1b5e9deb0166e9817bf5cf1f8a600f73ef53c5dd..fe1df86f5c29ca60c4afae5d6b519a95e7124115 100644 --- a/graphic/graphic_2d/native_window/graphic_error_code.h +++ b/graphic/graphic_2d/native_window/graphic_error_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef INCLUDE_GRAPHIC_ERROR_CODE_H -#define INCLUDE_GRAPHIC_ERROR_CODE_H - /** * @addtogroup NativeWindow * @{ @@ -39,6 +36,9 @@ * @version 1.0 */ +#ifndef INCLUDE_GRAPHIC_ERROR_CODE_H +#define INCLUDE_GRAPHIC_ERROR_CODE_H + #include #ifdef __cplusplus @@ -52,6 +52,11 @@ extern "C" { typedef enum OHNativeErrorCode { /** @error succeed */ NATIVE_ERROR_OK = 0, + /** + * @error memory operation error + * @since 15 + */ + NATIVE_ERROR_MEM_OPERATION_ERROR = 30001000, /** @error input invalid parameter */ NATIVE_ERROR_INVALID_ARGUMENTS = 40001000, /** @error unauthorized operation */ diff --git a/graphic/graphic_2d/native_window/libnative_window.ndk.json b/graphic/graphic_2d/native_window/libnative_window.ndk.json index 375d3e034a2f351b1f9964c6a8fef025a40f359a..ded24b2e8c3ab737e1f77313164f80f0920b1e59 100644 --- a/graphic/graphic_2d/native_window/libnative_window.ndk.json +++ b/graphic/graphic_2d/native_window/libnative_window.ndk.json @@ -50,6 +50,10 @@ { "first_introduced": "12", "name": "OH_NativeWindow_GetMetadataValue" + }, + { + "first_introduced": "18", + "name": "OH_NativeWindow_CleanCache" } ] \ No newline at end of file diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index e4f847bacd84bfe22dea5f15569fcdd1ced9995e..07333c78149d308030bc3c6c1693cec052915417 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 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 @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIAPPEVENT_H -#define HIVIEWDFX_HIAPPEVENT_H /** * @addtogroup HiAppEvent * @{ @@ -25,9 +23,6 @@ * events reported during running. Based on event information, you will be able to analyze the running status of * applications. * - * @kit PerformanceAnalysisKit - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * * @since 8 * @version 1.0 */ @@ -71,10 +66,16 @@ * OH_HiAppEvent_DestroyParamList(list); * * + * @kit PerformanceAnalysisKit + * @library libhiappevent_ndk.z.so + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 8 * @version 1.0 */ +#ifndef HIVIEWDFX_HIAPPEVENT_H +#define HIVIEWDFX_HIAPPEVENT_H + #include #include @@ -86,6 +87,30 @@ extern "C" { #endif +/** + * @brief Defines error code + * + * @since 15 + */ +typedef enum { + /** @error The operation is successful. */ + HIAPPEVENT_SUCCESS = 0, + /** @error Invalid param value length */ + HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH = 4, + /** @error Processor is null */ + HIAPPEVENT_PROCESSOR_IS_NULL = -7, + /** @error Processor not found */ + HIAPPEVENT_PROCESSOR_NOT_FOUND = -8, + /** @error Invalid param value */ + HIAPPEVENT_INVALID_PARAM_VALUE = -9, + /** @error event config is null */ + HIAPPEVENT_EVENT_CONFIG_IS_NULL = -10, + /** @error Operate failed */ + HIAPPEVENT_OPERATE_FAILED = -100, + /** @error Invalid uid */ + HIAPPEVENT_INVALID_UID = -200 +} HiAppEvent_ErrorCode; + /** * @brief Event types. * @@ -163,6 +188,20 @@ typedef struct ParamListNode* ParamList; */ typedef struct HiAppEvent_Watcher HiAppEvent_Watcher; +/** + * @brief The HiAppEvent_Processor structure is designed for event report. + * + * @since 18 + */ +typedef struct HiAppEvent_Processor HiAppEvent_Processor; + +/** + * @brief The HiAppEvent_Config structure is designed for configuration. + * + * @since 15 + */ +typedef struct HiAppEvent_Config HiAppEvent_Config; + /** * @brief The OH_HiAppEvent_OnReceive function acts as the callback function for the HiAppEvent_Watcher. It is called * when an event occurs. @@ -609,6 +648,205 @@ int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); * @version 1.0 */ void OH_HiAppEvent_ClearData(); + +/** + * @brief Create a HiAppEvent_Processor handler pointer to set the property. + * + * @param name The name of the processor. + * @return Returns a pointer to the HiAppEvent_Processor instance. + * @since 18 + */ +HiAppEvent_Processor* OH_HiAppEvent_CreateProcessor(const char* name); + +/** + * @brief The interface to set route for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param appId The appid of the processor. + * @param routeInfo The server location information. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH} Invalid param value length. + * @since 18 + */ +int OH_HiAppEvent_SetReportRoute(HiAppEvent_Processor* processor, const char* appId, const char* routeInfo); + +/** + * @brief The interface to set policy for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param periodReport The time interval to report. + * @param batchReport The threthold to report. + * @param onStartReport The strategy to report. + * @param onBackgroundReport The strategy to report. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * @since 18 + */ +int OH_HiAppEvent_SetReportPolicy(HiAppEvent_Processor* processor, int periodReport, int batchReport, + bool onStartReport, bool onBackgroundReport); + +/** + * @brief The interface to set report event for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param domain The event domain to report. + * @param name The event name to report. + * @param isRealTime The strategy to report. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * @since 18 + */ +int OH_HiAppEvent_SetReportEvent(HiAppEvent_Processor* processor, const char* domain, const char* name, + bool isRealTime); + +/** + * @brief The interface to set config for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param key The custom key of processor. + * @param value The custom value of processor. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH} Invalid param value length. + * @since 18 + */ +int OH_HiAppEvent_SetCustomConfig(HiAppEvent_Processor* processor, const char* key, const char* value); + +/** + * @brief The interface to set configId for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param configId The configId of processor. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * @since 18 + */ +int OH_HiAppEvent_SetConfigId(HiAppEvent_Processor* processor, int configId); + +/** + * @brief The interface to set user info for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param userIdNames The userIdNames of processor. + * @param size The size of userIdNames array. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH} Invalid param value length. + * @since 18 + */ +int OH_HiAppEvent_SetReportUserId(HiAppEvent_Processor* processor, const char* const * userIdNames, int size); + +/** + * @brief The interface to set user property for processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @param userPropertyNames The userPropertyNames of processor. + * @param size The size of userPropertyNames array. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE_LENGTH} Invalid param value length. + * @since 18 + */ +int OH_HiAppEvent_SetReportUserProperty(HiAppEvent_Processor* processor, const char* const * userPropertyNames, + int size); + +/** + * @brief The interface to add processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @return process id if set is successful. + * {@link HIAPPEVENT_PROCESSOR_IS_NULL} The processor is nullptr. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} Invalid Param value. + * {@link HIAPPEVENT_OPERATE_FAILED} Name not found or register processor error. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * @since 18 + */ +int64_t OH_HiAppEvent_AddProcessor(HiAppEvent_Processor* processor); + +/** + * @brief The interface to destroy processor. + * + * @param processor The pointer to the HiAppEvent_Processor instance. + * @since 18 + */ +void OH_HiAppEvent_DestroyProcessor(HiAppEvent_Processor* processor); + +/** + * @brief The interface to remove processor. + * + * @param processorId The id of the processor. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_PROCESSOR_NOT_FOUND} Processor not add. + * {@link HIAPPEVENT_OPERATE_FAILED} The operation is failed. + * {@link HIAPPEVENT_INVALID_UID} Invalid uid. + * @since 18 + */ +int OH_HiAppEvent_RemoveProcessor(int64_t processorId); + +/** + * @brief Create a HiAppEvent_Config handler pointer to set the config. + * + * @return Returns a pointer to the HiAppEvent_Config instance. + * @since 15 + */ +HiAppEvent_Config* OH_HiAppEvent_CreateConfig(void); + +/** + * @brief Destroy the specified HiAppEvent_Config handle resource. + * + * @param config The pointer to the HiAppEvent_Config instance. + * @since 15 + */ +void OH_HiAppEvent_DestroyConfig(HiAppEvent_Config* config); + +/** + * @brief The interface to set item to the config. + * + * @param config The pointer to the HiAppEvent_Config instance. + * @param itemName The name of config item. + * @param itemValue The value of config item. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_EVENT_CONFIG_IS_NULL} The event config is null. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} The item is invalid. + * @since 15 + */ +int OH_HiAppEvent_SetConfigItem(HiAppEvent_Config* config, const char* itemName, const char* itemValue); + +/** + * @brief The interface to set the config. + * + * @param name The name of the os event. + * @param config The pointer to the HiAppEvent_Config instance. + * @return set result. + * {@link HIAPPEVENT_SUCCESS} The operation is successful. + * {@link HIAPPEVENT_INVALID_PARAM_VALUE} The config is invalid. + * @since 15 + */ +int OH_HiAppEvent_SetEventConfig(const char* name, HiAppEvent_Config* config); #ifdef __cplusplus } #endif diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_cfg.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_cfg.h index 7a6d6a2f8c0ef267066f6e617a616523cb8ab028..eb571995538b8b4059707cd457b23a3a82e9cb25 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_cfg.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_cfg.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIAPPEVENT_CONFIG_H -#define HIVIEWDFX_HIAPPEVENT_CONFIG_H - /** * @addtogroup HiAppEvent * @{ @@ -26,9 +23,6 @@ * events reported during running. Based on event information, you will be able to analyze the running status of * applications. * - * @kit PerformanceAnalysisKit - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * * @since 8 * @version 1.0 */ @@ -45,10 +39,16 @@ * bool res = OH_HiAppEvent_Configure(MAX_STORAGE, "100M"); * * + * @kit PerformanceAnalysisKit + * @library libhiappevent_ndk.z.so + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 8 * @version 1.0 */ +#ifndef HIVIEWDFX_HIAPPEVENT_CONFIG_H +#define HIVIEWDFX_HIAPPEVENT_CONFIG_H + #ifdef __cplusplus extern "C" { #endif diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h index c14564794fc683e86dad3663a08ec2a03826b779..63dc8cf01461d7d464400904b94cff1dfc51f386 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIAPPEVENT_EVENT_H -#define HIVIEWDFX_HIAPPEVENT_EVENT_H - /** * @addtogroup HiAppEvent * @{ @@ -26,9 +23,6 @@ * events reported during running. Based on event information, you will be able to analyze the running status of * applications. * - * @kit PerformanceAnalysisKit - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * * @since 8 * @version 1.0 */ @@ -48,10 +42,16 @@ * OH_HiAppEvent_DestroyParamList(list); * * + * @kit PerformanceAnalysisKit + * @library libhiappevent_ndk.z.so + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 8 * @version 1.0 */ +#ifndef HIVIEWDFX_HIAPPEVENT_EVENT_H +#define HIVIEWDFX_HIAPPEVENT_EVENT_H + #ifdef __cplusplus extern "C" { #endif @@ -152,6 +152,14 @@ extern "C" { */ #define EVENT_MAIN_THREAD_JANK "MAIN_THREAD_JANK" +/** + * @brief app hicollie event. + * + * @since 18 + * @version 1.0 + */ +#define EVENT_APP_HICOLLIE "APP_HICOLLIE" + /** * @brief OS domain. * diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_param.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_param.h index ec984a36adfb1079d3f12349dc50753ca8a6886e..683bdabc204d2ca637104d8c4ac05dadcd898a16 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_param.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_param.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H -#define HIVIEWDFX_HIAPPEVENT_PARAM_H - /** * @addtogroup HiAppEvent * @{ @@ -26,9 +23,6 @@ * events reported during running. Based on event information, you will be able to analyze the running status of * applications. * - * @kit PerformanceAnalysisKit - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * * @since 8 * @version 1.0 */ @@ -48,9 +42,16 @@ * OH_HiAppEvent_DestroyParamList(list); * * + * @kit PerformanceAnalysisKit + * @library libhiappevent_ndk.z.so + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 8 * @version 1.0 */ + +#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H +#define HIVIEWDFX_HIAPPEVENT_PARAM_H + #ifdef __cplusplus extern "C" { #endif diff --git a/hiviewdfx/hiappevent/libhiappevent.ndk.json b/hiviewdfx/hiappevent/libhiappevent.ndk.json index 8e28e566194791e09be983bf1ce69bbd33ed0007..98c62ebeb65bc817b449d7317bca0ced0b136539 100644 --- a/hiviewdfx/hiappevent/libhiappevent.ndk.json +++ b/hiviewdfx/hiappevent/libhiappevent.ndk.json @@ -98,5 +98,65 @@ { "first_introduced": "12", "name": "OH_HiAppEvent_ClearData" + }, + { + "first_introduced": "15", + "name": "OH_HiAppEvent_CreateConfig" + }, + { + "first_introduced": "15", + "name": "OH_HiAppEvent_DestroyConfig" + }, + { + "first_introduced": "15", + "name": "OH_HiAppEvent_SetConfigItem" + }, + { + "first_introduced": "15", + "name": "OH_HiAppEvent_SetEventConfig" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_CreateProcessor" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetReportRoute" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetReportPolicy" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetReportEvent" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetCustomConfig" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetConfigId" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetReportUserId" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_SetReportUserProperty" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_AddProcessor" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_DestroyProcessor" + }, + { + "first_introduced": "18", + "name": "OH_HiAppEvent_RemoveProcessor" } ] diff --git a/hiviewdfx/hicollie/include/hicollie/hicollie.h b/hiviewdfx/hicollie/include/hicollie/hicollie.h index de146b7fed58c5e9079648ed4fe7992c73b4187a..794fd3c6deb34d29156715b00ce1dc05ec0128c5 100644 --- a/hiviewdfx/hicollie/include/hicollie/hicollie.h +++ b/hiviewdfx/hicollie/include/hicollie/hicollie.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HICOLLIE_H -#define HIVIEWDFX_HICOLLIE_H - /** * @addtogroup HiCollie * @{ @@ -41,6 +38,9 @@ * @since 12 */ +#ifndef HIVIEWDFX_HICOLLIE_H +#define HIVIEWDFX_HICOLLIE_H + #include #include @@ -62,6 +62,26 @@ typedef enum HiCollie_ErrorCode { HICOLLIE_WRONG_THREAD_CONTEXT = 29800001, /** Remote call failed */ HICOLLIE_REMOTE_FAILED = 29800002, + /** + * Invalid timer name + * @since 18 + */ + HICOLLIE_INVALID_TIMER_NAME = 29800003, + /** + * Invalid timeout value + * @since 18 + */ + HICOLLIE_INVALID_TIMEOUT_VALUE = 29800004, + /** + * Wrong process context + * @since 18 + */ + HICOLLIE_WRONG_PROCESS_CONTEXT = 29800005, + /** + * The pointer used to save returned timer id should not be NULL + * @since 18 + */ + HICOLLIE_WRONG_TIMER_ID_OUTPUT_PARAM = 29800006, } HiCollie_ErrorCode; /** @@ -123,6 +143,19 @@ typedef struct HiCollie_DetectionParam { */ HiCollie_ErrorCode OH_HiCollie_Init_StuckDetection(OH_HiCollie_Task task); +/** + * @brief Set up periodic tasks for stuck detection. + * + * @param task Periodic task executed every stuckTimeout seconds. + * @param stuckTimeout Stuck detection interval. + * @return {@link HICOLLIE_SUCCESS} 0 - Success. + * {@link HICOLLIE_INVALID_ARGUMENT} 401 - stuckTimeout is less than 3 seconds and greater than 15 seconds. + * {@link HICOLLIE_WRONG_THREAD_CONTEXT} 29800001 - Wrong thread context + * The function can not be called from main thread. + * @since 18 + */ +HiCollie_ErrorCode OH_HiCollie_Init_StuckDetectionWithTimeout(OH_HiCollie_Task task, uint32_t stuckTimeout); + /** * @brief Set up stub functions for jank detection. * @@ -154,6 +187,72 @@ HiCollie_ErrorCode OH_HiCollie_Init_JankDetection(OH_HiCollie_BeginFunc* beginFu */ HiCollie_ErrorCode OH_HiCollie_Report(bool* isSixSecond); +/** + * @brief When user call {@link OH_HiCollie_SetTimer} and do not call {@link OH_HiCollie_CancelTimer} + * in specific time, the callback function will be executed. + * + * @since 18 + */ +typedef void (*OH_HiCollie_Callback)(void*); + +/** + * @brief Defines the actions that will be executed when timeout happens. + * + * @since 18 + */ +typedef enum HiCollie_Flag { + /** Default action is generate log file and do recovery */ + HICOLLIE_FLAG_DEFAULT = (~0), + /* Do nothing except call the callback function */ + HICOLLIE_FLAG_NOOP = (0), + /* Generate log file */ + HICOLLIE_FLAG_LOG = (1 << 0), + /* Do recovery by call the exit syscall */ + HICOLLIE_FLAG_RECOVERY = (1 << 1) +} HiCollie_Flag; + +/** +* @brief Defines the input parameter for {@link OH_HiCollie_SetTimer} +* +* @since 18 +*/ +typedef struct HiCollie_SetTimerParam { + /** The timer name */ + const char *name; + /** The timeout threshold in seconds */ + unsigned int timeout; + /** The callback function which is excuted when timeout happen */ + OH_HiCollie_Callback func; + /** The callback function's parameter */ + void *arg; + /** The action when timeout happens. Please refer to {@link HiCollie_Flag} */ + HiCollie_Flag flag; +} HiCollie_SetTimerParam; + +/** + * @brief This function should be used before calling a time-consuming function + * + * @param param Define the input parameter. + * @param id The pointer used to save returned timer id, it should not be NULL. + * @return {@link HICOLLIE_SUCCESS} 0 - Success. + * {@link HICOLLIE_INVALID_TIMER_NAME} 29800003 - Invalid timer name, it should not be NULL or empty string. + * {@link HICOLLIE_INVALID_TIMEOUT_VALUE} 29800004 - Invalid timeout value. + * {@link HICOLLIE_WRONG_PROCESS_CONTEXT} 29800005 - Invalid process context, you should not call it + * from appspawn and native process. + * {@link HICOLLIE_WRONG_TIMER_ID_OUTPUT_PARAM} 29800006 - The pointer used to save returned timer id + * should not be NULL. + * @since 18 + */ +HiCollie_ErrorCode OH_HiCollie_SetTimer(HiCollie_SetTimerParam param, int *id); + +/** + * @brief Cancel the timer right after calling the time-consuming function. + * + * @param id The timer id that is return from {@link OH_HiCollie_SetTimer}. + * @since 18 + */ +void OH_HiCollie_CancelTimer(int id); + #ifdef __cplusplus } #endif diff --git a/hiviewdfx/hicollie/libhicollie.ndk.json b/hiviewdfx/hicollie/libhicollie.ndk.json index 4684c9899bea60c0b7c796029f251dac8e8b8479..095797ad209982f6b9bdf341dcf863d658c4aefd 100644 --- a/hiviewdfx/hicollie/libhicollie.ndk.json +++ b/hiviewdfx/hicollie/libhicollie.ndk.json @@ -10,5 +10,13 @@ { "first_introduced": "12", "name": "OH_HiCollie_Report" + }, + { + "first_introduced": "18", + "name": "OH_HiCollie_SetTimer" + }, + { + "first_introduced": "18", + "name": "OH_HiCollie_CancelTimer" } ] diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h index cd9eaa82844da58e65028b6c1a82b6695312152a..5cea6408ac506f6a99ddffe3d28486381fd6ef4b 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIDEBUG_H -#define HIVIEWDFX_HIDEBUG_H /** * @addtogroup HiDebug * @{ @@ -37,6 +35,9 @@ * @since 12 */ +#ifndef HIVIEWDFX_HIDEBUG_H +#define HIVIEWDFX_HIDEBUG_H + #include #include "hidebug_type.h" @@ -146,7 +147,7 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture(); * {@link HIDEBUG_SUCCESS} Get graphics memory success. * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument,value is null. * {@link HIDEBUG_TRACE_ABNORMAL} Failed to get the application memory due to a remote exception. - * @since 13 + * @since 14 */ HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value); diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h index 6976244e2695464cb9e82c069e8e1a96859bee14..e38ad40e055964356831f240f8d7c60f217031bc 100644 --- a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h +++ b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIDEBUG_TYPE_H -#define HIVIEWDFX_HIDEBUG_TYPE_H /** * @addtogroup HiDebug * @{ @@ -37,6 +35,9 @@ * @since 12 */ +#ifndef HIVIEWDFX_HIDEBUG_TYPE_H +#define HIVIEWDFX_HIDEBUG_TYPE_H + #include #ifdef __cplusplus diff --git a/hiviewdfx/hidebug/libhidebug.ndk.json b/hiviewdfx/hidebug/libhidebug.ndk.json index 45be9500bc49dbe861892b3f955f4513901afac9..02d50bda96c7ac0c98dcb5b9274727d7d20f423d 100644 --- a/hiviewdfx/hidebug/libhidebug.ndk.json +++ b/hiviewdfx/hidebug/libhidebug.ndk.json @@ -36,7 +36,7 @@ "name": "OH_HiDebug_StopAppTraceCapture" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_HiDebug_GetGraphicsMemory" } ] \ No newline at end of file diff --git a/hiviewdfx/hilog/include/hilog/log.h b/hiviewdfx/hilog/include/hilog/log.h index 829eee92ef685d2fc0c7ba397fe503b951a756b8..1c4cda70470867aa3a89f12d025251f6c9742567 100644 --- a/hiviewdfx/hilog/include/hilog/log.h +++ b/hiviewdfx/hilog/include/hilog/log.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HILOG_H -#define HIVIEWDFX_HILOG_H /** * @addtogroup HiLog * @{ @@ -57,8 +55,15 @@ * Output result:\n * 05-06 15:01:06.870 1051 1051 W 0201/MY_TAG: Failed to visit , reason:503.\n * + * @library libhilog.so + * @syscap SystemCapability.HiviewDFX.HiLog * @since 8 */ + +#ifndef HIVIEWDFX_HILOG_H +#define HIVIEWDFX_HILOG_H + +#include #include #include @@ -151,6 +156,69 @@ typedef enum { int OH_LOG_Print(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) __attribute__((__format__(os_log, 5, 6))); +/** + * @brief Outputs logs. + * + * You can use this function to output logs based on the specified log type, log level, service domain, log tag, + * and message text. + * + * @param type Indicates the log type. The type for third-party applications is defined by {@link LOG_APP}. + * @param level Indicates the log level, which can be LOG_DEBUG, LOG_INFO, LOG_WARN, + * LOG_ERROR, and LOG_FATAL. + * @param domain Indicates the service domain of logs. Its value is a hexadecimal integer ranging from 0x0 to 0xFFFF. + * @param tag Indicates the log tag, which is a string used to identify the class, file, or service behavior. + * @param message Indicates the log string. + * @return Returns 0 or a larger value if the operation is successful; returns a value smaller + * than 0 otherwise. + * @since 18 + */ +int OH_LOG_PrintMsg(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *message); + +/** + * @brief Outputs logs. + * + * You can use this function to output logs based on the specified log type, log level, service domain, log tag, + * message text and message length. + * + * @param type Indicates the log type. The type for third-party applications is defined by {@link LOG_APP}. + * @param level Indicates the log level, which can be LOG_DEBUG, LOG_INFO, LOG_WARN, + * LOG_ERROR, and LOG_FATAL. + * @param domain Indicates the service domain of logs. Its value is a hexadecimal integer ranging from 0x0 to 0xFFFF. + * @param tag Indicates the log tag, which is a string used to identify the class, file, or service behavior. + * @param tagLen Indicates the length of tag. + * @param message Indicates the log string. + * @param messageLen Indicates the length of message. + * @return Returns 0 or a larger value if the operation is successful; returns a value smaller + * than 0 otherwise. + * @since 18 + */ +int OH_LOG_PrintMsgByLen(LogType type, LogLevel level, unsigned int domain, const char *tag, size_t tagLen, + const char *message, size_t messageLen); + +/** + * @brief Outputs logs. + * + * You can use this function to output logs based on the specified log type, log level, service domain, log tag, + * and a va_list instead of variable parameters determined by the format specifier and privacy identifier in the printf + * format. + * + * @param type Indicates the log type. The type for third-party applications is defined by {@link LOG_APP}. + * @param level Indicates the log level, which can be LOG_DEBUG, LOG_INFO, LOG_WARN, + * LOG_ERROR, and LOG_FATAL. + * @param domain Indicates the service domain of logs. Its value is a hexadecimal integer ranging from 0x0 to 0xFFFF. + * @param tag Indicates the log tag, which is a string used to identify the class, file, or service behavior. + * @param fmt Indicates the format string, which is an enhancement of a printf format string and supports the privacy + * identifier. Specifically, {public} or {private} is added between the % character and the format specifier + * in each parameter. \n + * @param ap Indicates a list of parameters. The number and type of parameters must map onto the format specifiers + * in the format string. + * @return Returns 0 or a larger value if the operation is successful; returns a value smaller + * than 0 otherwise. + * @since 18 + */ +int OH_LOG_VPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, va_list ap) + __attribute__((__format__(os_log, 5, 0))); + /** * @brief Checks whether logs of the specified service domain, log tag, and log level can be output. * @@ -275,6 +343,14 @@ typedef void (*LogCallback)(const LogType type, const LogLevel level, const unsi */ void OH_LOG_SetCallback(LogCallback callback); +/** + * @brief Sets the lowest log level of the current application process. + * + * @param level log level + * @since 15 + */ +void OH_LOG_SetMinLogLevel(LogLevel level); + #ifdef __cplusplus } #endif diff --git a/hiviewdfx/hilog/libhilog.ndk.json b/hiviewdfx/hilog/libhilog.ndk.json index 2ca6bed2c0d93fcd9fbb3046ff370f17c696ba7e..0d14010e04c1ea7dffaef8c2a1e89a2dc7a6e037 100644 --- a/hiviewdfx/hilog/libhilog.ndk.json +++ b/hiviewdfx/hilog/libhilog.ndk.json @@ -7,5 +7,17 @@ }, { "name": "OH_LOG_SetCallback" + }, + { + "name": "OH_LOG_PrintMsg" + }, + { + "name": "OH_LOG_PrintMsgByLen" + }, + { + "name": "OH_LOG_VPrint" + }, + { + "name": "OH_LOG_SetMinLogLevel" } ] diff --git a/hiviewdfx/hitrace/include/hitrace/trace.h b/hiviewdfx/hitrace/include/hitrace/trace.h index e771136da9160fc003c6c681e181a3b0631ed8f1..4dcf2c51e49c98c0e7429582bb95be62900829f3 100644 --- a/hiviewdfx/hitrace/include/hitrace/trace.h +++ b/hiviewdfx/hitrace/include/hitrace/trace.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HITRACE_H -#define HIVIEWDFX_HITRACE_H /** * @addtogroup Hitrace * @{ @@ -64,6 +62,10 @@ * @syscap SystemCapability.HiviewDFX.HiTrace * @since 10 */ + +#ifndef HIVIEWDFX_HITRACE_H +#define HIVIEWDFX_HITRACE_H + #include #include @@ -291,6 +293,45 @@ typedef enum HiTrace_Communication_Mode { HITRACE_CM_DEVICE = 3, } HiTrace_Communication_Mode; +/** + * @brief Enumerates the HiTrace output levels. The output level threshold system parameter determines + * the minimum output trace. + * + * @since 18 + */ +typedef enum HiTrace_Output_Level { + /** + * @brief Ouput level only for debug usage. + * + * @since 18 + */ + HITRACE_LEVEL_DEBUG = 0, + /** + * @brief Output level for beta version usage. + * + * @since 18 + */ + HITRACE_LEVEL_INFO = 1, + /** + * @brief Output level for beta version usage, with higher priority than HITRACE_LEVEL_INFO. + * + * @since 18 + */ + HITRACE_LEVEL_CRITICAL = 2, + /** + * @brief Output level for commercial version usage. + * + * @since 18 + */ + HITRACE_LEVEL_COMMERCIAL = 3, + /** + * @brief Output level for range limit. + * + * @since 18 + */ + HITRACE_LEVEL_MAX = HITRACE_LEVEL_COMMERCIAL, +} HiTrace_Output_Level; + /** * @brief Defines a HiTraceId instance. * @@ -682,7 +723,99 @@ void OH_HiTrace_FinishAsyncTrace(const char *name, int32_t taskId); */ void OH_HiTrace_CountTrace(const char *name, int64_t count); +/** + * @brief Marks the start of a synchronous trace task with output level control. + * + * The OH_HiTrace_StartTraceEx and OH_HiTrace_FinishTraceEx APIs must be used in pairs. + * The two APIs can be used in nested mode. The stack data structure is used for matching during trace data parsing. + * + * @param level Level of output priority. + * @param name Name of a trace task. + * @param customArgs key=value pair, multiple pairs use comma as seperator. + * @atomicservice + * @since 18 + */ +void OH_HiTrace_StartTraceEx(HiTrace_Output_Level level, const char* name, const char* customArgs); + +/** + * @brief Marks the end of a synchronous trace task with output level control. + * + * This API must be used with OH_HiTrace_StartTraceEx in pairs. During trace data parsing, the system matches + * it with the most recent OH_HiTrace_StartTraceEx API invocation in the service process. + * + * @param level Level of output priority. + * @atomicservice + * @since 18 + */ +void OH_HiTrace_FinishTraceEx(HiTrace_Output_Level level); + +/** + * @brief Marks the start of an asynchronous trace task with output level control. + * + * This API is called to implement performance trace in asynchronous manner. The start and end of an asynchronous + * trace task do not occur in sequence. Therefore, a unique taskId is required to ensure proper data parsing. + * It is passed as an input parameter for the asynchronous API. + * This API is used with OH_HiTrace_FinishAsyncTraceEx in pairs. The two APIs, which have the same level, + * name, and task ID, form an asynchronous timeslice trace task. + * If customCategory is specified, the trace slice will be grouped and displayed together with other trace slices + * with the same customCategory. + * If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be + * performed multiple times concurrently, different task IDs must be specified in OH_HiTrace_StartAsyncTraceEx. + * If the trace tasks with the same name are not performed at the same time, the same taskId can be used. + * Different processes's taskId do not interfere. + * + * @param level Level of output priority. + * @param name Name of the asynchronous trace task. + * @param taskId ID of the asynchronous trace task. + * @param customCategory Label used to aggregate the asynchronous trace. + * @param customArgs key=value pair, multiple pairs use comma as seperator. + * @atomicservice + * @since 18 + */ +void OH_HiTrace_StartAsyncTraceEx(HiTrace_Output_Level level, const char* name, int32_t taskId, + const char* customCategory, const char* customArgs); + +/** + * @brief Marks the end of an asynchronous trace task with output level control. + * + * This API is called in the callback function after an asynchronous trace is complete. + * It is used with OH_HiTrace_StartAsyncTraceEx in pairs. Its level, name, and task ID must be + * the same as those of OH_HiTrace_StartAsyncTraceEx. + * + * @param level Level of output priority. + * @param name Name of the asynchronous trace task. + * @param taskId ID of the asynchronous trace task. + * @atomicservice + * @since 18 + */ +void OH_HiTrace_FinishAsyncTraceEx(HiTrace_Output_Level level, const char* name, int32_t taskId); + +/** + * @brief Traces the value change of an integer variable based on its name with output level control. + * + * This API can be executed for multiple times to trace the value change of a given integer variable at different + * time points. + * + * @param level Level of output priority. + * @param name Name of the integer variable. It does not need to be the same as the real variable name. + * @param count Integer value. Generally, an integer variable can be passed. + * @atomicservice + * @since 18 + */ +void OH_HiTrace_CountTraceEx(HiTrace_Output_Level level, const char* name, int64_t count); + +/** + * @brief Get the trace output status of the calling process. + * + * @return Returns whether the calling process is allowed to output trace. + * @atomicservice + * @since 18 + */ +bool OH_HiTrace_IsTraceEnabled(); + #ifdef __cplusplus } #endif +/** @} */ + #endif // HIVIEWDFX_HITRACE_H diff --git a/inputmethod/include/inputmethod_attach_options_capi.h b/inputmethod/include/inputmethod_attach_options_capi.h index 3a12eaba6db8ce50052d6275fe91703e200b4e2d..8fc8fafaec06fc2beedd98f4d729bd365fd5a9cd 100644 --- a/inputmethod/include/inputmethod_attach_options_capi.h +++ b/inputmethod/include/inputmethod_attach_options_capi.h @@ -56,6 +56,17 @@ typedef struct InputMethod_AttachOptions InputMethod_AttachOptions; * @since 12 */ InputMethod_AttachOptions *OH_AttachOptions_Create(bool showKeyboard); +/** + * @brief Create a new {@link InputMethod_AttachOptions} instance. + * + * @param showKeyboard Represents whether to show the keyboard. + * @param requestKeyboardReason the reason for showKeyboard. + * @return If the creation succeeds, a pointer to the newly created {@link InputMethod_AttachOptions} + * instance is returned. If the creation fails, NULL is returned, possible cause is insufficient memory. + * @since 15 + */ +InputMethod_AttachOptions *OH_AttachOptions_CreateWithRequestKeyboardReason( + bool showKeyboard, InputMethod_RequestKeyboardReason requestKeyboardReason); /** * @brief Delete a {@link InputMethod_AttachOptions} instance. * @@ -77,6 +88,20 @@ void OH_AttachOptions_Destroy(InputMethod_AttachOptions *options); * @since 12 */ InputMethod_ErrorCode OH_AttachOptions_IsShowKeyboard(InputMethod_AttachOptions *options, bool *showKeyboard); +/** + * @brief Get showKeyboard value from {@link InputMethod_AttachOptions}. + * + * @param options Represents a pointer to an {@link InputMethod_AttachOptions} instance which will be get value from. + * @param requestKeyboardReason Represents a pointer to an {@link InputMethodRequestKeyboardReason} instance which will + * be get value from. + * @return Returns a specific error code. + * {@link IME_ERR_OK} - success. + * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. If options is NULL, or requestKeyboardReason is NULL. + * Specific error codes can be referenced {@link InputMethod_ErrorCode}. + * @since 15 + */ +InputMethod_ErrorCode OH_AttachOptions_GetRequestKeyboardReason( + InputMethod_AttachOptions *options, int *requestKeyboardReason); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/inputmethod/include/inputmethod_inputmethod_proxy_capi.h b/inputmethod/include/inputmethod_inputmethod_proxy_capi.h index c0ae0a12c2d4b3aa86c9147fdd93b641b7b906de..7e13515edc85245bba3b46a613eec1c8be7f2f60 100644 --- a/inputmethod/include/inputmethod_inputmethod_proxy_capi.h +++ b/inputmethod/include/inputmethod_inputmethod_proxy_capi.h @@ -37,6 +37,7 @@ #include #include "inputmethod_types_capi.h" +#include "inputmethod_attach_options_capi.h" #include "inputmethod_cursor_info_capi.h" #include "inputmethod_private_command_capi.h" #ifdef __cplusplus @@ -60,13 +61,31 @@ typedef struct InputMethod_InputMethodProxy InputMethod_InputMethodProxy; * {@link IME_ERR_OK} - success. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 */ InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy); - +/** + * @brief ShowTextInput. + * + * @param inputMethodProxy Represents a pointer to an {@link InputMethod_InputMethodProxy} instance. + * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. + * @param options Represents a pointer to an {@link InputMethod_AttachOptions} instance which will be get value from. + * {@link ShowKeyboard} - property is always true,can not be changed,so no need to focus on + * {@link InputMethod_RequestKeyboardReason} - property is the requestKeyboardReason for show keyboard + * @return Returns a specific error code. + * {@link IME_ERR_OK} - success. + * {@link IME_ERR_IMCLIENT} - input method client error. + * {@link IME_ERR_IMMS} - input method manager service error. + * {@link IME_ERR_DETACHED} - input method client detached. + * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. If inputMethodProxy is NULL, or options is NULL. + * Specific error codes can be referenced {@link InputMethod_ErrorCode}. + * @since 15 + */ +InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput( + InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options); /** * @brief Hide keyboard. * @@ -76,7 +95,7 @@ InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodPr * {@link IME_ERR_OK} - success. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 @@ -99,7 +118,7 @@ InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodPr * {@link IME_ERR_PARAMCHECK} - parameter check failed. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 @@ -119,7 +138,7 @@ InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange( * {@link IME_ERR_PARAMCHECK} - parameter check failed. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 @@ -139,7 +158,7 @@ InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_ * {@link IME_ERR_PARAMCHECK} - parameter check failed. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 @@ -159,7 +178,7 @@ InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate( * {@link IME_ERR_PARAMCHECK} - parameter check failed. * {@link IME_ERR_IMCLIENT} - input method client error. * {@link IME_ERR_IMMS} - input method manager service error. - * {@link IME_ERR_DETACHED} - input method client is detached. + * {@link IME_ERR_DETACHED} - input method client detached. * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. * Specific error codes can be referenced {@link InputMethod_ErrorCode}. * @since 12 diff --git a/inputmethod/include/inputmethod_text_avoid_info_capi.h b/inputmethod/include/inputmethod_text_avoid_info_capi.h index a22590f6a9dcf2b52d29c2b9aa8102e5f1ce99c2..407197a67c9e56f8801976e0f4f2658fcae3769c 100644 --- a/inputmethod/include/inputmethod_text_avoid_info_capi.h +++ b/inputmethod/include/inputmethod_text_avoid_info_capi.h @@ -61,7 +61,7 @@ InputMethod_TextAvoidInfo *OH_TextAvoidInfo_Create(double positionY, double heig /** * @brief Destroy a {@link InputMethod_TextAvoidInfo} instance. * - * @param options Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be destroyed. + * @param info Represents a pointer to an {@link InputMethod_TextAvoidInfo} instance which will be destroyed. * @since 12 */ void OH_TextAvoidInfo_Destroy(InputMethod_TextAvoidInfo *info); diff --git a/inputmethod/include/inputmethod_types_capi.h b/inputmethod/include/inputmethod_types_capi.h index 2e1481335ef07ac802a3c0ef41b7afca1054f491..b3848f15f6d779339a57b65296ac86d34a726394 100644 --- a/inputmethod/include/inputmethod_types_capi.h +++ b/inputmethod/include/inputmethod_types_capi.h @@ -261,7 +261,7 @@ typedef enum InputMethod_ErrorCode { */ IME_ERR_PARAMCHECK = 401, /** - * @error The error code when the package manager error. + * @error The error code when the bundle manager error. */ IME_ERR_PACKAGEMANAGER = 12800001, /** @@ -273,7 +273,7 @@ typedef enum InputMethod_ErrorCode { */ IME_ERR_IMCLIENT = 12800003, /** - * @error The error code when configuration persisting error. + * @error The error code when configuration persistence error. */ IME_ERR_CONFIG_PERSIST = 12800005, /** @@ -289,7 +289,7 @@ typedef enum InputMethod_ErrorCode { */ IME_ERR_IMMS = 12800008, /** - * @error The error code when input method client is detached. + * @error The error code when input method client detached. */ IME_ERR_DETACHED = 12800009, /** @@ -301,6 +301,30 @@ typedef enum InputMethod_ErrorCode { */ IME_ERR_QUERY_FAILED = 12802001, } InputMethod_ErrorCode; + +/** + * @brief The value type of request keyboard. + * + * @since 15 + */ +typedef enum InputMethod_RequestKeyboardReason { + /** + * The request keyboard reason is NONE. + */ + IME_REQUEST_REASON_NONE = 0, + /** + * The request keyboard reason is MOUSE. + */ + IME_REQUEST_REASON_MOUSE = 1, + /** + * The request keyboard reason is TOUCH. + */ + IME_REQUEST_REASON_TOUCH = 2, + /** + * The request keyboard reason is OTHER. + */ + IME_REQUEST_REASON_OTHER = 20 +} InputMethod_RequestKeyboardReason; #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/inputmethod/libohinputmethodndk.json b/inputmethod/libohinputmethodndk.json index 0c026b2e6bc2707f68cfce8f01e07e2598cf5c3a..b90b67567c3b8bb0366ef47e86e6a3aa65ba126e 100644 --- a/inputmethod/libohinputmethodndk.json +++ b/inputmethod/libohinputmethodndk.json @@ -310,5 +310,17 @@ { "first_introduced": "12", "name": "OH_PrivateCommand_GetStrValue" + }, + { + "first_introduced": "15", + "name": "OH_InputMethodProxy_ShowTextInput" + }, + { + "first_introduced": "15", + "name": "OH_AttachOptions_CreateWithRequestKeyboardReason" + }, + { + "first_introduced": "15", + "name": "OH_AttachOptions_GetRequestKeyboardReason" } ] \ No newline at end of file diff --git a/lxc/test_two.h b/lxc/test_two.h new file mode 100644 index 0000000000000000000000000000000000000000..ca79e947e5d80587c92d465af9b0688d48570698 --- /dev/null +++ b/lxc/test_two.h @@ -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 ArkUI_TestModule + * @{ + * + * @brief this is example. + * @since 1 + */ + +/** + * @file test_two.h + * + * @brief this is kit example. + * + * @library example.so + * @kit BetaTest + * @syscap example.example.expamle + * @since 1 + */ + +#ifndef EXAMPLE_H +#define EXAMPLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief this enum example Enum_Class1734683861650. + * + * @since 1 + */ +typedef enum Enum_Class1734683861650 { + /** the enumInstance example VALUE_ONE1734683864306. */ + VALUE_ONE1734683864306 = 1, + + /** the enumInstance example VALUE_ONE1734683864953. */ + VALUE_ONE1734683864953 = 2, + /** the enumInstance example VALUE_ONE1734684408692. */ + VALUE_ONE1734684408692 = 3 +} Enum_Class; + +/** + * @brief this struct example My_Component1734683851578. + * + * @since 1 + */ +typedef struct { + /** Test number. */ + int32_t num; +} My_Component1734683851578; + +/** + * @brief the method example Test_Func1734684603092. + * + * @since 1 + */ +void Test_Func1734684603092(); + +/** + * @brief Hello. + * @since 1 + */ +typedef struct { + /** Test number. */ + int32_t num; +} My_Component1737339949763; + +#ifdef __cplusplus +} +#endif + +#endif // EXAMPLE_H + +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/audio_capturer/native_audiocapturer.h b/multimedia/audio_framework/audio_capturer/native_audiocapturer.h index 6daac56a3e1570e500c9185c9131d004cdb82a08..c3eb89ecb6d1a3f18395afa9818a3daee12c3d6d 100644 --- a/multimedia/audio_framework/audio_capturer/native_audiocapturer.h +++ b/multimedia/audio_framework/audio_capturer/native_audiocapturer.h @@ -149,7 +149,7 @@ OH_AudioStream_Result OH_AudioCapturer_GetLatencyMode(OH_AudioCapturer* capturer * @since 10 * * @param capturer Reference created by OH_AudioStreamBuilder_GenerateCapturer() - * @param stramId Pointer to a variable that will be set for the stream id. + * @param streamId Pointer to a variable that will be set for the stream id. * @return Function result code: * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of capturer is nullptr. @@ -288,4 +288,6 @@ OH_AudioStream_Result OH_AudioCapturer_GetOverflowCount(OH_AudioCapturer* captur #ifdef __cplusplus } #endif + #endif // NATIVE_AUDIOCAPTURER_H +/** @} */ diff --git a/multimedia/audio_framework/audio_manager/native_audio_manager.h b/multimedia/audio_framework/audio_manager/native_audio_manager.h index 24c37f94b8bf26a89666d3749e06d192c7272a86..8bfbf2c897d6b6c4c8b2b822ac0954874f3e33e1 100644 --- a/multimedia/audio_framework/audio_manager/native_audio_manager.h +++ b/multimedia/audio_framework/audio_manager/native_audio_manager.h @@ -66,7 +66,8 @@ OH_AudioCommon_Result OH_GetAudioManager(OH_AudioManager **audioManager); /** * @brief Get audio scene. - * @param audioManager the {@link OH_AudioManager} handle received from {@link OH_GetAudioManager}. + * + * @param manager the {@link OH_AudioManager} handle received from {@link OH_GetAudioManager}. * @param scene the {@link OH_AudioScene} pointer to receive the result. * @return Function result code: * {@link AUDIOCOMMON_RESULT_SUCCESS} If the execution is successful. @@ -80,5 +81,6 @@ OH_AudioCommon_Result OH_GetAudioScene(OH_AudioManager* manager, OH_AudioScene * #ifdef __cplusplus } #endif -/** @} */ -#endif // NATIVE_AUDIO_ROUTING_MANAGER_H \ No newline at end of file + +#endif // NATIVE_AUDIO_ROUTING_MANAGER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/audio_manager/native_audio_routing_manager.h b/multimedia/audio_framework/audio_manager/native_audio_routing_manager.h index b5f363ac7dd3bfe72451f9315f76fb324cc82d82..b0f360a954428db15cc475292b2e8c2ee1e56703 100644 --- a/multimedia/audio_framework/audio_manager/native_audio_routing_manager.h +++ b/multimedia/audio_framework/audio_manager/native_audio_routing_manager.h @@ -295,5 +295,6 @@ OH_AudioCommon_Result OH_AudioRoutingManager_SetMicBlockStatusCallback( #ifdef __cplusplus } #endif -/** @} */ + #endif // NATIVE_AUDIO_ROUTING_MANAGER_H +/** @} */ diff --git a/multimedia/audio_framework/audio_manager/native_audio_session_manager.h b/multimedia/audio_framework/audio_manager/native_audio_session_manager.h index 08ae357486363ddf5aa59e5e06b3ce6048a93056..01df4fea37df3433bd65c1e7a305d23998e3dcab 100644 --- a/multimedia/audio_framework/audio_manager/native_audio_session_manager.h +++ b/multimedia/audio_framework/audio_manager/native_audio_session_manager.h @@ -218,5 +218,6 @@ OH_AudioCommon_Result OH_AudioSessionManager_UnregisterSessionDeactivatedCallbac #ifdef __cplusplus } #endif -/** @} */ -#endif // NATIVE_AUDIO_ROUTING_MANAGER_H \ No newline at end of file + +#endif // NATIVE_AUDIO_ROUTING_MANAGER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/audio_renderer/native_audiorenderer.h b/multimedia/audio_framework/audio_renderer/native_audiorenderer.h index 49c765ff61785535b1d9061185c0f9561c47d253..8b332560f633575cdc61e8750b52e07a4846ea73 100644 --- a/multimedia/audio_framework/audio_renderer/native_audiorenderer.h +++ b/multimedia/audio_framework/audio_renderer/native_audiorenderer.h @@ -150,7 +150,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetSamplingRate(OH_AudioRenderer* rendere * @since 10 * * @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer() - * @param stramId Pointer to a variable that will be set for the stream id. + * @param streamId Pointer to a variable that will be set for the stream id. * @return Function result code: * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM} The param of renderer is nullptr. @@ -485,7 +485,7 @@ OH_AudioStream_Result OH_AudioRenderer_GetSilentModeAndMixWithOthers( * @brief Temporarily changes the current audio device * This function applys on audiorenderers whose StreamUsage are * STREAM_USAGE_VOICE_COMMUNICATIN/STREAM_USAGE_VIDEO_COMMUNICATION/STREAM_USAGE_VOICE_MESSAGE. - * Setting the device will ony takes effect if no other accessory such as headphoes are in use. + * Setting the device will only takes effect if no other accessory such as headphones are in use. * * @param renderer Renderer generated by OH_AudioStreamBuilder_GenerateRenderer() * @param deviceType The target device. The available deviceTypes are: @@ -504,7 +504,40 @@ OH_AudioStream_Result OH_AudioRenderer_GetSilentModeAndMixWithOthers( OH_AudioStream_Result OH_AudioRenderer_SetDefaultOutputDevice( OH_AudioRenderer* renderer, OH_AudioDevice_Type deviceType); +/** + * @brief Query the timestamp at which a particular frame was presented in clock monotonic timebase, + * the frame at the returned position was just committed to hardware. This is often used in + * video synchronization and recording stream alignment. + * + * Position is 0 and timestamp is fixed until stream really runs and frame is committed. Position + * will also be reset while flush function is called. When a audio route change happens, like in + * device or output type change situations, the position may also be reset but timestamp remains + * monotonically increasing. + * So it is better to use the values until they becomes regularly after the change. + * This interface also adapts to playback speed change. For example, the increseing speed for + * position will be double for 2x speed playback. + * + * @param renderer Reference created by OH_AudioStreamBuilder_GenerateRenderer() + * @param framePosition Pointer to a variable to receive the position + * @param timestamp Pointer to a variable to receive the timestamp + * @return Function result code: + * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: + * 1.The param of renderer is nullptr; + * 2.The param of framePosition or timestamp is nullptr; + * {@link AUDIOSTREAM_ERROR_ILLEGAL_STATE}: + * 1.Only running state is legal for getting audio timestamp. + * {@link AUDIOSTREAM_ERROR_SYSTEM}: + * 1.Crash or blocking occurs in system process. + * 2.Other unexpected error from internal system. + * @since 15 + */ +OH_AudioStream_Result OH_AudioRenderer_GetAudioTimestampInfo(OH_AudioRenderer* renderer, + int64_t* framePosition, int64_t* timestamp); + #ifdef __cplusplus } #endif + #endif // NATIVE_AUDIORENDERER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/common/native_audio_common.h b/multimedia/audio_framework/common/native_audio_common.h index 6a50df302af275066de91d06c0a60ab0f4c2a50e..2dfd609df994bf4315a31cea7ad4cd0b2d750b22 100644 --- a/multimedia/audio_framework/common/native_audio_common.h +++ b/multimedia/audio_framework/common/native_audio_common.h @@ -133,5 +133,6 @@ typedef enum { #ifdef __cplusplus } #endif -/** @} */ + #endif // NATIVE_AUDIO_COMMON_H +/** @} */ diff --git a/multimedia/audio_framework/common/native_audio_device_base.h b/multimedia/audio_framework/common/native_audio_device_base.h index 573e07fedc48fbce42989a418a165f9dbfa2d141..0e751ac95805c0af7b064bd21a28c3c751f73510 100644 --- a/multimedia/audio_framework/common/native_audio_device_base.h +++ b/multimedia/audio_framework/common/native_audio_device_base.h @@ -143,6 +143,13 @@ typedef enum { */ AUDIO_DEVICE_TYPE_REMOTE_CAST = 24, + /** + * @brief Usb audio device. + * + * @since 18 + */ + AUDIO_DEVICE_TYPE_USB_DEVICE = 25, + /** * @brief Default device type. */ @@ -404,5 +411,6 @@ OH_AudioCommon_Result OH_AudioDeviceDescriptor_GetDeviceEncodingTypes(OH_AudioDe #ifdef __cplusplus } #endif -/** @} */ + #endif // NATIVE_AUDIO_DEVICE_BASE_H +/** @} */ diff --git a/multimedia/audio_framework/common/native_audiostream_base.h b/multimedia/audio_framework/common/native_audiostream_base.h index 44dacf0d03d9a17fbb4e8b15afc81c4c23abaca4..aed8e102cfdfcd5ac98fd7dfc71fafaf74f7bc54 100644 --- a/multimedia/audio_framework/common/native_audiostream_base.h +++ b/multimedia/audio_framework/common/native_audiostream_base.h @@ -132,6 +132,13 @@ typedef enum { * @since 10 */ AUDIOSTREAM_SAMPLE_S32LE = 3, + + /** + * Float 32, little endian. + * + * @since 18 + */ + AUDIOSTREAM_SAMPLE_F32LE = 4, } OH_AudioStream_SampleFormat; /** @@ -445,7 +452,13 @@ typedef enum { * * @since 13 */ - AUDIOSTREAM_SOURCE_TYPE_CAMCORDER = 13 + AUDIOSTREAM_SOURCE_TYPE_CAMCORDER = 13, + /** + * Unprocessed source type. + * + * @since 14 + */ + AUDIOSTREAM_SOURCE_TYPE_UNPROCESSED = 14 } OH_AudioStream_SourceType; /** @@ -713,8 +726,32 @@ typedef enum { */ typedef OH_AudioData_Callback_Result (*OH_AudioRenderer_OnWriteDataCallback)(OH_AudioRenderer* renderer, void* userData, void* audioData, int32_t audioDataSize); + +/** + * @brief Define the audio stream volume mode. + * + * @since 18 + */ +typedef enum { + /** + * Indicates this audio stream volume will be affected by system volume, also the default behavior. + * + * @since 18 + */ + AUDIOSTREAM_VOLUMEMODE_SYSTEM_GLOBAL = 0, + + /** + * Indicates this audio stream volume will be affected by app's individual volume percentage which set by yourself + * using the app volume api. + * + * @since 18 + */ + AUDIOSTREAM_VOLUMEMODE_APP_INDIVIDUAL = 1 +} OH_AudioStream_VolumeMode; + #ifdef __cplusplus } #endif #endif // NATIVE_AUDIOSTREAM_BASE_H +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/common/native_audiostreambuilder.h b/multimedia/audio_framework/common/native_audiostreambuilder.h index 4989046d3fd3f8bae6ab473939a8378e9a9984d7..cedc25bdc7dab70ee5593d428c29cde75bef769e 100644 --- a/multimedia/audio_framework/common/native_audiostreambuilder.h +++ b/multimedia/audio_framework/common/native_audiostreambuilder.h @@ -80,8 +80,8 @@ OH_AudioStream_Result OH_AudioStreamBuilder_Destroy(OH_AudioStreamBuilder* build * * @since 10 * - * @param capturer Reference created by OH_AudioStreamBuilder - * @param channelCount Pointer to a variable that will be set for the channel count. + * @param builder Reference created by OH_AudioStreamBuilder + * @param rate Pointer to a variable that will be set for the channel count. * @return Function result code: * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: @@ -289,7 +289,7 @@ OH_AudioStream_Result OH_AudioStreamBuilder_GenerateRenderer(OH_AudioStreamBuild * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: * 1.The param of builder is nullptr; * 2.StreamType invalid; - * 3.Create OHAudioRenderer failed. + * 3.Create OHAudioCapturer failed. */ OH_AudioStream_Result OH_AudioStreamBuilder_GenerateCapturer(OH_AudioStreamBuilder* builder, OH_AudioCapturer** audioCapturer); @@ -361,8 +361,26 @@ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererInterruptMode(OH_AudioStr */ OH_AudioStream_Result OH_AudioStreamBuilder_SetRendererWriteDataCallback(OH_AudioStreamBuilder* builder, OH_AudioRenderer_OnWriteDataCallback callback, void* userData); + +/* + * Set the renderer volume mode of the stream client + * + * @since 18 + * + * @param builder Reference provided by OH_AudioStreamBuilder_Create() + * @param volumeMode Set the volume mode for the renderer client. + * @return Function result code: + * {@link AUDIOSTREAM_SUCCESS} If the execution is successful. + * {@link AUDIOSTREAM_ERROR_INVALID_PARAM}: + * 1.The param of builder is nullptr; + * 2.The param of volumeMode invalid. + */ +OH_AudioStream_Result OH_AudioStreamBuilder_SetVolumeMode(OH_AudioStreamBuilder* builder, + OH_AudioStream_VolumeMode volumeMode); + #ifdef __cplusplus } #endif #endif // NATIVE_AUDIOSTREAM_BUILDER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index 961c75daeeaa798a67c49fcf5724e2fdb7241a9f..2c8537d6ce6ea01760867b6ef228f3e7800434c3 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -378,5 +378,13 @@ { "first_introduced": "13", "name": "OH_AudioRoutingManager_SetMicBlockStatusCallback" + }, + { + "first_introduced": "15", + "name": "OH_AudioRenderer_GetAudioTimestampInfo" + }, + { + "first_introduced": "18", + "name": "OH_AudioStreamBuilder_SetVolumeMode" } ] diff --git a/multimedia/av_codec/avcodec_audio_channel_layout.h b/multimedia/av_codec/avcodec_audio_channel_layout.h index 4cc2a5eeefd875f8b4030888fa4c97951ada4194..b5f5c95fa9f12b516e77907a8943fedec566a1b9 100644 --- a/multimedia/av_codec/avcodec_audio_channel_layout.h +++ b/multimedia/av_codec/avcodec_audio_channel_layout.h @@ -13,6 +13,29 @@ * limitations under the License. */ +/** + * @addtogroup CodecBase + * @{ + * + * @brief The CodecBase module provides variables, properties, and functions + * for audio and video muxer, demuxer, and basic encoding and decoding functions. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 9 + */ + +/** + * @file avcodec_audio_channel_layout.h + * + * @brief Declare the enumeration used for audio encoding and decoding. + * + * @kit AVCodecKit + * @library libnative_media_codecbase.so + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 11 + * @since 10 + */ + #ifndef AVCODEC_AUDIO_CHANNEL_LAYOUT_H #define AVCODEC_AUDIO_CHANNEL_LAYOUT_H #include @@ -175,4 +198,5 @@ enum AudioChannelLayout : uint64_t { #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif // AVCODEC_AUDIO_CHANNEL_LAYOUT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json index 097dd37d0beab374858f94ce3d82e087aa23e410..bd99200d20f439d16ce6ddb713f38927fd4516d4 100644 --- a/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json +++ b/multimedia/av_codec/avmuxer/libnative_media_avmuxer.ndk.json @@ -7,6 +7,10 @@ "first_introduced": "10", "name": "OH_AVMuxer_SetRotation" }, + { + "first_introduced": "14", + "name": "OH_AVMuxer_SetFormat" + }, { "first_introduced": "10", "name": "OH_AVMuxer_AddTrack" diff --git a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json index 8758d51bb9ae3f34908335cd453f026520b4da14..759d6231b53d524399f267a0c0eb8ed218710359 100644 --- a/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json +++ b/multimedia/av_codec/avsource/libnative_media_avsource.ndk.json @@ -22,5 +22,9 @@ { "first_introduced": "10", "name": "OH_AVSource_GetTrackFormat" + }, + { + "first_introduced": "18", + "name": "OH_AVSource_GetCustomMetadataFormat" } ] diff --git a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json index 589823ef39cbe49747cc11bc69b4e20a3751516e..c84f06a8764f6b2f2f5c05f440080dd77685a450 100644 --- a/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json +++ b/multimedia/av_codec/codec_base/libnative_media_codecbase.ndk.json @@ -75,6 +75,18 @@ "first_introduced": "12", "name": "OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT" }, + { + "first_introduced": "18", + "name": "OH_AVCODEC_MIMETYPE_AUDIO_RAW" + }, + { + "first_introduced": "18", + "name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG2" + }, + { + "first_introduced": "18", + "name": "OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2" + }, { "first_introduced": "9", "name": "OH_ED_KEY_TIME_STAMP" @@ -391,6 +403,22 @@ "first_introduced": "12", "name": "OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE" }, + { + "first_introduced": "15", + "name": "OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRR" + }, + { + "first_introduced": "14", + "name": "OH_MD_KEY_CREATION_TIME" + }, + { + "first_introduced": "18", + "name": "OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER" + }, + { + "first_introduced": "18", + "name": "OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT" + }, { "first_introduced": "10", "name": "OH_AVCodec_GetCapability" diff --git a/multimedia/av_codec/native_avcapability.h b/multimedia/av_codec/native_avcapability.h index 5f30e6c924f9603f3f2055bf631edae292c8c0ed..dd17584d4298db54d9597ee18d3289351706aa43 100644 --- a/multimedia/av_codec/native_avcapability.h +++ b/multimedia/av_codec/native_avcapability.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AVCapability + * @{ + * + * @brief The AVCapability module provides functions for querying encoding and decoding capabilities. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ + /** * @file native_avcapability.h * - * @brief Provides audio and video capability queries. + * @brief Declare the Native API used for querying encoding and decoding capabilities. * * @kit AVCodecKit * @library libnative_media_codecbase.so @@ -30,6 +40,7 @@ #include #include "native_averrors.h" #include "native_avformat.h" +#include "native_avcodec_base.h" #ifdef __cplusplus extern "C" { @@ -42,20 +53,6 @@ extern "C" { */ typedef struct OH_AVCapability OH_AVCapability; -/** - * @brief The bitrate mode of encoder. - * @syscap SystemCapability.Multimedia.Media.CodecBase - * @since 10 - */ -typedef enum OH_BitrateMode { - /* Constant Bit rate mode. */ - BITRATE_MODE_CBR = 0, - /* Variable Bit rate mode. */ - BITRATE_MODE_VBR = 1, - /* Constant Quality mode. */ - BITRATE_MODE_CQ = 2 -} OH_BitrateMode; - /** * @brief Range contain min and max value * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -146,7 +143,8 @@ int32_t OH_AVCapability_GetMaxSupportedInstances(OH_AVCapability *capability); /** * @brief Get the encoder's supported bitrate range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Encoder capability pointer. Do not give a decoder capability pointer + * @param capability Encoder capability pointer. If a decoder capability pointer is given, + * undefined behavior occurs * @param bitrateRange Output parameter. Encoder bitrate range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -158,7 +156,8 @@ OH_AVErrCode OH_AVCapability_GetEncoderBitrateRange(OH_AVCapability *capability, /** * @brief Check if the encoder supports the specific bitrate mode. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Encoder capability pointer. Do not give a decoder capability pointer + * @param capability Encoder capability pointer. If a decoder capability pointer is given, + * undefined behavior occurs * @param bitrateMode Bitrate mode * @return Returns true if the bitrate mode is supported, false if the bitrate mode is not supported * @since 10 @@ -168,7 +167,8 @@ bool OH_AVCapability_IsEncoderBitrateModeSupported(OH_AVCapability *capability, /** * @brief Get the encoder's supported quality range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Encoder capability pointer. Do not give a decoder capability pointer + * @param capability Encoder capability pointer. If a decoder capability pointer is given, + * undefined behavior occurs * @param qualityRange Output parameter. Encoder quality range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -180,7 +180,8 @@ OH_AVErrCode OH_AVCapability_GetEncoderQualityRange(OH_AVCapability *capability, /** * @brief Get the encoder's supported encoder complexity range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Encoder capability pointer. Do not give a decoder capability pointer + * @param capability Encoder capability pointer. If a decoder capability pointer is given, + * undefined behavior occurs * @param complexityRange Output parameter. Encoder complexity range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -192,7 +193,8 @@ OH_AVErrCode OH_AVCapability_GetEncoderComplexityRange(OH_AVCapability *capabili /** * @brief Get the audio codec's supported sample rates. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Audio codec capability pointer. Do not give a video codec capability pointer + * @param capability Audio codec capability pointer. If a video codec capability pointer is given, + * undefined behavior occurs * @param sampleRates Output parameter. A pointer to the sample rates array * @param sampleRateNum Output parameter. The element number of the sample rates array * @return Returns AV_ERR_OK if the execution is successful, @@ -208,7 +210,8 @@ OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRates(OH_AVCapability *capab /** * @brief Get the audio codec's supported audio channel count range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Audio codec capability pointer. Do not give a video codec capability pointer + * @param capability Audio codec capability pointer. If a video codec capability pointer is given, + * undefined behavior occurs * @param channelCountRange Output parameter. Audio channel count range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -220,7 +223,8 @@ OH_AVErrCode OH_AVCapability_GetAudioChannelCountRange(OH_AVCapability *capabili /** * @brief Get the video codec's supported video width alignment. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param widthAlignment Output parameter. Video width alignment * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -232,7 +236,8 @@ OH_AVErrCode OH_AVCapability_GetVideoWidthAlignment(OH_AVCapability *capability, /** * @brief Get the video codec's supported video height alignment. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param heightAlignment Output parameter. Video height alignment * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -244,7 +249,8 @@ OH_AVErrCode OH_AVCapability_GetVideoHeightAlignment(OH_AVCapability *capability /** * @brief Get the video codec's supported video width range for a specific height. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability video codec capability pointer. Do not give an audio codec capability pointer + * @param capability video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param height Vertical pixel number of the video * @param widthRange Output parameter. Video width range * @return Returns AV_ERR_OK if the execution is successful, @@ -259,7 +265,8 @@ OH_AVErrCode OH_AVCapability_GetVideoWidthRangeForHeight(OH_AVCapability *capabi /** * @brief Get the video codec's supported video height range for a specific width. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param width Horizontal pixel number of the video * @param heightRange Output parameter. Video height range * @return Returns AV_ERR_OK if the execution is successful, @@ -274,7 +281,8 @@ OH_AVErrCode OH_AVCapability_GetVideoHeightRangeForWidth(OH_AVCapability *capabi /** * @brief Get the video codec's supported video width range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. DO not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param widthRange Output parameter. Video width range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -286,7 +294,8 @@ OH_AVErrCode OH_AVCapability_GetVideoWidthRange(OH_AVCapability *capability, OH_ /** * @brief Get the video codec's supported video height range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param heightRange Output parameter. Video height range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -298,7 +307,8 @@ OH_AVErrCode OH_AVCapability_GetVideoHeightRange(OH_AVCapability *capability, OH /** * @brief Check if the video codec supports the specific video size. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param width Horizontal pixel number of the video * @param height Vertical pixel number of the video * @return Returns true if the video size is supported, false if the video size is not supported @@ -309,7 +319,8 @@ bool OH_AVCapability_IsVideoSizeSupported(OH_AVCapability *capability, int32_t w /** * @brief Get the video codec's supported video frame rate range. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param frameRateRange Output parameter. Video frame rate range * @return Returns AV_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVErrCode} @@ -321,7 +332,8 @@ OH_AVErrCode OH_AVCapability_GetVideoFrameRateRange(OH_AVCapability *capability, /** * @brief Get the Video codec's supported video frame rate range for a specified video size. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param width Horizontal pixel number of the video * @param height Vertical pixel number of the video * @param frameRateRange Output parameter. Frame rate range @@ -337,7 +349,8 @@ OH_AVErrCode OH_AVCapability_GetVideoFrameRateRangeForSize(OH_AVCapability *capa /** * @brief Check if the video codec supports the specific combination of video size and frame rate. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param width Horizontal pixel number of the video * @param height Vertical pixel number of the video * @param frameRate Frame number per second @@ -351,7 +364,8 @@ bool OH_AVCapability_AreVideoSizeAndFrameRateSupported(OH_AVCapability *capabili /** * @brief Get the video codec's supported video pixel format. * @syscap SystemCapability.Multimedia.Media.CodecBase - * @param capability Video codec capability pointer. Do not give an audio codec capability pointer + * @param capability Video codec capability pointer. If an audio codec capability pointer is given, + * undefined behavior occurs * @param pixelFormats Output parameter. A pointer to the video pixel format array * @param pixelFormatNum Output parameter. The element number of the pixel format array * @return Returns AV_ERR_OK if the execution is successful, @@ -437,4 +451,5 @@ OH_AVFormat *OH_AVCapability_GetFeatureProperties(OH_AVCapability *capability, O #ifdef __cplusplus } #endif -#endif // NATIVE_AVCAPABILITY_H \ No newline at end of file +#endif // NATIVE_AVCAPABILITY_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_audiocodec.h b/multimedia/av_codec/native_avcodec_audiocodec.h index 8ae03c4bb792d71f2707e9a3615c86b4a6dd3691..5495a534b089734ce5776ab21deda788b7c1a27c 100644 --- a/multimedia/av_codec/native_avcodec_audiocodec.h +++ b/multimedia/av_codec/native_avcodec_audiocodec.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AudioCodec + * @{ + * + * @brief The AudioCodec module provides functions for audio encoding and decoding. + * + * @syscap SystemCapability.Multimedia.Media.AudioCodec + * @since 11 + */ + /** * @file native_avcodec_audiocodec.h * - * @brief Provides audio encoder and decoder capabilities. + * @brief Declare the Native API used for audio encoding and decoding. * * @kit AVCodecKit * @library libnative_media_acodec.so @@ -288,4 +298,5 @@ OH_AVErrCode OH_AudioCodec_SetDecryptionConfig(OH_AVCodec *codec, MediaKeySessio #ifdef __cplusplus } #endif -#endif // NATIVE_AVCODEC_AUDIOCODEC_H \ No newline at end of file +#endif // NATIVE_AVCODEC_AUDIOCODEC_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_audiodecoder.h b/multimedia/av_codec/native_avcodec_audiodecoder.h index f2269e3e8960a32480d1bb04b1b7daafd020649c..979eda38a0aa1356606a83883ff512659b00be6e 100644 --- a/multimedia/av_codec/native_avcodec_audiodecoder.h +++ b/multimedia/av_codec/native_avcodec_audiodecoder.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AudioDecoder + * @{ + * + * @brief The AudioDecoder module provides functions for audio decoding. + * + * @syscap SystemCapability.Multimedia.Media.AudioDecoder + * @since 9 + */ + /** * @file native_avcodec_audiodecoder.h * - * @brief Provides audio decoder capabilities. + * @brief Declare the Native API used for audio decoding. * * @kit AVCodecKit * @library libnative_media_adec.so @@ -244,4 +254,5 @@ OH_AVErrCode OH_AudioDecoder_IsValid(OH_AVCodec *codec, bool *isValid); #ifdef __cplusplus } #endif -#endif // NATIVE_AVCODEC_AUDIODECODER_H \ No newline at end of file +#endif // NATIVE_AVCODEC_AUDIODECODER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_audioencoder.h b/multimedia/av_codec/native_avcodec_audioencoder.h index a01215f8ffc7facda0355d6920befedf0c9fb0fe..611ac03fd66105c1d258617c49135929b086fc37 100644 --- a/multimedia/av_codec/native_avcodec_audioencoder.h +++ b/multimedia/av_codec/native_avcodec_audioencoder.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AudioEncoder + * @{ + * + * @brief The AudioEncoder module provides functions for audio encoding. + * + * @syscap SystemCapability.Multimedia.Media.AudioEncoder + * @since 9 + */ + /** * @file native_avcodec_audioencoder.h * - * @brief Provides audio encoder capabilities. + * @brief Declare the Native API used for audio encoding. * * @kit AVCodecKit * @library libnative_media_aenc.so @@ -254,4 +264,5 @@ OH_AVErrCode OH_AudioEncoder_IsValid(OH_AVCodec *codec, bool *isValid); #ifdef __cplusplus } #endif -#endif // NATIVE_AVCODEC_AUDIOENCODER_H \ No newline at end of file +#endif // NATIVE_AVCODEC_AUDIOENCODER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_base.h b/multimedia/av_codec/native_avcodec_base.h index a3d3fb9a232993e8b19d40ea43ad1c74b4a14a2a..ce92ddfee08b5c255f721d09c2c138713696c7a9 100644 --- a/multimedia/av_codec/native_avcodec_base.h +++ b/multimedia/av_codec/native_avcodec_base.h @@ -14,10 +14,21 @@ */ /** - * @file native_avcodec_base.h + * @addtogroup CodecBase + * @{ + * + * @brief The CodecBase module provides variables, properties, and functions + * for audio and video muxer, demuxer, and basic encoding and decoding functions. * - * @brief Provides audio and video codec base. + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 9 + */ + +/** + * @file native_avcodec_base.h * + * @brief Declare the Native API used for audio and video muxer, + * demuxer and basic encoding and decoding functions. * @kit AVCodecKit * @library libnative_media_codecbase.so * @syscap SystemCapability.Multimedia.Media.CodecBase @@ -344,10 +355,33 @@ extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_SRT; */ extern const char *OH_AVCODEC_MIMETYPE_SUBTITLE_WEBVTT; +/** + * @brief Enumerates the mime type of audio raw stream. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +extern const char *OH_AVCODEC_MIMETYPE_AUDIO_RAW; +/** + * @brief Enumerates the MIME type of video mpeg2 codec. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG2; +/** + * @brief Enumerates the MIME type of video mpeg4 part2 codec. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +extern const char *OH_AVCODEC_MIMETYPE_VIDEO_MPEG4_PART2; + /** * @brief Key for timeStamp in surface's extraData, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 14 * @since 9 */ extern const char *OH_ED_KEY_TIME_STAMP; @@ -355,6 +389,7 @@ extern const char *OH_ED_KEY_TIME_STAMP; * @brief Key for endOfStream in surface's extraData, value type is bool. * * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 14 * @since 9 */ extern const char *OH_ED_KEY_EOS; @@ -662,6 +697,8 @@ extern const char *OH_MD_KEY_SETUP_HEADER; * @brief Key for video scale type, value type is int32_t, see {@link OH_ScalingMode}. * * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 14 + * @useinstead OH_NativeWindow_NativeWindowSetScalingModeV2 * @since 10 */ extern const char *OH_MD_KEY_SCALING_MODE; @@ -926,14 +963,14 @@ extern const char *OH_MD_KEY_BUFFER_DURATION; */ extern const char *OH_MD_KEY_VIDEO_SAR; /** - * @brief Key for start time of file, value type is int64_t. + * @brief Key for start time of the first frame in the media file in microseconds, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 */ extern const char *OH_MD_KEY_START_TIME; /** - * @brief Key for start time of track, value type is int64_t. + * @brief Key for start time of track in microseconds, value type is int64_t. * * @syscap SystemCapability.Multimedia.Media.CodecBase * @since 12 @@ -953,6 +990,39 @@ extern const char *OH_MD_KEY_TRACK_START_TIME; * @since 12 */ extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_COLOR_SPACE; +/** + * @brief Key for describing if enable VRR or not, value type is int32_t (0 or 1): 1 is enabled, 0 otherwise. + * This is an optional key that applies only to video decoder. It is used in configure. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 15 + */ +extern const char *OH_MD_KEY_VIDEO_DECODER_OUTPUT_ENABLE_VRR; +/** + * @brief Key for creation timestamp of a media file, value type is string. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 14 + */ +extern const char *OH_MD_KEY_CREATION_TIME; +/** + * @brief Key applies only when configuring a video encoder in surface mode, value type is int32_t. + * If no new frame became available since the last frame submitted to the encoder, + * it will sumbit the previous frame repeatly in milliseconds. It is used in configure. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER; +/** + * @brief Key for describing the maximum count that the frame previously submitted to the encoder will be + * repeated, in case no new frame has been available since, value type is int32_t. This key takes effect only when + * {@link VIDEO_ENCODER_REPEAT_PREVIOUS_FRAME_AFTER} is vaild. It is used in configure. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +extern const char *OH_MD_KEY_VIDEO_ENCODER_REPEAT_PREVIOUS_MAX_COUNT; /** * @brief Media type. @@ -979,6 +1049,16 @@ typedef enum OH_MediaType { */ typedef enum OH_AACProfile { AAC_PROFILE_LC = 0, + /** + * High-Efficiency AAC profile, contain the audio object types: AAC LC, SBR + * @since 14 + */ + AAC_PROFILE_HE = 3, + /** + * High-Efficiency AAC v2 profile, contain the audio object types: AAC LC, SBR, PS + * @since 14 + */ + AAC_PROFILE_HE_V2 = 4, } OH_AACProfile; /** @@ -1003,10 +1083,115 @@ typedef enum OH_HEVCProfile { HEVC_PROFILE_MAIN = 0, HEVC_PROFILE_MAIN_10 = 1, HEVC_PROFILE_MAIN_STILL = 2, + /** + * @deprecated since 14 + */ HEVC_PROFILE_MAIN_10_HDR10 = 3, + /** + * @deprecated since 14 + */ HEVC_PROFILE_MAIN_10_HDR10_PLUS = 4, } OH_HEVCProfile; +/** + * @brief Profile: A specified subset of the syntax of VVC. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 15 + */ +typedef enum OH_VVCProfile { + /** Main 10 profile */ + VVC_PROFILE_MAIN_10 = 1, + /** Main 12 profile */ + VVC_PROFILE_MAIN_12 = 2, + /** Main 12 Intra profile */ + VVC_PROFILE_MAIN_12_INTRA = 10, + /** Multilayer Main 10 profile */ + VVC_PROFILE_MULTI_MAIN_10 = 17, + /** Main 10 4:4:4 profile */ + VVC_PROFILE_MAIN_10_444 = 33, + /** Main 12 4:4:4 profile */ + VVC_PROFILE_MAIN_12_444 = 34, + /** Main 16 4:4:4 profile */ + VVC_PROFILE_MAIN_16_444 = 36, + /** Main 12 4:4:4 Intra profile */ + VVC_PROFILE_MAIN_12_444_INTRA = 42, + /** Main 16 4:4:4 Intra profile */ + VVC_PROFILE_MAIN_16_444_INTRA = 44, + /** Multilayer Main 10 4:4:4 profile */ + VVC_PROFILE_MULTI_MAIN_10_444 = 49, + /** Main 10 Still Picture profile */ + VVC_PROFILE_MAIN_10_STILL = 65, + /** Main 12 Still Picture profile */ + VVC_PROFILE_MAIN_12_STILL = 66, + /** Main 10 4:4:4 Still Picture profile */ + VVC_PROFILE_MAIN_10_444_STILL = 97, + /** Main 12 4:4:4 Still Picture profile */ + VVC_PROFILE_MAIN_12_444_STILL = 98, + /** Main 16 4:4:4 Still Picture profile */ + VVC_PROFILE_MAIN_16_444_STILL = 100, +} OH_VVCProfile; + +/** + * @brief MPEG2 Profile + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +typedef enum OH_MPEG2Profile { + /** Simple profile */ + MPEG2_PROFILE_SIMPLE = 0, + /** Main profile */ + MPEG2_PROFILE_MAIN = 1, + /** SNR scalable profile */ + MPEG2_PROFILE_SNR_SCALABLE = 2, + /** Spatially scalable profile */ + MPEG2_PROFILE_SPATIALLY_SCALABLE = 3, + /** High profile */ + MPEG2_PROFILE_HIGH = 4, + /** 4:2:2 profile */ + MPEG2_PROFILE_422 = 5, +} OH_MPEG2Profile; + +/** + * @brief MPEG4 Profile + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +typedef enum OH_MPEG4Profile { + /** Simple profile */ + MPEG4_PROFILE_SIMPLE = 0, + /** Simple scalable profile */ + MPEG4_PROFILE_SIMPLE_SCALABLE = 1, + /** Core profile */ + MPEG4_PROFILE_CORE = 2, + /** Main profile */ + MPEG4_PROFILE_MAIN = 3, + /** N-Bit profile */ + MPEG4_PROFILE_N_BIT = 4, + /** Hybrid profile */ + MPEG4_PROFILE_HYBRID = 5, + /** Basic animated texture profile */ + MPEG4_PROFILE_BASIC_ANIMATED_TEXTURE = 6, + /** Scalable texture profile */ + MPEG4_PROFILE_SCALABLE_TEXTURE = 7, + /** Simple FA profile */ + MPEG4_PROFILE_SIMPLE_FA = 8, + /** Advanced real time simple profile */ + MPEG4_PROFILE_ADVANCED_REAL_TIME_SIMPLE = 9, + /** Core scalable profile */ + MPEG4_PROFILE_CORE_SCALABLE = 10, + /** Advanced coding efficiency profile */ + MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 11, + /** Advanced core profile */ + MPEG4_PROFILE_ADVANCED_CORE = 12, + /** Advanced scalable texture profile */ + MPEG4_PROFILE_ADVANCED_SCALABLE_TEXTURE = 13, + /** Advanced simple profile */ + MPEG4_PROFILE_ADVANCED_SIMPLE = 17, +} OH_MPEG4Profile; + /** * @brief Enumerates the muxer output file format * @@ -1032,6 +1217,11 @@ typedef enum OH_AVOutputFormat { * @since 12 */ AV_OUTPUT_FORMAT_WAV = 10, + /** + * The muxer output aac file format. + * @since 18 + */ + AV_OUTPUT_FORMAT_AAC = 11, } OH_AVOutputFormat; /** @@ -1053,10 +1243,20 @@ typedef enum OH_AVSeekMode { * @brief Scaling Mode * * @syscap SystemCapability.Multimedia.Media.CodecBase + * @deprecated since 14 + * @useinstead OHScalingModeV2 * @since 10 */ typedef enum OH_ScalingMode { + /** + * @deprecated since 14 + * @useinstead OH_SCALING_MODE_SCALE_TO_WINDOW_V2 + */ SCALING_MODE_SCALE_TO_WINDOW = 1, + /** + * @deprecated since 14 + * @useinstead OH_SCALING_MODE_SCALE_CROP_V2 + */ SCALING_MODE_SCALE_CROP = 2, } OH_ScalingMode; @@ -1200,6 +1400,92 @@ typedef enum OH_HEVCLevel { HEVC_LEVEL_62 = 12, } OH_HEVCLevel; +/** + * @brief VVC Level: A defined set of constraints on the values that may be taken by the syntax elements and variables + * of VVC, or the value of a transform coefficient prior to scaling. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 15 + */ +typedef enum OH_VVCLevel { + /** VVC level 1.0 */ + VVC_LEVEL_1 = 16, + /** VVC level 2.0 */ + VVC_LEVEL_2 = 32, + /** VVC level 2.1 */ + VVC_LEVEL_21 = 35, + /** VVC level 3.0 */ + VVC_LEVEL_3 = 48, + /** VVC level 3.1 */ + VVC_LEVEL_31 = 51, + /** VVC level 4.0 */ + VVC_LEVEL_4 = 64, + /** VVC level 4.1 */ + VVC_LEVEL_41 = 67, + /** VVC level 5.0 */ + VVC_LEVEL_5 = 80, + /** VVC level 5.1 */ + VVC_LEVEL_51 = 83, + /** VVC level 5.2 */ + VVC_LEVEL_52 = 86, + /** VVC level 6.0 */ + VVC_LEVEL_6 = 96, + /** VVC level 6.1 */ + VVC_LEVEL_61 = 99, + /** VVC level 6.2 */ + VVC_LEVEL_62 = 102, + /** VVC level 6.3 */ + VVC_LEVEL_63 = 105, + /** VVC level 15.5 */ + VVC_LEVEL_155 = 255, +} OH_VVCLevel; + +/** + * @brief MPEG2 Level. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +typedef enum OH_MPEG2Level { + /** Low level */ + MPEG2_LEVEL_LOW = 0, + /** Main level */ + MPEG2_LEVEL_MAIN = 1, + /** High 1440 level */ + MPEG2_LEVEL_HIGH_1440 = 2, + /** High level */ + MPEG2_LEVEL_HIGH = 3, +} OH_MPEG2Level; + +/** + * @brief MPEG4 Level. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 18 + */ +typedef enum OH_MPEG4Level { + /** 0 level */ + MPEG4_LEVEL_0 = 0, + /** 0B level */ + MPEG4_LEVEL_0B = 1, + /** 1 level */ + MPEG4_LEVEL_1 = 2, + /** 2 level */ + MPEG4_LEVEL_2 = 3, + /** 3 level */ + MPEG4_LEVEL_3 = 4, + /** 3B level */ + MPEG4_LEVEL_3B = 5, + /** 4 level */ + MPEG4_LEVEL_4 = 6, + /** 4A level */ + MPEG4_LEVEL_4A = 7, + /** 5 level */ + MPEG4_LEVEL_5 = 8, + /** 6 level */ + MPEG4_LEVEL_6 = 9, +} OH_MPEG4Level; + /** * @brief The reference mode in temporal group of picture. * @@ -1216,8 +1502,26 @@ typedef enum OH_TemporalGopReferenceMode { UNIFORMLY_SCALED_REFERENCE = 2, } OH_TemporalGopReferenceMode; +/** + * @brief The bitrate mode of encoder. + * + * Change the location of the header file, since 14. + * + * @syscap SystemCapability.Multimedia.Media.CodecBase + * @since 10 + */ +typedef enum OH_BitrateMode { + /** Constant Bit rate mode. */ + BITRATE_MODE_CBR = 0, + /** Variable Bit rate mode. */ + BITRATE_MODE_VBR = 1, + /** Constant Quality mode. */ + BITRATE_MODE_CQ = 2 +} OH_BitrateMode; + #ifdef __cplusplus } #endif #endif // NATIVE_AVCODEC_BASE_H +/** @} */ diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index f4b58bcbc5882710d509f145af7035fa011254b6..462d5011d07751e01fed1409fb6d8b60e05dac38 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup VideoDecoder + * @{ + * + * @brief The VideoDecoder module provides interfaces for video decoding. + * + * @syscap SystemCapability.Multimedia.Media.VideoDecoder + * @since 9 + * @version 1.0 + */ + /** * @file native_avcodec_videodecoder.h * - * @brief Provides video decoder capabilities. + * @brief Declare the Native API used for video decoding. * * @kit AVCodecKit * @library libnative_media_vdec.so @@ -460,4 +471,5 @@ OH_AVErrCode OH_VideoDecoder_SetDecryptionConfig(OH_AVCodec *codec, MediaKeySess } #endif -#endif // NATIVE_AVCODEC_VIDEODECODER_H \ No newline at end of file +#endif // NATIVE_AVCODEC_VIDEODECODER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avcodec_videoencoder.h b/multimedia/av_codec/native_avcodec_videoencoder.h index e66569f4f0967939cfbd2592fc8645cffe7d9abf..a0ccb13b6d782a5ea7520a9bc64f7d5d24a346af 100644 --- a/multimedia/av_codec/native_avcodec_videoencoder.h +++ b/multimedia/av_codec/native_avcodec_videoencoder.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup VideoEncoder + * @{ + * + * @brief The VideoEncoder module provides interfaces for video encoding. + * + * @syscap SystemCapability.Multimedia.VideoEncoder + * @since 9 + */ + /** * @file native_avcodec_videoencoder.h * - * @brief Provides video encoder capabilities. + * @brief Declare the interface used for video encoding. * * @kit AVCodecKit * @library libnative_media_venc.so @@ -428,14 +438,25 @@ OH_AVErrCode OH_VideoEncoder_IsValid(OH_AVCodec *codec, bool *isValid); /** * @brief The bitrate mode of video encoder. * @syscap SystemCapability.Multimedia.Media.VideoEncoder + * @deprecated since 14 + * @useinstead OH_BitrateMode * @since 9 */ typedef enum OH_VideoEncodeBitrateMode { - /* constant bit rate mode. */ + /** constant bit rate mode. + * @deprecated since 14 + * @useinstead BITRATE_MODE_CBR + */ CBR = 0, - /* variable bit rate mode. */ + /** variable bit rate mode. + * @deprecated since 14 + * @useinstead BITRATE_MODE_VBR + */ VBR = 1, - /* constant quality mode. */ + /** constant quality mode. + * @deprecated since 14 + * @useinstead BITRATE_MODE_CQ + */ CQ = 2, } OH_VideoEncodeBitrateMode; @@ -443,4 +464,5 @@ typedef enum OH_VideoEncodeBitrateMode { } #endif -#endif // NATIVE_AVCODEC_VIDEOENCODER_H \ No newline at end of file +#endif // NATIVE_AVCODEC_VIDEOENCODER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index 4913528156683067fd92bbbbfa0a0bd1d6574b73..4e43b312a27dfc9e466f0015a19d867abd15a7af 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AVDemuxer + * @{ + * + * @brief The AVDemuxer module provides an interface for extracting samples from media file streams. + * + * @syscap SystemCapability.Multimedia.Media.Spliter + * @since 10 + */ + /** * @file native_avdemuxer.h * - * @brief Provides audio and video demuxer capabilities. + * @brief Declare the interface for parsing audio and video media data. * * @kit AVCodecKit * @library libnative_media_avdemuxer.so @@ -49,11 +59,12 @@ typedef struct OH_AVDemuxer OH_AVDemuxer; typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo; /** -* @brief Callback for getting media key system information from media source. -* @since 11 -* @version 1.0 -*/ -typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); + * @brief Callback for getting media key system information from media source. + * @deprecated since 14 + * @useinstead Demuxer_MediaKeySystemInfoCallback + * @since 11 + */ +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo); /** * @brief Call back will be invoked when updating DRM information. @@ -191,6 +202,8 @@ OH_AVErrCode OH_AVDemuxer_SeekToTime(OH_AVDemuxer *demuxer, int64_t millisecond, * @return {@link AV_ERR_OK} 0 - Success * {@link AV_ERR_OPERATE_NOT_PERMIT} 2 - If the demuxer engine is not inited or init failed. * {@link AV_ERR_INVALID_VAL} 3 - If the demuxer instance is nullptr or invalid. + * @deprecated since 14 + * @useinstead OH_AVDemuxer_SetDemuxerMediaKeySystemInfoCallback * @since 11 */ OH_AVErrCode OH_AVDemuxer_SetMediaKeySystemInfoCallback(OH_AVDemuxer *demuxer, @@ -228,3 +241,4 @@ OH_AVErrCode OH_AVDemuxer_GetMediaKeySystemInfo(OH_AVDemuxer *demuxer, DRM_Media #endif #endif // NATIVE_AVDEMUXER_H +/** @} */ diff --git a/multimedia/av_codec/native_avmuxer.h b/multimedia/av_codec/native_avmuxer.h index af3c44b12f39986a09dac506b5230f8ef384750c..d2b5be3e4ccd3cce6ae717ac96b9388d02c94e49 100644 --- a/multimedia/av_codec/native_avmuxer.h +++ b/multimedia/av_codec/native_avmuxer.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AVMuxer + * @{ + * + * @brief The AVMuxer module provides functions for audio and video muxer. + * + * @syscap SystemCapability.Multimedia.Media.Muxer + * @since 10 + */ + /** * @file native_avmuxer.h * - * @brief Provides audio and video muxer capabilities. + * @brief Declare the Native API used for audio and video muxer. * * @kit AVCodecKit * @library libnative_media_avmuxer.so @@ -66,6 +76,19 @@ OH_AVMuxer *OH_AVMuxer_Create(int32_t fd, OH_AVOutputFormat format); */ OH_AVErrCode OH_AVMuxer_SetRotation(OH_AVMuxer *muxer, int32_t rotation); +/** + * @brief Set format to the muxer. + * + * @syscap SystemCapability.Multimedia.Media.Muxer + * @param muxer Pointer to an OH_AVMuxer instance + * @param format OH_AVFormat handle pointer contain format + * @return Returns AV_ERR_OK if the execution is successful + * {@link AV_ERR_INVALID_VAL}, the muxer or format is invalid + * {@link AV_ERR_OPERATE_NOT_PERMIT}, not permit to call the interface, it was called in invalid state + * @since 14 + */ +OH_AVErrCode OH_AVMuxer_SetFormat(OH_AVMuxer *muxer, OH_AVFormat *format); + /** * @brief Add track format to the muxer. * Note: This interface can only be called before OH_AVMuxer_Start. @@ -171,4 +194,5 @@ OH_AVErrCode OH_AVMuxer_Destroy(OH_AVMuxer *muxer); } #endif -#endif // NATIVE_AVMUXER_H \ No newline at end of file +#endif // NATIVE_AVMUXER_H +/** @} */ diff --git a/multimedia/av_codec/native_avsource.h b/multimedia/av_codec/native_avsource.h index acda078852b17a4df0f61eb49d088f5a9ce4fef9..f59fe1f2f4ff76e19c4901808f01da9841e8470b 100644 --- a/multimedia/av_codec/native_avsource.h +++ b/multimedia/av_codec/native_avsource.h @@ -13,10 +13,20 @@ * limitations under the License. */ +/** + * @addtogroup AVSource + * @{ + * + * @brief The AVSource module provides functions for constructing media resource object functionality. + * + * @syscap SystemCapability.Multimedia.Media.Spliter + * @since 10 + */ + /** * @file native_avsource.h * - * @brief Provides audio and video suorce capabilities. + * @brief Declare the interface for parsing audio and video media data. * * @kit AVCodecKit * @library libnative_media_avsource.so @@ -101,6 +111,8 @@ OH_AVErrCode OH_AVSource_Destroy(OH_AVSource *source); /** * @brief Get the format info of source. + * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs + * to be manually released by the caller. * @syscap SystemCapability.Multimedia.Media.Spliter * @param source Pointer to an OH_AVSource instance. * @return Returns the source's format info if the execution is successful, otherwise returns nullptr. @@ -112,6 +124,8 @@ OH_AVFormat *OH_AVSource_GetSourceFormat(OH_AVSource *source); /** * @brief Get the format info of track. + * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs + * to be manually released by the caller. * @syscap SystemCapability.Multimedia.Media.Spliter * @param source Pointer to an OH_AVSource instance. * @param trackIndex The track index to get format. @@ -123,8 +137,24 @@ OH_AVFormat *OH_AVSource_GetSourceFormat(OH_AVSource *source); */ OH_AVFormat *OH_AVSource_GetTrackFormat(OH_AVSource *source, uint32_t trackIndex); +/** + * @brief Get the format info of custom metadata. + * + * It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs + * to be manually released by the caller. + * + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param source Pointer to an OH_AVSource instance. + * @return Returns the metadata's format info if the execution is successful, otherwise returns nullptr. + * Possible failure causes: + * 1. source is invalid. + * @since 18 + */ +OH_AVFormat *OH_AVSource_GetCustomMetadataFormat(OH_AVSource *source); + #ifdef __cplusplus } #endif -#endif // NATIVE_AVSOURCE_H \ No newline at end of file +#endif // NATIVE_AVSOURCE_H +/** @} */ \ No newline at end of file diff --git a/multimedia/av_codec/native_cencinfo.h b/multimedia/av_codec/native_cencinfo.h index f0a5a8e8c6dd4b9b2a9f87c56901c898403ee3c8..14e84db5205f0d2732e7b8367c6cc1f4f353e565 100644 --- a/multimedia/av_codec/native_cencinfo.h +++ b/multimedia/av_codec/native_cencinfo.h @@ -246,3 +246,4 @@ OH_AVErrCode OH_AVCencInfo_SetAVBuffer(OH_AVCencInfo *cencInfo, OH_AVBuffer *buf #endif #endif // NATIVE_AVCENCINFO_H +/** @} */ \ No newline at end of file diff --git a/multimedia/camera_framework/camera.h b/multimedia/camera_framework/camera.h index 50e6f143ba73242533560af28a7fd91e0aec9975..eecc0d386bda05a25aab781ca73cc34da243689e 100644 --- a/multimedia/camera_framework/camera.h +++ b/multimedia/camera_framework/camera.h @@ -579,6 +579,29 @@ typedef enum Camera_PreconfigRatio { PRECONFIG_RATIO_16_9 = 2 } Camera_PreconfigRatio; +/** + * @brief Enum for remote camera device type. + * + * @since 15 + * @version 1.0 + */ +typedef enum Camera_HostDeviceType { + /** + * Indicates an unknown device camera. + */ + HOST_DEVICE_TYPE_UNKNOWN_TYPE = 0, + + /** + * Indicates a smartphone camera. + */ + HOST_DEVICE_TYPE_PHONE = 0x0E, + + /** + * Indicates tablet camera. + */ + HOST_DEVICE_TYPE_TABLET = 0x11 +} Camera_HostDeviceType; + /** * @brief Size parameter. * @@ -973,6 +996,70 @@ typedef struct Camera_FrameShutterEndInfo { int32_t captureId; } Camera_FrameShutterEndInfo; +/** +* @brief Enum for fold status. +* +* @since 13 +* @version 1.0 +*/ +typedef enum Camera_FoldStatus { + /** + * Non_foldable status. + */ + NON_FOLDABLE = 0, + + /** + * Expanded status. + */ + EXPANDED = 1, + + /** + * Folded status. + */ + FOLDED = 2 +} Camera_FoldStatus; + +/** + * @brief Fold status info. + * + * @since 13 + * @version 1.0 + */ +typedef struct Camera_FoldStatusInfo { + /** + * Camera instance list. + */ + Camera_Device** supportedCameras; + + /** + * Size of camera list. + */ + uint32_t cameraSize; + + /** + * Current fold status. + */ + Camera_FoldStatus foldStatus; +} Camera_FoldStatusInfo; + +/** + * @brief Auto device switch status info. + * + * @since 13 + * @version 1.0 + */ +typedef struct Camera_AutoDeviceSwitchStatusInfo { + /** + * is device switched. + */ + bool isDeviceSwitched; + + /** + * is device capability changed. + */ + bool isDeviceCapabilityChanged; +} Camera_AutoDeviceSwitchStatusInfo; + /** * @brief Creates a CameraManager instance. * @@ -996,6 +1083,24 @@ Camera_ErrorCode OH_Camera_GetCameraManager(Camera_Manager** cameraManager); */ Camera_ErrorCode OH_Camera_DeleteCameraManager(Camera_Manager* cameraManager); +/** + * @brief Enum for quality prioritization. + * + * @since 14 + * @version 1.0 + */ +typedef enum Camera_QualityPrioritization { + /** + * Hight quality priority. + */ + HIGH_QUALITY = 0, + + /** + * Power balance priority. + */ + POWER_BALANCE = 1 +} Camera_QualityPrioritization; + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index e5faf336c140e94faf771e865c161e19bb25efa2..8543be5773013b7d4bd011d456467f2f80692cdc 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -471,6 +471,10 @@ "first_introduced": "11", "name": "OH_PhotoOutput_IsMirrorSupported" }, + { + "first_introduced": "13", + "name": "OH_PhotoOutput_EnableMirror" + }, { "first_introduced": "12", "name": "OH_PhotoOutput_GetActiveProfile" @@ -587,6 +591,14 @@ "first_introduced": "12", "name": "OH_VideoOutput_GetActiveFrameRate" }, + { + "first_introduced": "15", + "name": "OH_VideoOutput_EnableMirror" + }, + { + "first_introduced": "15", + "name": "OH_VideoOutput_IsMirrorSupported" + }, { "first_introduced": "12", "name": "OH_VideoOutput_GetVideoRotation" @@ -595,6 +607,14 @@ "first_introduced": "12", "name": "OH_CameraDevice_GetCameraOrientation" }, + { + "first_introduced": "15", + "name": "OH_CameraDevice_GetHostDeviceName" + }, + { + "first_introduced": "15", + "name": "OH_CameraDevice_GetHostDeviceType" + }, { "first_introduced": "12", "name": "OH_PhotoNative_GetMainImage" @@ -602,5 +622,33 @@ { "first_introduced": "12", "name": "OH_PhotoNative_Release" + }, + { + "first_introduced": "13", + "name": "OH_CameraManager_RegisterFoldStatusInfoCallback" + }, + { + "first_introduced": "13", + "name": "OH_CameraManager_UnregisterFoldStatusInfoCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_IsAutoDeviceSwitchSupported" + }, + { + "first_introduced": "13", + "name": "OH_CaptureSession_EnableAutoDeviceSwitch" + }, + { + "first_introduced": "14", + "name": "OH_CaptureSession_SetQualityPrioritization" } ] diff --git a/multimedia/camera_framework/camera_device.h b/multimedia/camera_framework/camera_device.h index 731e8e2033ef501c17a4588fce170cba2ac5711f..d96589b3cdf00f1eb7595da37fa52e449bb24146 100644 --- a/multimedia/camera_framework/camera_device.h +++ b/multimedia/camera_framework/camera_device.h @@ -60,6 +60,32 @@ extern "C" { */ Camera_ErrorCode OH_CameraDevice_GetCameraOrientation(Camera_Device* camera, uint32_t* orientation); +/** + * @brief Gets remote device name attribute for a camera device. + * + * @param camera the {@link Camera_Device} which use to get attributes. + * @param hostDeviceName the remote device name attribute if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 15 + */ +Camera_ErrorCode OH_CameraDevice_GetHostDeviceName(Camera_Device* camera, char** hostDeviceName); + + +/** + * @brief Gets the remote device type attribute for a camera device. + * + * @param camera the {@link Camera_Device} which use to get attributes. + * @param hostDeviceType the {@link Camera_HostDeviceType} which remote device type attribute + if the method call succeeds. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 15 + */ +Camera_ErrorCode OH_CameraDevice_GetHostDeviceType(Camera_Device* camera, Camera_HostDeviceType* hostDeviceType); + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/camera_manager.h b/multimedia/camera_framework/camera_manager.h index 42bcc1aaaaec9ea5616078ab178ecdc4e2117cd0..71a8f46166f73fda9dea770d94b460e813e77c5b 100644 --- a/multimedia/camera_framework/camera_manager.h +++ b/multimedia/camera_framework/camera_manager.h @@ -72,6 +72,16 @@ typedef void (*OH_CameraManager_StatusCallback)(Camera_Manager* cameraManager, C */ typedef void (*OH_CameraManager_TorchStatusCallback)(Camera_Manager* cameraManager, Camera_TorchStatusInfo* status); +/** + * @brief Camera manager fold status info callback. + * + * @param cameraManager the {@link Camera_Manager} which deliver the callback. + * @param foldStatusInfo the {@link Camera_FoldStatusInfo} of the device. + * @since 13 + */ +typedef void (*OH_CameraManager_OnFoldStatusInfoChange)(Camera_Manager* cameraManager, + Camera_FoldStatusInfo* foldStatusInfo); + /** * @brief A listener for camera devices status. * @@ -132,6 +142,30 @@ Camera_ErrorCode OH_CameraManager_RegisterTorchStatusCallback(Camera_Manager* ca Camera_ErrorCode OH_CameraManager_UnregisterTorchStatusCallback(Camera_Manager* cameraManager, OH_CameraManager_TorchStatusCallback torchStatusCallback); +/** + * @brief Register fold status info change event callback. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param foldStatusInfoCallback the {@link OH_CameraManager_OnFoldStatusInfoChange} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 13 + */ +Camera_ErrorCode OH_CameraManager_RegisterFoldStatusInfoCallback(Camera_Manager* cameraManager, + OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback); + +/** + * @brief Unregister fold status info change event callback. + * + * @param cameraManager the {@link Camera_Manager} instance. + * @param foldStatusInfoCallback the {@link OH_CameraManager_OnFoldStatusInfoChange} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 13 + */ +Camera_ErrorCode OH_CameraManager_UnregisterFoldStatusInfoCallback(Camera_Manager* cameraManager, + OH_CameraManager_OnFoldStatusInfoChange foldStatusInfoCallback); + /** * @brief Gets supported camera descriptions. * @@ -163,7 +197,7 @@ Camera_ErrorCode OH_CameraManager_DeleteSupportedCameras(Camera_Manager* cameraM * @brief Gets the supported output capability for the specific camera and specific mode. * * @param cameraManager the {@link Camera_Manager} instance. - * @param cameras the {@link Camera_Device} to be queryed. + * @param camera the {@link Camera_Device} to be queryed. * @param cameraOutputCapability the supported {@link Camera_OutputCapability} will be filled * if the method call succeeds. * @return {@link #CAMERA_OK} if the method call succeeds. diff --git a/multimedia/camera_framework/capture_session.h b/multimedia/camera_framework/capture_session.h index 5f19ac7242812b8d06c30338ccf7aca2a2cc8a28..bbccf4e81b6e25290f39ca1b4254e8997bc8d54f 100644 --- a/multimedia/camera_framework/capture_session.h +++ b/multimedia/camera_framework/capture_session.h @@ -94,6 +94,16 @@ typedef void (*OH_CaptureSession_OnError)(Camera_CaptureSession* session, Camera typedef void (*OH_CaptureSession_OnSmoothZoomInfo)(Camera_CaptureSession* session, Camera_SmoothZoomInfo* smoothZoomInfo); +/** + * @brief Capture session device switch status callback. + * + * @param session the {@link Camera_CaptureSession} which deliver the callback. + * @param autoDeviceSwitchStatusInfo the {@link Camera_AutoDeviceSwitchStatusInfo} which delivered by the callback. + * @since 13 + */ +typedef void (*OH_CaptureSession_OnAutoDeviceSwitchStatusChange)(Camera_CaptureSession* session, + Camera_AutoDeviceSwitchStatusInfo* autoDeviceSwitchStatusInfo); + /** * @brief A listener for capture session. * @@ -540,7 +550,7 @@ Camera_ErrorCode OH_CaptureSession_IsFocusModeSupported(Camera_CaptureSession* s * @brief Get current focus mode. * * @param session the {@link Camera_CaptureSession} instance. - * @param exposureBias the current {@link Camera_FocusMode}. + * @param focusMode the current {@link Camera_FocusMode}. * @return {@link #CAMERA_OK} if the method call succeeds. * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. @@ -857,6 +867,68 @@ Camera_ErrorCode OH_CaptureSession_GetActiveColorSpace(Camera_CaptureSession* se Camera_ErrorCode OH_CaptureSession_SetActiveColorSpace(Camera_CaptureSession* session, OH_NativeBuffer_ColorSpace colorSpace); +/** + * @brief Register device switch event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be registered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 13 + */ +Camera_ErrorCode OH_CaptureSession_RegisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange); + +/** + * @brief Unregister device switch event callback. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param autoDeviceSwitchStatusChange the {@link OH_CaptureSession_OnAutoDeviceSwitchStatusChange} to be unregistered. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * @since 13 + */ +Camera_ErrorCode OH_CaptureSession_UnregisterAutoDeviceSwitchStatusCallback(Camera_CaptureSession* session, + OH_CaptureSession_OnAutoDeviceSwitchStatusChange autoDeviceSwitchStatusChange); + +/** + * @brief Check whether auto device switch is supported. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param isSupported the result of whether auto device switch supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. + * @since 13 + */ +Camera_ErrorCode OH_CaptureSession_IsAutoDeviceSwitchSupported(Camera_CaptureSession* session, bool* isSupported); + +/** + * @brief Enable auto switch or not for the camera device. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param enabled the flag of enable auto switch or not. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 13 + */ +Camera_ErrorCode OH_CaptureSession_EnableAutoDeviceSwitch(Camera_CaptureSession* session, bool enabled); + +/** + * @brief Set quality prioritization. + * + * @param session the {@link Camera_CaptureSession} instance. + * @param qualityPrioritization the target {@link Camera_QualityPrioritization} to set. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. + * @since 14 + */ +Camera_ErrorCode OH_CaptureSession_SetQualityPrioritization( + Camera_CaptureSession* session, Camera_QualityPrioritization qualityPrioritization); + #ifdef __cplusplus } #endif diff --git a/multimedia/camera_framework/photo_output.h b/multimedia/camera_framework/photo_output.h index 70f909bcfd628c101c411c890eb8744f9c687b30..27e502b695a667c5e6ad112c8035bb6081bf4919 100644 --- a/multimedia/camera_framework/photo_output.h +++ b/multimedia/camera_framework/photo_output.h @@ -441,6 +441,18 @@ Camera_ErrorCode OH_PhotoOutput_Release(Camera_PhotoOutput* photoOutput); */ Camera_ErrorCode OH_PhotoOutput_IsMirrorSupported(Camera_PhotoOutput* photoOutput, bool* isSupported); +/** + * @brief Enable mirror for photo capture. + * + * @param photoOutput the {@link Camera_PhotoOutput} instance which used to configure mirror. + * @param enabled the flag indicates whether mirror is enabled. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 13 + */ +Camera_ErrorCode OH_PhotoOutput_EnableMirror(Camera_PhotoOutput* photoOutput, bool enabled); + /** * @brief Get active photo output profile. * diff --git a/multimedia/camera_framework/video_output.h b/multimedia/camera_framework/video_output.h index d0228d3e732efec62e2002e25aa1e02249912fe5..d8156403889ed21b5be33629ed8c1ffd33c59e9f 100644 --- a/multimedia/camera_framework/video_output.h +++ b/multimedia/camera_framework/video_output.h @@ -188,6 +188,30 @@ Camera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput */ Camera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile); +/** + * @brief Check whether mirror mode is supported for videoOutput + * + * @param videoOutput the {@link Camera_VideoOutput} instance + * @param isSupported the result of whether mirror mode supported. + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 15 + */ +Camera_ErrorCode OH_VideoOutput_IsMirrorSupported(Camera_VideoOutput* videoOutput, bool* isSupported); + +/** + * @brief Enable or disable mirror mode for videoOutput + * + * @param videoOutput the {@link Camera_VideoOutput} instance + * @param mirrorMode enable mirror mode if mirrorMode is TRUE, otherwise disable + * @return {@link #CAMERA_OK} if the method call succeeds. + * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. + * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. + * @since 15 + */ +Camera_ErrorCode OH_VideoOutput_EnableMirror(Camera_VideoOutput* videoOutput, bool mirrorMode); + /** * @brief Gets the video rotation angle. * diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h index 410a27f20e5a94d19d63d75dd861916d50f2b9bc..9564984482bd3b5e5ca6395df4e96f2b48eaec7b 100644 --- a/multimedia/drm_framework/common/native_drm_common.h +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -536,4 +536,5 @@ typedef struct DRM_MediaKeySystemDescription { } #endif -#endif // NATIVE_DRM_COMMON_H \ No newline at end of file +#endif // NATIVE_DRM_COMMON_H +/** @} */ \ No newline at end of file diff --git a/multimedia/drm_framework/common/native_drm_err.h b/multimedia/drm_framework/common/native_drm_err.h index cb946274eb5d0d2d313024ee27e67ba8b692e41a..882cf41be360ebdc4efb5b76f5b8eb85bc68f005 100644 --- a/multimedia/drm_framework/common/native_drm_err.h +++ b/multimedia/drm_framework/common/native_drm_err.h @@ -112,3 +112,4 @@ typedef enum Drm_ErrCode { #endif #endif // NATIVE_DRM_ERR_H +/** @} */ \ No newline at end of file diff --git a/multimedia/drm_framework/native_mediakeysession.h b/multimedia/drm_framework/native_mediakeysession.h index 1eec1dfc3a0bfc36cc101f626eda94bfef232f00..2d5b72dd788b0097803659227849707691a5bf09 100644 --- a/multimedia/drm_framework/native_mediakeysession.h +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -89,7 +89,7 @@ typedef struct MediaKeySession_Callback { /** * @brief Call back will be invoked when event triggers. - * @param mediaKeySessoin MediaKeySession instance. + * @param mediaKeySession MediaKeySession instance. * @param eventType Event type. * @param info Event info gotten from media key session. * @param infoLen Event info len. @@ -98,19 +98,19 @@ typedef struct MediaKeySession_Callback { * @since 12 * @version 1.0 */ -typedef Drm_ErrCode (*OH_MediaKeySession_EventCallback)(MediaKeySession *mediaKeySessoin, DRM_EventType eventType, +typedef Drm_ErrCode (*OH_MediaKeySession_EventCallback)(MediaKeySession *mediaKeySession, DRM_EventType eventType, uint8_t *info, int32_t infoLen, char *extra); /** * @brief Call back will be invoked when key changes. - * @param mediaKeySessoin MediaKeySession instance. + * @param mediaKeySession MediaKeySession instance. * @param keysInfo Key info gotten from media key system. * @param newKeysAvailable Whether new keys available. * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. * @since 12 * @version 1.0 */ -typedef Drm_ErrCode (*OH_MediaKeySession_KeyChangeCallback)(MediaKeySession *mediaKeySessoin, DRM_KeysInfo *keysInfo, +typedef Drm_ErrCode (*OH_MediaKeySession_KeyChangeCallback)(MediaKeySession *mediaKeySession, DRM_KeysInfo *keysInfo, bool newKeysAvailable); /** @@ -172,7 +172,7 @@ Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *mediaKey * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySession, DRM_MediaKeyStatus *mediaKeyStatus); /** @@ -184,7 +184,7 @@ Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySess * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); +Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySession); /** * @brief Generate offline media key release request. @@ -200,7 +200,7 @@ Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, int32_t *releaseRequestLen); @@ -217,7 +217,7 @@ Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *me * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseReponse, int32_t releaseReponseLen); @@ -232,7 +232,7 @@ Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *me * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySession, uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); /** @@ -245,7 +245,7 @@ Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKey * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaKeySession, DRM_ContentProtectionLevel *contentProtectionLevel); /** @@ -259,7 +259,7 @@ Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaK * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *mediaKeySession, const char *mimeType, bool *status); /** @@ -271,7 +271,7 @@ Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *media * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *mediaKeySession, MediaKeySession_Callback *callback); /** @@ -283,7 +283,7 @@ Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *media * @since 12 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_SetCallback(MediaKeySession *mediaKeySessoin, +Drm_ErrCode OH_MediaKeySession_SetCallback(MediaKeySession *mediaKeySession, OH_MediaKeySession_Callback *callback); /** @@ -295,10 +295,11 @@ Drm_ErrCode OH_MediaKeySession_SetCallback(MediaKeySession *mediaKeySessoin, * @since 11 * @version 1.0 */ -Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); +Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySession); #ifdef __cplusplus } #endif #endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H +/** @} */ \ No newline at end of file diff --git a/multimedia/drm_framework/native_mediakeysystem.h b/multimedia/drm_framework/native_mediakeysystem.h index 966948a6459bf197d2a47e41e1c4f4a030ea7c75..d2f35fc9054b1e665cd7abf18e7309359ff0deed 100644 --- a/multimedia/drm_framework/native_mediakeysystem.h +++ b/multimedia/drm_framework/native_mediakeysystem.h @@ -362,3 +362,4 @@ Drm_ErrCode OH_MediaKeySystem_Destroy(MediaKeySystem *mediaKeySystem); #endif #endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H +/** @} */ \ No newline at end of file diff --git a/multimedia/image_effect/image_effect_filter.h b/multimedia/image_effect/image_effect_filter.h index 8c616e60af91745eac8f12e5ea3e6aedbb99ce75..d42de85d79a133d034657731d24c0339bdd72839 100644 --- a/multimedia/image_effect/image_effect_filter.h +++ b/multimedia/image_effect/image_effect_filter.h @@ -36,6 +36,7 @@ #ifndef NATIVE_IMAGE_EFFECT_FILTER_H #define NATIVE_IMAGE_EFFECT_FILTER_H +#include #include #include "image_effect_errors.h" #include "multimedia/image_framework/image/pixelmap_native.h" @@ -147,6 +148,7 @@ typedef union ImageEffect_DataValue { void *ptrValue; } ImageEffect_DataValue; +#ifdef __cplusplus /** * @brief Data parameter struct information * @@ -159,6 +161,20 @@ typedef struct ImageEffect_Any { /** Effect any data value */ ImageEffect_DataValue dataValue = { 0 }; } ImageEffect_Any; +#else +/** + * @brief Data parameter struct information + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @since 12 + */ +typedef struct ImageEffect_Any { + /** Effect any data type */ + ImageEffect_DataType dataType; + /** Effect any data value */ + ImageEffect_DataValue dataValue; +} ImageEffect_Any; +#endif /** * @brief Enumerates the pixel format type @@ -315,6 +331,7 @@ ImageEffect_ErrorCode OH_EffectFilterInfo_GetSupportedFormats(OH_EffectFilterInf */ ImageEffect_ErrorCode OH_EffectFilterInfo_Release(OH_EffectFilterInfo *info); +#ifdef __cplusplus /** * @brief EffectFilter names information * @@ -327,6 +344,20 @@ typedef struct ImageEffect_FilterNames { /** EffectFilter names memory block */ const char **nameList = nullptr; } ImageEffect_FilterNames; +#else +/** + * @brief EffectFilter names information + * + * @syscap SystemCapability.Multimedia.ImageEffect.Core + * @since 12 + */ +typedef struct ImageEffect_FilterNames { + /** EffectFilter names array size */ + uint32_t size; + /** EffectFilter names memory block */ + const char **nameList; +} ImageEffect_FilterNames; +#endif /** * @brief Define the new type name OH_EffectBufferInfo for struct OH_EffectBufferInfo diff --git a/multimedia/image_framework/include/image/image_common.h b/multimedia/image_framework/include/image/image_common.h index b6cf5943d3fdc2dd37eae7bf2cd3d982477c7fb7..67d972adf0b506d2c1961fcad25b835fd64e85c6 100644 --- a/multimedia/image_framework/include/image/image_common.h +++ b/multimedia/image_framework/include/image/image_common.h @@ -27,6 +27,7 @@ * * @brief Declares the common enums and structs used by the image interface. * + * @library libpixelmap.so * @kit ImageKit * @syscap SystemCapability.Multimedia.Image.Core * @since 12 @@ -173,12 +174,42 @@ typedef enum { IMAGE_ALLOC_FAILED = 7600301, /** memory copy failed */ IMAGE_COPY_FAILED = 7600302, + /** + * @error memory lock or unlock failed + * @since 15 + */ + IMAGE_LOCK_UNLOCK_FAILED = 7600303, /** unknown error */ IMAGE_UNKNOWN_ERROR = 7600901, /** decode data source exception */ IMAGE_BAD_SOURCE = 7700101, + /** + * @error unsupported mime type + * @since 15 + */ + IMAGE_SOURCE_UNSUPPORTED_MIME_TYPE = 7700102, + /** + * @error image to large + * @since 15 + */ + IMAGE_SOURCE_TOO_LARGE = 7700103, + /** + * @error unsupported allocator type, e.g., use share memory to decode a HDR image as only + * DMA supported hdr metadata. + * @since 15 + */ + IMAGE_SOURCE_UNSUPPORTED_ALLOCATOR_TYPE = 7700201, + /* @error unsupported options, e.g, cannot convert image into desired pixel format. + * @since 15 + */ + IMAGE_SOURCE_UNSUPPORTED_OPTIONS = 7700203, /** decode failed */ IMAGE_DECODE_FAILED = 7700301, + /** + * @error memory allocation failed + * @since 15 + */ + IMAGE_SOURCE_ALLOC_FAILED = 7700302, /** encode failed */ IMAGE_ENCODE_FAILED = 7800301, } Image_ErrorCode; diff --git a/multimedia/image_framework/include/image/image_packer_native.h b/multimedia/image_framework/include/image/image_packer_native.h index b80688711c64b08211dcd44d518e737fd4ec4ac4..0a1498f3ac1ca8f4dbdfb18190d9d0293ff63064 100644 --- a/multimedia/image_framework/include/image/image_packer_native.h +++ b/multimedia/image_framework/include/image/image_packer_native.h @@ -62,14 +62,14 @@ typedef struct OH_PackingOptions OH_PackingOptions; /** * @brief Defines the image sequence packing options. * - * @since 13 + * @since 18 */ struct OH_PackingOptionsForSequence; /** * @brief Defines the image sequence packing options. * - * @since 13 + * @since 18 */ typedef struct OH_PackingOptionsForSequence OH_PackingOptionsForSequence; @@ -203,7 +203,7 @@ Image_ErrorCode OH_PackingOptions_Release(OH_PackingOptions *options); * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_Create(OH_PackingOptionsForSequence **options); @@ -215,7 +215,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_Create(OH_PackingOptionsForSequence * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_SetFrameCount(OH_PackingOptionsForSequence *options, uint32_t frameCount); @@ -228,7 +228,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_SetFrameCount(OH_PackingOptionsForS * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or frameCount is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_GetFrameCount(OH_PackingOptionsForSequence *options, uint32_t *frameCount); @@ -242,7 +242,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_GetFrameCount(OH_PackingOptionsForS * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or delayTimeList is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_SetDelayTimeList(OH_PackingOptionsForSequence *options, int32_t *delayTimeList, size_t delayTimeListLength); @@ -256,7 +256,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_SetDelayTimeList(OH_PackingOptionsF * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or delayTimeList is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_GetDelayTimeList(OH_PackingOptionsForSequence *options, int32_t *delayTimeList, size_t delayTimeListLength); @@ -270,7 +270,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_GetDelayTimeList(OH_PackingOptionsF * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or disposalTypes is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_SetDisposalTypes(OH_PackingOptionsForSequence *options, uint32_t *disposalTypes, size_t disposalTypesLength); @@ -284,7 +284,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_SetDisposalTypes(OH_PackingOptionsF * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or disposalTypes is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_GetDisposalTypes(OH_PackingOptionsForSequence *options, uint32_t *disposalTypes, size_t disposalTypesLength); @@ -297,7 +297,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_GetDisposalTypes(OH_PackingOptionsF * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_SetLoopCount(OH_PackingOptionsForSequence *options, uint32_t loopCount); @@ -309,7 +309,7 @@ Image_ErrorCode OH_PackingOptionsForSequence_SetLoopCount(OH_PackingOptionsForSe * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options or loopCount is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_GetLoopCount(OH_PackingOptionsForSequence *options, uint32_t *loopCount); @@ -320,14 +320,14 @@ Image_ErrorCode OH_PackingOptionsForSequence_GetLoopCount(OH_PackingOptionsForSe * @return Image functions result code. * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} options is nullptr. - * @since 13 + * @since 18 */ Image_ErrorCode OH_PackingOptionsForSequence_Release(OH_PackingOptionsForSequence *options); /** * @brief Create a pointer for OH_ImagePackerNative struct. * - * @param options The OH_ImagePackerNative pointer will be operated. + * @param imagePacker The imagePacker to be created. * @return Returns {@link Image_ErrorCode} * @since 12 */ @@ -392,7 +392,7 @@ Image_ErrorCode OH_ImagePackerNative_PackToDataFromPicture(OH_ImagePackerNative * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} one of the pointer type parameters is nullptr, or size/length is invalid * {@link IMAGE_ENCODE_FAILED} encode failed. - * @since 13 + * @since 18 */ Image_ErrorCode OH_ImagePackerNative_PackToDataFromPixelmapSequence(OH_ImagePackerNative *imagePacker, OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence, @@ -452,7 +452,7 @@ Image_ErrorCode OH_ImagePackerNative_PackToFileFromPicture(OH_ImagePackerNative * {@link IMAGE_SUCCESS} if the execution is successful. * {@link IMAGE_BAD_PARAMETER} one of the pointer type parameters is nullptr, or length is invalid * {@link IMAGE_ENCODE_FAILED} encode failed. - * @since 13 + * @since 18 */ Image_ErrorCode OH_ImagePackerNative_PackToFileFromPixelmapSequence(OH_ImagePackerNative *imagePacker, OH_PackingOptionsForSequence *options, OH_PixelmapNative **pixelmapSequence, size_t sequenceLength, int32_t fd); @@ -469,5 +469,5 @@ Image_ErrorCode OH_ImagePackerNative_Release(OH_ImagePackerNative *imagePacker); #ifdef __cplusplus }; #endif -/* *@} */ +/** @} */ #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_IMAGE_PACKER_NATIVE_H_ \ No newline at end of file diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index 7e54b94ef5f383016d0166855b7eb20ffd07396e..73deea8022baa5b9cbcc1eb7301e5ad8d33fba9e 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -14,7 +14,7 @@ */ /** - * @addtogroup image + * @addtogroup ImageSourceNative * @{ * * @brief Provides APIs for access to the image interface. @@ -98,6 +98,26 @@ typedef enum { IMAGE_DYNAMIC_RANGE_HDR = 2, } IMAGE_DYNAMIC_RANGE; +/** + * @brief Type of allocator used to allocate memory of a PixelMap.. + * + * @since 15 + */ +typedef enum { + /* + * The system determines which memory to use to create the PixelMap. + */ + IMAGE_ALLOCATOR_TYPE_AUTO = 0, + /* + * Use DMA buffer to create the PixelMap. + */ + IMAGE_ALLOCATOR_TYPE_DMA = 1, + /* + * Use share memory to create the PixelMap. + */ + IMAGE_ALLOCATOR_TYPE_SHARE_MEMORY = 2, +} IMAGE_ALLOCATOR_TYPE; + /** * @brief Create a pointer for OH_ImageSource_Info struct. * @@ -353,13 +373,42 @@ Image_ErrorCode OH_ImageSourceNative_CreateFromRawFile(RawFileDescriptor *rawFil * @param source Indicates a void pointer(from ImageSource pointer convert). * @param options Indicates a pointer to the options for decoding the image source. * For details, see {@link OH_DecodingOptions}. - * @param resPixMap Indicates a void pointer to the Pixelmap object obtained at the C++ native layer. + * @param pixelmap Indicates a void pointer to the Pixelmap object obtained at the C++ native layer. * @return Returns {@link Image_ErrorCode} * @since 12 */ Image_ErrorCode OH_ImageSourceNative_CreatePixelmap(OH_ImageSourceNative *source, OH_DecodingOptions *options, OH_PixelmapNative **pixelmap); +/** + * @brief Creates a PixelMap based on decoding parameters {@link OH_DecodingOptions}, the memory type used by the + * PixelMap can be specified by allocatorType {@link IMAGE_ALLOCATOR_TYPE}. By default, the system selects the memory + * type based on the image type, image size, platform capability, etc. When processing the PixelMap returned by this + * interface, please always consider the impact of stride. + * + * @param source Image Source. + * @param options Decoding parameters, such as the size, pixel format, and color space of the pixelMap. + * For details, see {@link OH_DecodingOptions}. + * @param allocator Indicate which memory type will be used by the returned PixelMap. + * @param pixelmap Decoded Pixelmap object. + * @return Error code. + * {@link IMAGE_SUCCESS} if the execution is successful. + * {@link IMAGE_BAD_PARAMETER} source is nullptr, or picture is nullptr. + * {@link IMAGE_BAD_SOURCE} data source exception. + * {@link IMAGE_SOURCE_UNSUPPORTED_MIMETYPE} unsupported mime type. + * {@link IMAGE_SOURCE_TOO_LARGE} image to large. + * {@link IMAGE_SOURCE_UNSUPPORTED_ALLOCATOR_TYPE} unsupported allocator type, + * e.g., use share memory to decode a HDR image as only DMA supported hdr metadata. + * {@link IMAGE_SOURCE_UNSUPPORTED_OPTIONS} unsupported options, + * e.g, cannot convert image into desired pixel format. + * {@link IMAGE_DECODE_FAILED} decode failed. + * {@link IMAGE_SOURCE_ALLOC_FAILED} memory allocation failed. + * @since 15 + */ +Image_ErrorCode OH_ImageSourceNative_CreatePixelmapUsingAllocator(OH_ImageSourceNative *source, + OH_DecodingOptions *options, IMAGE_ALLOCATOR_TYPE allocator, OH_PixelmapNative **pixelmap); + + /** * @brief Decodes an void pointer * the Pixelmap objects at the C++ native layer @@ -448,7 +497,7 @@ Image_ErrorCode OH_ImageSourceNative_ModifyImageProperty(OH_ImageSourceNative *s * @brief Obtains the number of frames from an ImageSource object. * * @param source Indicates a pointer to the {@link OH_ImageSource} object at the C++ native layer. - * @param res Indicates a pointer to the number of frames obtained. + * @param frameCount The number of image frameCount. * @return Returns {@link Image_ErrorCode} * @since 12 */ diff --git a/multimedia/image_framework/include/image/picture_native.h b/multimedia/image_framework/include/image/picture_native.h index 42eed5065322b58ecc4cece094d222f4d51080f0..1602c85b02def7d04b60bfabc0df01f45b14a950 100644 --- a/multimedia/image_framework/include/image/picture_native.h +++ b/multimedia/image_framework/include/image/picture_native.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for obtaining picture data and information. * - * @Syscap SystemCapability.Multimedia.Image.Core + * @syscap SystemCapability.Multimedia.Image.Core * @since 13 */ @@ -30,7 +30,7 @@ * * @library libpicture.so * @kit ImageKit - * @Syscap SystemCapability.Multimedia.Image.Core + * @syscap SystemCapability.Multimedia.Image.Core * @since 13 */ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PICTURE_NATIVE_H_ diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 1599a662170d02f5f8e7ad856a9546bbc5f4bfb5..376b2891fe8f4eb438b9e3d9c509c711cf35937d 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for obtaining pixel map data and information. * - * @Syscap SystemCapability.Multimedia.Image.Core + * @syscap SystemCapability.Multimedia.Image.Core * @since 12 */ @@ -30,7 +30,7 @@ * * @library libpixelmap.so * @kit ImageKit - * @Syscap SystemCapability.Multimedia.Image.Core + * @syscap SystemCapability.Multimedia.Image.Core * @since 12 */ @@ -99,6 +99,11 @@ typedef enum { */ PIXEL_FORMAT_UNKNOWN = 0, /* + * ARGB_8888 format + * @since 18 + */ + PIXEL_FORMAT_ARGB_8888 = 1, + /* * RGB_565 format */ PIXEL_FORMAT_RGB_565 = 2, @@ -568,10 +573,10 @@ Image_ErrorCode OH_PixelmapImageInfo_GetRowStride(OH_Pixelmap_ImageInfo *info, u Image_ErrorCode OH_PixelmapImageInfo_GetPixelFormat(OH_Pixelmap_ImageInfo *info, int32_t *pixelFormat); /** - * @brief Get density number for imageinfo struct. + * @brief Get alphaType number for imageinfo struct. * * @param info The imageinfo pointer will be operated. - * @param density The number of imageinfo density. + * @param alphaType The number of imageinfo alphaType. * @return Returns {@link Image_ErrorCode} * @since 12 */ @@ -738,6 +743,41 @@ Image_ErrorCode OH_PixelmapNative_Scale(OH_PixelmapNative *pixelmap, float scale Image_ErrorCode OH_PixelmapNative_ScaleWithAntiAliasing(OH_PixelmapNative *pixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level); +/** + * @brief Create a scaled pixelmap based on the source pixelmap and the input width and height. + * + * @param srcPixelmap The source native pixelmap. + * @param dstPixelmap The destination native pixelmap for create. + * @param scaleX Scaling ratio of the width. + * @param scaleY Scaling ratio of the height. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the execution is successful. + * {@link IMAGE_BAD_PARAMETER} If the param is nullptr or invalid. + * @see OH_PixelmapNative + * @since 18 + */ +Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMap(OH_PixelmapNative *srcPixelmap, OH_PixelmapNative **dstPixelmap, + float scaleX, float scaleY); + +/** + * @brief Create a scaled pixelmap based on the source pixelmap and the input width and height with anti-aliasing. + * + * @param srcPixelmap The source native pixelmap. + * @param dstPixelmap The destination native pixelmap for create. + * @param scaleX Scaling ratio of the width. + * @param scaleY Scaling ratio of the height. + * @param level The anti-aliasing algorithm to be used. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the execution is successful. + * {@link IMAGE_BAD_PARAMETER} If the param is nullptr or invalid. + * {@link IMAGE_TOO_LARGE} If image is too large. + * {@link IMAGE_ALLOC_FAILED} If device has no memory. + * @see OH_PixelmapNative + * @since 18 + */ +Image_ErrorCode OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing(OH_PixelmapNative *srcPixelmap, + OH_PixelmapNative **dstPixelmap, float scaleX, float scaleY, OH_PixelmapNative_AntiAliasingLevel level); + /** * @brief Translates this image based on the input coordinates. * @@ -858,21 +898,6 @@ Image_ErrorCode OH_PixelmapNative_SetMetadata(OH_PixelmapNative *pixelmap, OH_Pi */ Image_ErrorCode OH_PixelmapNative_GetNativeBuffer(OH_PixelmapNative *pixelmap, OH_NativeBuffer **nativeBuffer); -/** - * @brief Set pixelmap memory name. - * - * @param pixelmap The Pixelmap pointer to be operated. - * @param name The pointer of name that needs to be set. - * @param size The size of name size that needs to be set. - * @return Function result code: - * {@link IMAGE_SUCCESS} If the operation is successful. - * {@link IMAGE_BAD_PARAMETER} If invalid parameter, name and size are incorrect. - * {@link IMAGE_UNSUPPORTED_MEMORY_FORMAT} If memory format is unsupported. - * @see OH_PixelmapNative - * @since 13 - */ -Image_ErrorCode OH_PixelmapNative_SetMemoryName(OH_PixelmapNative *pixelmap, char *name, size_t *size); - /** * @brief Get the native colorspace from the PixelMap. * @@ -901,6 +926,77 @@ Image_ErrorCode OH_PixelmapNative_GetColorSpaceNative(OH_PixelmapNative *pixelma Image_ErrorCode OH_PixelmapNative_SetColorSpaceNative(OH_PixelmapNative *pixelmap, OH_NativeColorSpaceManager *colorSpaceNative); +/** + * @brief Set pixelmap memory name. + * + * @param pixelmap The Pixelmap pointer to be operated. + * @param name The pointer of name that needs to be set. + * @param size The size of name size that needs to be set. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If invalid parameter, name and size are incorrect. + * {@link IMAGE_UNSUPPORTED_MEMORY_FORMAT} If memory format is unsupported. + * @see OH_PixelmapNative + * @since 13 + */ +Image_ErrorCode OH_PixelmapNative_SetMemoryName(OH_PixelmapNative *pixelmap, char *name, size_t *size); + +/** + * @brief Get the total number of bytes occupied by all pixels in the Pixelmap, without any padding. + * + * @param pixelmap The Pixelmap pointer to be operated. + * @param byteCount The total number of bytes to be retrieved. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If invalid parameter, pixelmap or byteCount are invalid. + * @see OH_PixelmapNative + * @since 18 + */ +Image_ErrorCode OH_PixelmapNative_GetByteCount(OH_PixelmapNative *pixelmap, uint32_t *byteCount); + +/** + * @brief Get the size of the allocated memory used to store this pixelmap's pixels. + * + * @param pixelmap The Pixelmap pointer to be operated. + * @param allocationByteCount The size of the allocated memory. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If invalid parameter, pixelmap or allocationByteCount are invalid. + * @see OH_PixelmapNative + * @since 18 + */ +Image_ErrorCode OH_PixelmapNative_GetAllocationByteCount(OH_PixelmapNative *pixelmap, uint32_t *allocationByteCount); + +/** + * @brief Obtains the memory address of a PixelMap and locks the memory. + * When the memory is locked, any operation that modifies or releases the PixelMap will fail and return + * {@link IMAGE_BAD_PARAMETER}. + * + * @param pixelmap The PixelMap pointer to be operated. + * @param addr The double pointer to the memory address of the PixelMap. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If invalid parameter, pixelmap or addr are invalid. + * {@link IMAGE_LOCK_UNLOCK_FAILED} If memory failed to be locked. + * @see OH_PixelmapNative + * @since 15 + */ +Image_ErrorCode OH_PixelmapNative_AccessPixels(OH_PixelmapNative *pixelmap, void **addr); + +/** + * @brief Unlocks the memory of the PixelMap data. + * This function is used with {@link OH_PixelmapNative_AccessPixels} in pairs. + * + * @param pixelmap The PixelMap pointer to be operated. + * @return Function result code: + * {@link IMAGE_SUCCESS} If the operation is successful. + * {@link IMAGE_BAD_PARAMETER} If invalid parameter, pixelmap is invalid. + * {@link IMAGE_LOCK_UNLOCK_FAILED} If memory failed to be unlocked. + * @see OH_PixelmapNative + * @since 15 + */ +Image_ErrorCode OH_PixelmapNative_UnaccessPixels(OH_PixelmapNative *pixelmap); + #ifdef __cplusplus }; #endif diff --git a/multimedia/image_framework/include/image_mdk.h b/multimedia/image_framework/include/image_mdk.h index 3b3653658e506918f8ead3b6f06312263f6a0216..053fbde05571147789851c2019d9eea8cdd7997f 100644 --- a/multimedia/image_framework/include/image_mdk.h +++ b/multimedia/image_framework/include/image_mdk.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for access to the image interface. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ @@ -30,7 +30,9 @@ * @brief Declares functions that access the image rectangle, size, format, and component data. * Need link libimagendk.z.so * + * @library libimage_ndk.z.so * @kit ImageKit + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ diff --git a/multimedia/image_framework/include/image_mdk_common.h b/multimedia/image_framework/include/image_mdk_common.h index 2ed208982e4c74eadb7fcfee877136e1b16ed3c0..c34252403a8b34489a563fc2807eb7dffe343365 100644 --- a/multimedia/image_framework/include/image_mdk_common.h +++ b/multimedia/image_framework/include/image_mdk_common.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for access to the image interface. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ @@ -30,6 +30,8 @@ * @brief Declares the common enums and structs used by the image interface. * * @kit ImageKit + * @library libimage_ndk.z.so + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ diff --git a/multimedia/image_framework/include/image_packer_mdk.h b/multimedia/image_framework/include/image_packer_mdk.h index 48a26cf4cb91cef44d11e4c944f729339be21203..c7783cfc09a86d1f83794bb580fffa92b036468d 100644 --- a/multimedia/image_framework/include/image_packer_mdk.h +++ b/multimedia/image_framework/include/image_packer_mdk.h @@ -95,7 +95,7 @@ typedef struct ImagePacker_Opts_ ImagePacker_Opts; * @return Returns {@link IRNdkErrCode} IMAGE_RESULT_SUCCESS - if the operation is successful. * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ diff --git a/multimedia/image_framework/include/image_pixel_map_mdk.h b/multimedia/image_framework/include/image_pixel_map_mdk.h index b05dc9ca782afa1d6ffa898d34dabdd9c8ef52d1..2fd6f9f2214007b9dac2998e2e68af481e08d53b 100644 --- a/multimedia/image_framework/include/image_pixel_map_mdk.h +++ b/multimedia/image_framework/include/image_pixel_map_mdk.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for obtaining pixel map data and information. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 1.0 */ @@ -30,6 +30,8 @@ * @brief Declares the APIs that can lock, access, and unlock a pixel map. * Need link libpixelmapndk.z.so * + * @library libpixelmap_ndk.so + * @syscap SystemCapability.Multimedia.Image * @kit ImageKit * @since 10 * @version 1.0 diff --git a/multimedia/image_framework/include/image_pixel_map_napi.h b/multimedia/image_framework/include/image_pixel_map_napi.h index 3f4a447f578ded28061c4fe94cb52c952f0de5e9..91328b45e8e601639aed7a76f8cbf19b9645f184 100644 --- a/multimedia/image_framework/include/image_pixel_map_napi.h +++ b/multimedia/image_framework/include/image_pixel_map_napi.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for obtaining pixel map data and information. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 8 * @version 1.0 */ @@ -29,6 +29,8 @@ * * @brief Declares the APIs that can lock, access, and unlock a pixel map. * + * @library libpixelmap_ndk.so + * @syscap SystemCapability.Multimedia.Image * @kit ImageKit * @since 8 * @version 1.0 @@ -36,7 +38,11 @@ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_PIXEL_MAP_NAPI_H_ +#ifdef __cplusplus #include +#else +#include +#endif #include "napi/native_api.h" namespace OHOS { namespace Media { diff --git a/multimedia/image_framework/include/image_receiver_mdk.h b/multimedia/image_framework/include/image_receiver_mdk.h index 1033f0bfe79d7d68d154e1b4e8158720e5c4e72f..9f90dc94720a83d82ce92f06d90a0c1aae98f0a3 100644 --- a/multimedia/image_framework/include/image_receiver_mdk.h +++ b/multimedia/image_framework/include/image_receiver_mdk.h @@ -19,7 +19,7 @@ * * @brief Provides APIs for obtaining image data from the native layer. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ @@ -30,7 +30,9 @@ * @brief Declares the APIs for obtaining image data from the native layer. * Need link libimagendk.z.so and libimage_receiverndk.z.so * + * @library libimage_receiver_ndk.z.so * @kit ImageKit + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 2.0 */ diff --git a/multimedia/image_framework/include/image_source_mdk.h b/multimedia/image_framework/include/image_source_mdk.h index ae7cadf4d9edff340a1a02f2e672ca86f13f6c03..35278f5aa847bb62bf75ea4cb590342c11e32e61 100644 --- a/multimedia/image_framework/include/image_source_mdk.h +++ b/multimedia/image_framework/include/image_source_mdk.h @@ -19,7 +19,7 @@ * * @brief Provides native APIs for image sources. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -29,15 +29,20 @@ * * @brief Declares APIs for decoding an image source into a pixel map. * + * @library libimage_source_ndk.z.so * @kit ImageKit - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ #ifndef INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ #define INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ +#ifdef __cplusplus #include +#else +#include +#endif #include "napi/native_api.h" #include "image_mdk_common.h" #include "rawfile/raw_file.h" @@ -48,7 +53,7 @@ extern "C" { /** * @brief Defines a native image source object for the image source APIs. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -57,7 +62,7 @@ struct ImageSourceNative_; /** * @brief Defines a native image source object for the image source APIs. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -68,7 +73,7 @@ typedef struct ImageSourceNative_ ImageSourceNative; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -79,7 +84,7 @@ static const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -90,7 +95,7 @@ static const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -101,7 +106,7 @@ static const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -112,7 +117,7 @@ static const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -123,7 +128,7 @@ static const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -134,7 +139,7 @@ static const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -145,7 +150,7 @@ static const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -156,7 +161,7 @@ static const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -167,7 +172,7 @@ static const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -178,7 +183,7 @@ static const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -189,7 +194,7 @@ static const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -200,7 +205,7 @@ static const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -211,7 +216,7 @@ static const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber"; * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}.\n * Add static keyword since API 12, it is used to limit the scope of the constant to a single file.\n * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -222,7 +227,7 @@ static const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBi * It is used in {@link OhosImageDecodingOps}, {@link OH_ImageSource_CreatePixelMap}, and * {@link OH_ImageSource_CreatePixelMapList}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -241,7 +246,7 @@ struct OhosImageRegion { * @brief Defines image source options infomation * {@link OH_ImageSource_Create} and {@link OH_ImageSource_CreateIncremental}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -258,7 +263,7 @@ struct OhosImageSourceOps { * @brief Defines the options for decoding the image source. * It is used in {@link OH_ImageSource_CreatePixelMap} and {@link OH_ImageSource_CreatePixelMapList}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -284,7 +289,7 @@ struct OhosImageDecodingOps { /** * @brief Defines the image source information, which is obtained by calling {@link OH_ImageSource_GetImageInfo}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -305,7 +310,7 @@ struct OhosImageSourceInfo { * @brief Defines the input resource of the image source. It is obtained by calling {@link OH_ImageSource_Create}. * Only one type of resource is accepted at a time. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 * @deprecated since 11 @@ -327,7 +332,7 @@ struct OhosImageSource { * @brief Defines the delay time list of the image source. It is obtained by calling * {@link OH_ImageSource_GetDelayTime}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -342,7 +347,7 @@ struct OhosImageSourceDelayTimeList { * @brief Defines image source supported format string. * {@link OhosImageSourceSupportedFormatList} and {@link OH_ImageSource_GetSupportedFormats} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -357,7 +362,7 @@ struct OhosImageSourceSupportedFormat { * @brief Defines the format string list supported by the image source. * It is obtained by calling {@link OH_ImageSource_GetSupportedFormats}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -372,7 +377,7 @@ struct OhosImageSourceSupportedFormatList { * @brief Defines the property string (in key-value format) of the image source. * It is used in {@link OH_ImageSource_GetImageProperty} and {@link OH_ImageSource_ModifyImageProperty}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -386,7 +391,7 @@ struct OhosImageSourceProperty { /** * @brief Defines the update data of the image source. It is obtained by calling {@link OH_ImageSource_UpdateData}. * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -432,7 +437,7 @@ struct OhosImageSourceUpdateData { * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed. * @see {@link OhosImageSource}, {@link OhosImageSourceOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 * @deprecated since 11 @@ -459,7 +464,7 @@ int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * @see {@link OhosImageSourceOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ @@ -481,7 +486,7 @@ int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size, * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * @see {@link OhosImageSourceOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ @@ -504,7 +509,7 @@ int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd, * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * @see {@link OhosImageSourceOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ @@ -526,7 +531,7 @@ int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSi * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * @see {@link OhosImageSourceOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ @@ -564,7 +569,7 @@ int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile * returns {@link IRNdkErrCode} IMAGE_RESULT_FREAD_FAILED - if read file failed. * @see {@link OhosImageSource}, {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 * @deprecated since 11 @@ -590,7 +595,7 @@ int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* s * returns {@link IRNdkErrCode} IMAGE_RESULT_INVALID_PARAMETER - if invalid parameter. * @see {@link OhosImageSourceOps}, {@link OH_ImageSource_UpdateData} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 11 * @version 4.1 */ @@ -613,7 +618,7 @@ int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, si * returns {@link IRNdkErrCode} IMAGE_RESULT_CHECK_FORMAT_ERROR - if decode fail. * @see {@link OhosImageSourceSupportedFormatList}, {@link OhosImageSourceSupportedFormat} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -629,7 +634,7 @@ int32_t OH_ImageSource_GetSupportedFormats(struct OhosImageSourceSupportedFormat * returns a null pointer otherwise. * @see {@link ImageSourceNative}, {@link OH_ImageSource_Release} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -674,7 +679,7 @@ ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source); * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed. * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -722,7 +727,7 @@ int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native, * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative}, {@link OhosImageDecodingOps} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -757,7 +762,7 @@ int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native, * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative}, {@link OhosImageSourceDelayTimeList} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -789,7 +794,7 @@ int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native, * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -822,7 +827,7 @@ int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t * * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative}, {@link OhosImageSourceInfo} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -858,7 +863,7 @@ int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t ind * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -891,7 +896,7 @@ int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native, * returns {@link IRNdkErrCode} IMAGE_RESULT_PROPERTY_NOT_EXIST - if image property not exist. * @see {@link ImageSourceNative}, {@link OhosImageSourceProperty} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -934,7 +939,7 @@ int32_t OH_ImageSource_ModifyImageProperty(const ImageSourceNative* native, * returns {@link IRNdkErrCode} IMAGE_RESULT_ALLOCATER_TYPE_ERROR - if hard decode failed. * @see {@link ImageSourceNative}, {@link OhosImageSourceUpdateData} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -953,7 +958,7 @@ int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosIm * returns {@link IRNdkErrCode} IMAGE_RESULT_DATA_ABNORMAL - if image input data error. * @see {@link ImageSourceNative}, {@link OH_ImageSource_Create}, {@link OH_ImageSource_CreateIncremental} * - * @Syscap SystemCapability.Multimedia.Image + * @syscap SystemCapability.Multimedia.Image * @since 10 * @version 4.0 */ @@ -962,3 +967,4 @@ int32_t OH_ImageSource_Release(ImageSourceNative* native); }; #endif #endif // INTERFACES_KITS_NATIVE_INCLUDE_IMAGE_SOURCE_MDK_H_ +/** @} */ diff --git a/multimedia/image_framework/libimage_packer.ndk.json b/multimedia/image_framework/libimage_packer.ndk.json index c6f2435047bd9bc116df32a37adeb447808f7d1a..5684b6584c97749e90b4408202c1b0662c81f5b4 100644 --- a/multimedia/image_framework/libimage_packer.ndk.json +++ b/multimedia/image_framework/libimage_packer.ndk.json @@ -40,43 +40,43 @@ "name": "OH_PackingOptions_Release" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_Create" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_SetFrameCount" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_GetFrameCount" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_SetDelayTimeList" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_GetDelayTimeList" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_SetDisposalTypes" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_GetDisposalTypes" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_SetLoopCount" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_GetLoopCount" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_PackingOptionsForSequence_Release" }, { @@ -96,7 +96,7 @@ "name": "OH_ImagePackerNative_PackToDataFromPicture" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_ImagePackerNative_PackToDataFromPixelmapSequence" }, { @@ -112,7 +112,7 @@ "name": "OH_ImagePackerNative_PackToFileFromPicture" }, { - "first_introduced": "13", + "first_introduced": "18", "name": "OH_ImagePackerNative_PackToFileFromPixelmapSequence" }, { diff --git a/multimedia/image_framework/libimage_source.ndk.json b/multimedia/image_framework/libimage_source.ndk.json index 37312763efbe5c189c070d93a8d3e90281c6eea7..5facd5daae03cbd27a4e4632910a28d0509522ca 100644 --- a/multimedia/image_framework/libimage_source.ndk.json +++ b/multimedia/image_framework/libimage_source.ndk.json @@ -95,6 +95,10 @@ "first_introduced": "12", "name": "OH_ImageSourceNative_CreatePixelmap" }, + { + "first_introduced": "15", + "name": "OH_ImageSourceNative_CreatePixelmapUsingAllocator" + }, { "first_introduced": "12", "name": "OH_ImageSourceNative_CreatePixelmapList" diff --git a/multimedia/image_framework/libpixelmap.ndk.json b/multimedia/image_framework/libpixelmap.ndk.json index 4c103c8aea0f003b44d024d9e8c13cbe9506311b..356953cf66d49cebb72a23edf071d5eb51a83627 100644 --- a/multimedia/image_framework/libpixelmap.ndk.json +++ b/multimedia/image_framework/libpixelmap.ndk.json @@ -123,6 +123,14 @@ "first_introduced": "12", "name": "OH_PixelmapNative_ScaleWithAntiAliasing" }, + { + "first_introduced": "18", + "name": "OH_PixelmapNative_CreateScaledPixelMap" + }, + { + "first_introduced": "18", + "name": "OH_PixelmapNative_CreateScaledPixelMapWithAntiAliasing" + }, { "first_introduced": "12", "name": "OH_PixelmapNative_Translate" @@ -182,5 +190,21 @@ { "first_introduced": "13", "name": "OH_PixelmapNative_SetMemoryName" + }, + { + "first_introduced": "18", + "name": "OH_PixelmapNative_GetByteCount" + }, + { + "first_introduced": "18", + "name": "OH_PixelmapNative_GetAllocationByteCount" + }, + { + "first_introduced": "15", + "name": "OH_PixelmapNative_AccessPixels" + }, + { + "first_introduced": "15", + "name": "OH_PixelmapNative_UnaccessPixels" } ] \ No newline at end of file diff --git a/multimedia/media_foundation/core/BUILD.gn b/multimedia/media_foundation/core/BUILD.gn index 25a6ff245652c8414604010627c3818d6303d07e..e81ceb3386ebeb39fdac92ad81985dfb90ddc18f 100644 --- a/multimedia/media_foundation/core/BUILD.gn +++ b/multimedia/media_foundation/core/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. +# Copyright (C) 2022-2025 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 @@ -17,6 +17,7 @@ import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("native_media_core_header") { dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" sources = [ + "../media_types.h", "../native_avbuffer.h", "../native_avbuffer_info.h", "../native_averrors.h", @@ -38,6 +39,7 @@ ohos_ndk_library("libnative_media_core") { system_capability = "SystemCapability.Multimedia.Media.Core" system_capability_headers = [ + "multimedia/player_framework/media_types.h", "multimedia/player_framework/native_avbuffer.h", "multimedia/player_framework/native_avbuffer_info.h", "multimedia/player_framework/native_averrors.h", diff --git a/tee/include/oemkey.h b/multimedia/media_foundation/media_types.h similarity index 38% rename from tee/include/oemkey.h rename to multimedia/media_foundation/media_types.h index dc2e3daeb314e094f060a392c55c0f49e7166001..d302fb970512dc5e13d942582c58302c7b864f8e 100644 --- a/tee/include/oemkey.h +++ b/multimedia/media_foundation/media_types.h @@ -1,65 +1,70 @@ -/* - * 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 OEMKEY_H -#define OEMKEY_H -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file oemkey.h - * - * @brief Provides the method for obtaining the hardware provision key. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @brief Obtains the provision key. - * - * @param oem_key Indicates the pointer to the buffer for storing the provision key. - * @param key_size Indicates the length of the buffer used to store the provision key, which is 16. - * - * @return Returns 0 if the operation is successful. - * @return Returns other values otherwise. - * - * @since 12 - */ -uint32_t tee_hal_get_provision_key(uint8_t *oem_key, size_t key_size); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif +/* + * Copyright (C) 2025 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 Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 18 + */ + +/** + * @file media_types.h + * + * @brief Declared the common media types definition. + * + * @kit AVCodecKit + * @library libnative_media_core.so + * @syscap SystemCapability.Multimedia.Media.Core + * @since 18 + */ + +#ifndef MEDIA_TYPES_H +#define MEDIA_TYPES_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates HDR types. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 18 + */ +typedef enum OH_Core_HdrType { + /** + * This option is used to mark none HDR type. + */ + OH_CORE_HDR_TYPE_NONE = 0, + /** + * This option is used to mark HDR Vivid type. + */ + OH_CORE_HDR_TYPE_VIVID = 1, +} OH_Core_HdrType; + +#ifdef __cplusplus +} +#endif + +#endif // MEDIA_TYPES_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_foundation/native_avbuffer.h b/multimedia/media_foundation/native_avbuffer.h index 726f06c4f184ddf0094faf60fe575301c7d2fa92..29ff41d31536af91b853ac9913aa96a421a5d150 100644 --- a/multimedia/media_foundation/native_avbuffer.h +++ b/multimedia/media_foundation/native_avbuffer.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** * @file native_avbuffer.h * - * @brief Provides audio and video buffer. + * @brief Declared the function interface of media data structure AVBuffer. * * @kit AVCodecKit * @library libnative_media_core.so @@ -166,3 +177,4 @@ OH_NativeBuffer *OH_AVBuffer_GetNativeBuffer(OH_AVBuffer *buffer); #endif #endif // NATIVE_AVBUFFER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_foundation/native_avbuffer_info.h b/multimedia/media_foundation/native_avbuffer_info.h index afd1ce3bdb4102d6bcfb5caf7404635ccdc15092..4908917109555e2291536ce4d58dfb9abf883313 100644 --- a/multimedia/media_foundation/native_avbuffer_info.h +++ b/multimedia/media_foundation/native_avbuffer_info.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** * @file native_avbuffer_info.h * - * @brief Provides audio and video buffer info. + * @brief Declared the definition of the AVBuffer property for media data structures. * * @kit AVCodecKit * @library libnative_media_core.so @@ -81,3 +92,4 @@ typedef struct OH_AVCodecBufferAttr { #endif #endif // NATIVE_AVBUFFER_INFO_H +/** @} */ diff --git a/multimedia/media_foundation/native_averrors.h b/multimedia/media_foundation/native_averrors.h index edecfa2a89f3f673d09682def19034e2082bacb9..398a16f0fc334460d5a1d30647f198677c9def9a 100644 --- a/multimedia/media_foundation/native_averrors.h +++ b/multimedia/media_foundation/native_averrors.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** * @file native_averrors.h * - * @brief Provides audio and video error description. + * @brief Media framework error code. * * @kit AVCodecKit * @library libnative_media_core.so @@ -83,6 +94,11 @@ typedef enum OH_AVErrCode { * @since 12 */ AV_ERR_INPUT_DATA_ERROR = 10, + /** + * @error unsupported format. + * @since 18 + */ + AV_ERR_UNSUPPORTED_FORMAT = 11, /** * @error extend err start. */ @@ -107,6 +123,63 @@ typedef enum OH_AVErrCode { * @since 12 */ AV_ERR_VIDEO_UNSUPPORTED_COLOR_SPACE_CONVERSION = 301, + /** + * @error can not find host, maybe the address of server is incorrect. + * @since 14 + */ + AV_ERR_IO_CANNOT_FIND_HOST = 5411001, + /** + * @error network connection timeout. + * @since 14 + */ + AV_ERR_IO_CONNECTION_TIMEOUT = 5411002, + /** + * @error failed link due to abnormal network. + * @since 14 + */ + AV_ERR_IO_NETWORK_ABNORMAL = 5411003, + /** + * @error failed link due to unavailable network. + * @since 14 + */ + AV_ERR_IO_NETWORK_UNAVAILABLE = 5411004, + /** + * @error network permission dennied. + * @since 14 + */ + AV_ERR_IO_NO_PERMISSION = 5411005, + /** + * @error the client request parameters are incorrect or exceed the processing capacity. + * @since 14 + */ + AV_ERR_IO_NETWORK_ACCESS_DENIED = 5411006, + /** + * @error cannot find available network resources. + * @since 14 + */ + AV_ERR_IO_RESOURCE_NOT_FOUND = 5411007, + /** + * @error the server failed to verify the client certificate because the certificate is not carried, + * the certificate is invalid, or the certificate is expired. + * @since 14 + */ + AV_ERR_IO_SSL_CLIENT_CERT_NEEDED = 5411008, + /** + * @error the client failed to verify the server certificate because the certificate is not carried, + * the certificate is invalid, or the certificate is expired. + * @since 14 + */ + AV_ERR_IO_SSL_CONNECT_FAIL = 5411009, + /** + * @error SSL server cert untrusted. + * @since 14 + */ + AV_ERR_IO_SSL_SERVER_CERT_UNTRUSTED = 5411010, + /** + * @error unsupported request due to network protocols. + * @since 14 + */ + AV_ERR_IO_UNSUPPORTED_REQUEST = 5411011, } OH_AVErrCode; #ifdef __cplusplus @@ -114,3 +187,4 @@ typedef enum OH_AVErrCode { #endif #endif // NATIVE_AVERRORS_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_foundation/native_avformat.h b/multimedia/media_foundation/native_avformat.h index d07ee0c6d862ce7a6ba93a83829770216453195f..ac30d2d47e37ffb44167ee56b6eef7c65b8f52b0 100644 --- a/multimedia/media_foundation/native_avformat.h +++ b/multimedia/media_foundation/native_avformat.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** * @file native_avformat.h * - * @brief Provides audio and video format. + * @brief Declared functions and enumerations related to OH_AVFormat. * * @kit AVCodecKit * @library libnative_media_core.so @@ -315,4 +326,5 @@ const char *OH_AVFormat_DumpInfo(struct OH_AVFormat *format); } #endif -#endif // NATIVE_AVFORMAT_H \ No newline at end of file +#endif // NATIVE_AVFORMAT_H +/** @} */ \ No newline at end of file diff --git a/multimedia/media_foundation/native_avmemory.h b/multimedia/media_foundation/native_avmemory.h index b00f2b45b04442b6557ef03c8932e0d58beefc33..224f34004246d6cf48a998f3d405491d47544b06 100644 --- a/multimedia/media_foundation/native_avmemory.h +++ b/multimedia/media_foundation/native_avmemory.h @@ -13,10 +13,21 @@ * limitations under the License. */ +/** + * @addtogroup Core + * @{ + * + * @brief The Core module provides basic backbone capabilities for media frameworks, + * including functions such as memory, error codes, and media data structures. + * + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** * @file native_avmemory.h * - * @brief Provides audio and video memory. + * @brief Declared the definition of media data structure AVMemory. * * @kit AVCodecKit * @library libnative_media_core.so @@ -99,3 +110,4 @@ OH_AVErrCode OH_AVMemory_Destroy(struct OH_AVMemory *mem); #endif #endif // NATIVE_AVMEMORY_H +/** @} */ diff --git a/multimedia/player_framework/avimage_generator.h b/multimedia/player_framework/avimage_generator.h new file mode 100644 index 0000000000000000000000000000000000000000..280b7b04013610edfaa10b10bb6a879860b78aa9 --- /dev/null +++ b/multimedia/player_framework/avimage_generator.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2025 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 AVImageGenerator + * @{ + * + * @brief Provides APIs for generating an image at the specific time from a video resource. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 18 + */ + +/** + * @file avimage_generator.h + * + * @brief Defines the avimage generator APIs. Uses the Native APIs provided by Media AVImageGenerator + * to get an image at the specific time from a video resource. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @kit MediaKit + * @library libavimage_generator.so + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVIMAGE_GENERATOR_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVIMAGE_GENERATOR_H + +#include +#include +#include +#include "native_averrors.h" +#include "avimage_generator_base.h" +#include "multimedia/image_framework/image/pixelmap_native.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define OH_AVImageGenerator field. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 18 + */ +typedef struct OH_AVImageGenerator OH_AVImageGenerator; + +/** + * @brief Create an image generator. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @return Returns a pointer to an OH_AVImageGenerator instance for success, nullptr for failure. + * Possible failure causes: HstEngineFactory failed to CreateAVMetadataHelperEngine. + * @since 18 + */ +OH_AVImageGenerator* OH_AVImageGenerator_Create(void); + +/** + * @brief Sets the media file descriptor source for the image generator. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @param generator Pointer to an OH_AVImageGenerator instance. + * @param fd Indicates the file descriptor of media source. + * @param offset Indicates the offset of media source in file descriptor. + * @param size Indicates the size of media source. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input generator is nullptr or input param is invalid. + * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. + * {@link AV_ERR_NO_MEMORY} if internal memory allocation failed. + * @since 18 + */ +OH_AVErrCode OH_AVImageGenerator_SetFDSource(OH_AVImageGenerator* generator, + int32_t fd, int64_t offset, int64_t size); + +/** + * @brief Fetch an image at the specific time from a video resource. + * + * This function must be called after {@link SetFDSource}. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @param generator Pointer to an OH_AVImageGenerator instance. + * @param timeUs The time expected to fetch picture from the video resource. The unit is microsecond(us). + * @param options The time options about the relationship between the given timeUs and a key frame, + * see {@link OH_AVImageGenerator_QueryOptions}. + * @param pixelMap The fetched output image from the video source. For details, see {@link OH_PixelmapNative}. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input generator is nullptr or input param is invalid. + * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. + * {@link AV_ERR_UNSUPPORTED_FORMAT} if format is unsupported. + * {@link AV_ERR_NO_MEMORY} if internal memory allocation failed. + * @since 18 + */ +OH_AVErrCode OH_AVImageGenerator_FetchFrameByTime(OH_AVImageGenerator* generator, + int64_t timeUs, OH_AVImageGenerator_QueryOptions options, OH_PixelmapNative** pixelMap); + +/** + * @brief Release the resource used for AVImageGenerator. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @param generator Pointer to an OH_AVImageGenerator instance. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input generator is nullptr or input param is invalid. + * @since 18 + */ +OH_AVErrCode OH_AVImageGenerator_Release(OH_AVImageGenerator* generator); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVIMAGE_GENERATOR_H +/** @} */ diff --git a/multimedia/player_framework/avimage_generator/BUILD.gn b/multimedia/player_framework/avimage_generator/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..44efe2ff34d9eee54e66098d83164359ca831106 --- /dev/null +++ b/multimedia/player_framework/avimage_generator/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (C) 2025 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("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/player_framework/config.gni") + +ohos_ndk_headers("avimage_generator_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" + sources = [ + "../avimage_generator.h", + "../avimage_generator_base.h", + ] +} + +ohos_ndk_library("libavimage_generator") { + ndk_description_file = "./libavimage_generator.ndk.json" + output_name = "avimage_generator" + output_extension = "so" + + system_capability = "SystemCapability.Multimedia.Media.AVImageGenerator" + system_capability_headers = [ + "multimedia/player_framework/avimage_generator.h", + "multimedia/player_framework/avimage_generator_base.h", + ] +} diff --git a/multimedia/player_framework/avimage_generator/libavimage_generator.ndk.json b/multimedia/player_framework/avimage_generator/libavimage_generator.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..9234bee89852ea7ba760356b5599eab0cd0d55c1 --- /dev/null +++ b/multimedia/player_framework/avimage_generator/libavimage_generator.ndk.json @@ -0,0 +1,18 @@ +[ + { + "first_introduced": "18", + "name": "OH_AVImageGenerator_Create" + }, + { + "first_introduced": "18", + "name": "OH_AVImageGenerator_SetFDSource" + }, + { + "first_introduced": "18", + "name": "OH_AVImageGenerator_FetchFrameByTime" + }, + { + "first_introduced": "18", + "name": "OH_AVImageGenerator_Release" + } +] \ No newline at end of file diff --git a/multimedia/player_framework/avimage_generator_base.h b/multimedia/player_framework/avimage_generator_base.h new file mode 100644 index 0000000000000000000000000000000000000000..5709791426313a562f1064e7ba6171418b2f7135 --- /dev/null +++ b/multimedia/player_framework/avimage_generator_base.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2025 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 AVImageGenerator + * @{ + * + * @brief Provides APIs for generating an image at the specific time from a video resource. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 18 + */ + +/** + * @file avimage_generator_base.h + * + * @brief Defines the structure and enumeration for AVImageGenerator. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @kit MediaKit + * @library libavimage_generator.so + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVIMAGE_GENERATOR_BASE_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVIMAGE_GENERATOR_BASE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates the image query options about the relationship between the given timeUs and a key frame. + * + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 18 + */ +typedef enum OH_AVImageGenerator_QueryOptions { + /** + * This option is used to fetch a key frame from the given media + * resource that is located right after or at the given time. + */ + OH_AVIMAGE_GENERATOR_QUERY_NEXT_SYNC = 0, + /** + * This option is used to fetch a key frame from the given media + * resource that is located right before or at the given time. + */ + OH_AVIMAGE_GENERATOR_QUERY_PREVIOUS_SYNC = 1, + /** + * This option is used to fetch a key frame from the given media + * resource that is located closest to or at the given time. + */ + OH_AVIMAGE_GENERATOR_QUERY_CLOSEST_SYNC = 2, + /** + * This option is used to fetch a frame (maybe not keyframe) from + * the given media resource that is located closest to or at the given time. + */ + OH_AVIMAGE_GENERATOR_QUERY_CLOSEST = 3, +} OH_AVImageGenerator_QueryOptions; + +#ifdef __cplusplus +} +#endif +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_BASE_H +/** @} */ diff --git a/multimedia/player_framework/avmetadata_extractor.h b/multimedia/player_framework/avmetadata_extractor.h new file mode 100644 index 0000000000000000000000000000000000000000..9aa92ad093e54ef7e1c5f97204aedd20f48eda2e --- /dev/null +++ b/multimedia/player_framework/avmetadata_extractor.h @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2025 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 AVMetadataExtractor + * @{ + * + * @brief Provides APIs of metadata capability for Media Source. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ + +/** + * @file avmetadata_extractor.h + * + * @brief Defines the avmetadata extractor APIs. Uses the Native APIs provided by Media AVMetadataExtractor + * to get metadata from the media source. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @kit MediaKit + * @library libavmetadata_extractor.so + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_H + +#include +#include +#include +#include "native_averrors.h" +#include "avmetadata_extractor_base.h" +#include "native_avcodec_base.h" +#include "native_avformat.h" +#include "multimedia/image_framework/image/pixelmap_native.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define OH_AVMetadataExtractor field. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +typedef struct OH_AVMetadataExtractor OH_AVMetadataExtractor; + +/** + * @brief Create a metadata extractor. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @return Returns a pointer to an OH_AVMetadataExtractor instance for success, nullptr for failure + * Possible failure causes: failed to HstEngineFactory::CreateAVMetadataHelperEngine. + * @since 18 + */ +OH_AVMetadataExtractor* OH_AVMetadataExtractor_Create(void); + +/** + * @brief Sets the media file descriptor source for the metadata extractor. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @param extractor Pointer to an OH_AVMetadataExtractor instance. + * @param fd Indicates the file descriptor of media source. + * @param offset Indicates the offset of media source in file descriptor. + * @param size Indicates the size of media source. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input extractor is nullptr or input param is invalid. + * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. + * {@link AV_ERR_NO_MEMORY} if internal memory allocation failed. + * @since 18 + */ +OH_AVErrCode OH_AVMetadataExtractor_SetFDSource(OH_AVMetadataExtractor* extractor, + int32_t fd, int64_t offset, int64_t size); + +/** + * @brief Extract metadata info from the media source. + * This function must be called after {@link SetFDSource}. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @param extractor Pointer to an OH_AVMetadataExtractor instance. + * @param avMetadata Pointer to an {@link OH_AVFormat} instance, its content contains the fetched metadata info. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input extractor is nullptr or input param is invalid. + * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. + * {@link AV_ERR_UNSUPPORTED_FORMAT} if format is unsupported. + * {@link AV_ERR_NO_MEMORY} if internal memory allocation failed. + * @since 18 + */ +OH_AVErrCode OH_AVMetadataExtractor_FetchMetadata(OH_AVMetadataExtractor* extractor, OH_AVFormat* avMetadata); + +/** + * @brief Fetch album cover from the audio source. + * This function must be called after {@link SetFDSource}. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @param extractor Pointer to an OH_AVMetadataExtractor instance. + * @param pixelMap The fetched album cover from the audio source. For details, see {@link OH_PixelmapNative}. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input extractor is nullptr or input param is invalid. + * {@link AV_ERR_OPERATE_NOT_PERMIT} if operation not allowed. + * {@link AV_ERR_UNSUPPORTED_FORMAT} if format is unsupported. + * {@link AV_ERR_NO_MEMORY} if internal memory allocation failed. + * @since 18 + */ +OH_AVErrCode OH_AVMetadataExtractor_FetchAlbumCover(OH_AVMetadataExtractor* extractor, OH_PixelmapNative** pixelMap); + +/** + * @brief Release the resource used for AVMetadataExtractor. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @param extractor Pointer to an OH_AVMetadataExtractor instance. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input extractor is nullptr or input param is invalid. + * @since 18 + */ +OH_AVErrCode OH_AVMetadataExtractor_Release(OH_AVMetadataExtractor* extractor); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_H +/** @} */ diff --git a/multimedia/player_framework/avmetadata_extractor/BUILD.gn b/multimedia/player_framework/avmetadata_extractor/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..346f6fd0da182c11bc3e63227e5cdc25d821cdbe --- /dev/null +++ b/multimedia/player_framework/avmetadata_extractor/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (C) 2025 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("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/player_framework/config.gni") + +ohos_ndk_headers("avmetadata_extractor_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" + sources = [ + "../avmetadata_extractor.h", + "../avmetadata_extractor_base.h", + ] +} + +ohos_ndk_library("libavmetadata_extractor") { + ndk_description_file = "./libavmetadata_extractor.ndk.json" + output_name = "avmetadata_extractor" + output_extension = "so" + + system_capability = "SystemCapability.Multimedia.Media.AVMetadataExtractor" + system_capability_headers = [ + "multimedia/player_framework/avmetadata_extractor.h", + "multimedia/player_framework/avmetadata_extractor_base.h", + ] +} diff --git a/multimedia/player_framework/avmetadata_extractor/libavmetadata_extractor.ndk.json b/multimedia/player_framework/avmetadata_extractor/libavmetadata_extractor.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..ef6a56170191c7e8f231529ad71b7ac37948f813 --- /dev/null +++ b/multimedia/player_framework/avmetadata_extractor/libavmetadata_extractor.ndk.json @@ -0,0 +1,22 @@ +[ + { + "first_introduced": "18", + "name": "OH_AVMetadataExtractor_Create" + }, + { + "first_introduced": "18", + "name": "OH_AVMetadataExtractor_SetFDSource" + }, + { + "first_introduced": "18", + "name": "OH_AVMetadataExtractor_FetchMetadata" + }, + { + "first_introduced": "18", + "name": "OH_AVMetadataExtractor_FetchAlbumCover" + }, + { + "first_introduced": "18", + "name": "OH_AVMetadataExtractor_Release" + } +] \ No newline at end of file diff --git a/multimedia/player_framework/avmetadata_extractor_base.h b/multimedia/player_framework/avmetadata_extractor_base.h new file mode 100644 index 0000000000000000000000000000000000000000..b0051eb8c45ecb4be0551faed5b02a7f937bc39a --- /dev/null +++ b/multimedia/player_framework/avmetadata_extractor_base.h @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2025 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 AVMetadataExtractor + * @{ + * + * @brief Provides APIs of metadata capability for Media Source. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ + +/** + * @file avmetadata_extractor_base.h + * + * @brief Defines the structure and enumeration for AVMetadataExtractor. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @kit MediaKit + * @library libavmetadata_extractor.so + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_BASE_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_BASE_H + +#include + +#include "native_avformat.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @brief Key to get the album title of the media source, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_ALBUM = "album"; + +/** + * @brief Key to get the album performer or artist associated, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_ALBUM_ARTIST = "albumArtist"; + +/** + * @brief Key to get the artist name, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_ARTIST = "artist"; + +/** + * @brief Key to get the author name, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_AUTHOR = "author"; + +/** + * @brief Key to get the created time of the media source, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_DATE_TIME = "dateTime"; + +/** + * @brief Key to get the created or modified time with the specific date format, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_DATE_TIME_FORMAT = "dateTimeFormat"; + +/** + * @brief Key to get the composer of the media source, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_COMPOSER = "composer"; + +/** + * @brief Key to get the playback duration of the media source, value type is int64_t, value unit is millisecond (ms). + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_DURATION = "duration"; + +/** + * @brief Key to get the content type or genre, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_GENRE = "genre"; + +/** + * @brief Key to get the value whether the media resource contains audio content, + * value type is int32_t. 1 means true and 0 means false. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_HAS_AUDIO = "hasAudio"; + +/** + * @brief Key to get the value whether the media resource contains video content, + * value type is int32_t. 1 means true and 0 means false. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_HAS_VIDEO = "hasVideo"; + +/** + * @brief Key to get the mime type of the media source, value type is const char*. + * Some example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb". + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_MIME_TYPE = "mimeType"; + +/** + * @brief Key to get the number of tracks, value type is int32_t. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_TRACK_COUNT = "trackCount"; + +/** + * @brief Key to get the audio sample rate, value type is int32_t. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_SAMPLE_RATE = "sampleRate"; + +/** + * @brief Key to get the media source title, value type is const char*. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_TITLE = "title"; + +/** + * @brief Key to get the video height if the media contains video, value type is int32_t. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_HEIGHT = "videoHeight"; + +/** + * @brief Key to get the video width if the media contains video, value type is int32_t. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_WIDTH = "videoWidth"; + +/** + * @brief Key to get the video rotation angle, value type is int32_t. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_ORIENTATION = "videoOrientation"; + +/** + * @brief Key to get the information whether the video is HDR video, value type is int32_t. + * For details of the value, see {@link OH_Core_HdrType} defined in {@link media_types.h}. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_VIDEO_IS_HDR_VIVID = "hdrType"; + +/** + * @brief Key to get the latitude value in the geographical location, value type is float. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_LOCATION_LATITUDE = "latitude"; + +/** + * @brief Key to get the longitude value in the geographical location, value type is float. + * + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 18 + */ +static const char* OH_AVMETADATA_EXTRACTOR_LOCATION_LONGITUDE = "longitude"; + +#ifdef __cplusplus +} +#endif +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVMETADATA_EXTRACTOR_BASE_H +/** @} */ diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index ce355909a31309cb78b5c0e77cb0e151691f7ede..f87d5b2bcdf5fe9cef44aaacaed63e0b5f3711f3 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -19,7 +19,7 @@ * * @brief Provides APIs of Playback capability for Media Source. * - * @Syscap SystemCapability.Multimedia.Media.AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ @@ -32,6 +32,7 @@ * * @kit MediaKit * @library libavplayer.so + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ @@ -591,8 +592,23 @@ OH_AVErrCode OH_AVPlayer_SetOnInfoCallback(OH_AVPlayer *player, OH_AVPlayerOnInf */ OH_AVErrCode OH_AVPlayer_SetOnErrorCallback(OH_AVPlayer *player, OH_AVPlayerOnErrorCallback callback, void *userData); +/** + * @brief Set volume mode of the player + * @param player Pointer to an OH_AVPlayer instance + * @param volumeMode The value {@link OH_AudioStream_VolumeMode} indicated volume mode of the player. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr or volumeMode value is invalid. + * {@link AV_ERR_INVALID_STATE} function called in invalid state, should before prepare state. + * {@link AV_ERR_SERVICE_DIED} media service died, system error. + * @since 18 + * @version 1.0 + */ +OH_AVErrCode OH_AVPlayer_SetVolumeMode(OH_AVPlayer *player, OH_AudioStream_VolumeMode volumeMode); + #ifdef __cplusplus } #endif #endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_H +/** @} */ \ No newline at end of file diff --git a/multimedia/player_framework/avplayer/libavplayer.ndk.json b/multimedia/player_framework/avplayer/libavplayer.ndk.json index d7151471ef8156446a5d99dfe765a02abccdaae0..46e0778184ebc222ffffbc377972e7cb16d51cd4 100644 --- a/multimedia/player_framework/avplayer/libavplayer.ndk.json +++ b/multimedia/player_framework/avplayer/libavplayer.ndk.json @@ -134,5 +134,9 @@ { "first_introduced": "12", "name": "OH_AVPlayer_SetAudioEffectMode" + }, + { + "first_introduced": "18", + "name": "OH_AudioStreamBuilder_SetVolumeMode" } ] \ No newline at end of file diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 8a3b311fcd047fbd7ea6b766b12105e1bfee383e..b351f5cdd3a9a58ed8184b4a4b9da3ab693b071e 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -19,7 +19,7 @@ * * @brief Provides APIs of Playback capability for Media Source. * - * @Syscap SystemCapability.Multimedia.Media.AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ @@ -31,6 +31,7 @@ * * @kit MediaKit * @library libavplayer.so + * @syscap SystemCapability.Multimedia.Media.AVPlayer * @since 11 * @version 1.0 */ @@ -426,3 +427,4 @@ typedef struct AVPlayerCallback { } #endif #endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVPLAYER_BASH_H +/** @} */ \ No newline at end of file diff --git a/multimedia/player_framework/avrecorder.h b/multimedia/player_framework/avrecorder.h new file mode 100644 index 0000000000000000000000000000000000000000..b94e92b97e0fa7ddef4d986de7a68a2605660124 --- /dev/null +++ b/multimedia/player_framework/avrecorder.h @@ -0,0 +1,236 @@ +/* + * 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 AVRecorder + * @{ + * + * @brief Provides APIs of request capability for Recorder. + * + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + * @} + */ + + /** + * @file avrecorder.h + * + * @brief Defines the avrecorder APIs. Uses the Native APIs provided by Media AVRecorder + * to record media data. + * + * @kit MediaKit + * @library libavrecorder.so + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H + +#include +#include +#include +#include "avrecorder_base.h" +#include "native_averrors.h" +#include "native_window/external_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create a recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @return Returns a pointer to an OH_AVRecorder instance for success, nullptr for failure + * @since 18 +*/ +OH_AVRecorder *OH_AVRecorder_Create(void); + +/** + * @brief Prepare for recording with some parameters. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param config Pointer to an OH_AVRecorder_Config instance, see {@link OH_AVRecorder_Config} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder Prepare failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Prepare(OH_AVRecorder *recorder, OH_AVRecorder_Config *config); + +/** + * @brief Get current recording parameters, it must be called after prepare. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param config Pointer to an OH_AVRecorder_Config instance, see {@link OH_AVRecorder_Config} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or config is null. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_GetAVRecorderConfig(OH_AVRecorder *recorder, OH_AVRecorder_Config **config); + +/** + * @brief Get input surface, it must be called between prepare completed and start. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param window Pointer to an OHNativeWindow instance, see {@link OHNativeWindow} + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_GetInputSurface(OH_AVRecorder *recorder, OHNativeWindow **window); + +/** + * @brief Update the video orientation before recorder start. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param rotation angle, should be [0, 90, 180, 270] + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or update rotation failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_UpdateRotation(OH_AVRecorder *recorder, int32_t rotation); + +/** + * @brief Start AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder start failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Start(OH_AVRecorder *recorder); + +/** + * @brief Pause AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder pause failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Pause(OH_AVRecorder *recorder); + +/** + * @brief Resume AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder resume failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Resume(OH_AVRecorder *recorder); + +/** + * @brief Stop AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder stop failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Stop(OH_AVRecorder *recorder); + +/** + * @brief Reset AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder reset failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Reset(OH_AVRecorder *recorder); + +/** + * @brief Release AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or recorder release failed. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_Release(OH_AVRecorder *recorder); + +/** + * @brief Get available encoder and encoder info for AVRecorder. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param info Pointer to an OH_AVRecorder_EncoderInfo instance, see {@link OH_AVRecorder_EncoderInfo} + * @param length Length of available encoders + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_GetAvailableEncoder(OH_AVRecorder *recorder, OH_AVRecorder_EncoderInfo **info, + int32_t *length); + +/** + * @brief Set the state callback function so that your application can respond to the + * state change events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback State callback function, see {@link OH_AVRecorder_OnStateChange} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_SetStateCallback( + OH_AVRecorder *recorder, OH_AVRecorder_OnStateChange callback, void *userData); + +/** + * @brief Set the error callback function so that your application can respond to the + * error events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback Error callback function, see {@link OH_AVRecorder_OnError} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_SetErrorCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnError callback, void *userData); + +/** + * @brief Set the URI callback function so that your application can respond to the + * URI events generated by the av recorder. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance + * @param callback Uri callback function, see {@link OH_AVRecorder_OnUri} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input recorder is nullptr or input callback is nullptr. + * @since 18 + */ +OH_AVErrCode OH_AVRecorder_SetUriCallback(OH_AVRecorder *recorder, OH_AVRecorder_OnUri callback, void *userData); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_H diff --git a/multimedia/player_framework/avrecorder/BUILD.gn b/multimedia/player_framework/avrecorder/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3ca4f1bcebc0108c81352a496406580830e5402d --- /dev/null +++ b/multimedia/player_framework/avrecorder/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("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +import("//foundation/multimedia/player_framework/config.gni") + +ohos_ndk_headers("avrecorder_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/player_framework" + sources = [ + "../avrecorder.h", + "../avrecorder_base.h", + ] +} + +ohos_ndk_library("libavrecorder") { + ndk_description_file = "./libavrecorder.ndk.json" + output_name = "avrecorder" + output_extension = "so" + system_capability = "SystemCapability.Multimedia.Media.AVRecorder" + system_capability_headers = [ + "multimedia/player_framework/avrecorder.h", + "multimedia/player_framework/avrecorder_base.h", + ] +} diff --git a/multimedia/player_framework/avrecorder/libavrecorder.ndk.json b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..29ca772eb3296ac465832e3328160b55d9e49c30 --- /dev/null +++ b/multimedia/player_framework/avrecorder/libavrecorder.ndk.json @@ -0,0 +1,62 @@ +[ + { + "first_introduced": "18", + "name": "OH_AVRecorder_Create" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Prepare" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_GetAVRecorderConfig" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_GetInputSurface" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_UpdateRotation" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Start" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Pause" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Resume" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Stop" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Reset" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_Release" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_GetAvailableEncoder" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_SetStateCallback" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_SetErrorCallback" + }, + { + "first_introduced": "18", + "name": "OH_AVRecorder_SetUriCallback" + } +] \ No newline at end of file diff --git a/multimedia/player_framework/avrecorder_base.h b/multimedia/player_framework/avrecorder_base.h new file mode 100644 index 0000000000000000000000000000000000000000..4e668f781f8be9860d2370a467251f8ded34dc1c --- /dev/null +++ b/multimedia/player_framework/avrecorder_base.h @@ -0,0 +1,346 @@ +/* + * 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 AVRecorder + * @{ + * + * @brief Provides APIs of request capability for Recorder. + * + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + * @} + */ + +/** + * @file avrecorder_base.h + * + * @brief Defines the structure and enumeration for Media AVRecorder. + * + * @kit MediaKit + * @library libavrecorder.so + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ + +#ifndef MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H +#define MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H + +#include +#include +#include "multimedia/media_library/media_asset_base_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialization of avrecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder OH_AVRecorder; + +/** + * @brief audio source type for recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_AudioSourceType { + /* Default audio source type. */ + AVRECORDER_DEFAULT = 0, + /* Source type mic. */ + AVRECORDER_MIC = 1, + /* Source type Voice recognition. */ + AVRECORDER_VOICE_RECOGNITION = 2, + /* Source type Voice communication. */ + AVRECORDER_VOICE_COMMUNICATION = 7, + /* Source type Voice message. */ + AVRECORDER_VOICE_MESSAGE = 10, + /* Source type Camcorder. */ + AVRECORDER_CAMCORDER = 13, +} OH_AVRecorder_AudioSourceType; + +/** + * @brief video source type for recorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_VideoSourceType { + /* Surface raw data. */ + AVRECORDER_SURFACE_YUV = 0, + /* Surface ES data. */ + AVRECORDER_SURFACE_ES = 1, +} OH_AVRecorder_VideoSourceType; + +/** + * @brief Enumerates Codec MIME types + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_CodecMimeType { + /* H.264 codec MIME type. */ + AVRECORDER_VIDEO_AVC = 2, + /* AAC codec MIME type. */ + AVRECORDER_AUDIO_AAC = 3, + /* mp3 codec MIME type. */ + AVRECORDER_AUDIO_MP3 = 4, + /* G711-mulaw codec MIME type. */ + AVRECORDER_AUDIO_G711MU = 5, + /* MPEG4 codec MIME type. */ + AVRECORDER_VIDEO_MPEG4 = 6, + /* H.265 codec MIME type. */ + AVRECORDER_VIDEO_HEVC = 8, + /* AMR-NB codec MIME type. */ + AVRECORDER_AUDIO_AMR_NB = 9, + /* AMR-WB codec MIME type. */ + AVRECORDER_AUDIO_AMR_WB = 10, +} OH_AVRecorder_CodecMimeType; + +/** + * @brief Enumerates container format type(The abbreviation for 'container format type' is CFT) + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_ContainerFormatType { + /* A video container format type mp4. */ + AVRECORDER_CFT_MPEG_4 = 2, + /* An audio container format type m4a. */ + AVRECORDER_CFT_MPEG_4A = 6, + /* An audio container format type amr. */ + AVRECORDER_CFT_AMR = 8, + /* An audio container format type mp3. */ + AVRECORDER_CFT_MP3 = 9, + /* An audio container format type wav. */ + AVRECORDER_CFT_WAV = 10, +} OH_AVRecorder_ContainerFormatType; + +/** + * @brief Recorder States + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_State { + /* idle states */ + AVRECORDER_IDLE = 0, + /* prepared states */ + AVRECORDER_PREPARED = 1, + /* started states */ + AVRECORDER_STARTED = 2, + /* paused states */ + AVRECORDER_PAUSED = 3, + /* stopped states */ + AVRECORDER_STOPPED = 4, + /* released states */ + AVRECORDER_RELEASED = 5, + /* error states */ + AVRECORDER_ERROR = 6, +} OH_AVRecorder_State; + +/** + * @brief reason of recorder state change + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_StateChangeReason { + /* State changed by user operation */ + AVRECORDER_USER = 0, + /* State changed by background action */ + AVRECORDER_BACKGROUND = 1, +} OH_AVRecorder_StateChangeReason; + +/** + * @brief mode of creating recorder file + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef enum OH_AVRecorder_FileGenerationMode { + /* Application Creation */ + AVRECORDER_APP_CREATE = 0, + /* System Creation. Valid only in camera scene */ + AVRECORDER_AUTO_CREATE_CAMERA_SCENE = 1, +} OH_AVRecorder_FileGenerationMode; + +/** + * @brief Provides the media recorder profile definitions + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_Profile { + /* Indicates the audio bitrate */ + int32_t audioBitrate; + /* Indicates the number of audio channels */ + int32_t audioChannels; + /* Indicates the audio encoding format */ + OH_AVRecorder_CodecMimeType audioCodec; + /* Indicates the audio sampling rate */ + int32_t audioSampleRate; + /* Indicates the output file format */ + OH_AVRecorder_ContainerFormatType fileFormat; + /* Indicates the video bitrate */ + int32_t videoBitrate; + /* Indicates the video encoding format */ + OH_AVRecorder_CodecMimeType videoCodec; + /* Indicates the video width */ + int32_t videoFrameWidth; + /* Indicates the video height */ + int32_t videoFrameHeight; + /* Indicates the video frame rate */ + int32_t videoFrameRate; + /* Whether to record HDR video */ + bool isHdr; + /* Whether to encode the video in temporal scale mode */ + bool enableTemporalScale; +} OH_AVRecorder_Profile; + +/** + * @brief Provides the geographical location definitions for media resources + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_Location { + /* Latitude */ + float latitude; + /* Longitude */ + float longitude; +} OH_AVRecorder_Location; + +/** + * @brief define the basic template of metadata + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_MetadataTemplate { + /* key value of the metadata */ + char *key; + /* contents of the metadata */ + char *value; +} OH_AVRecorder_MetadataTemplate; + +/** + * @brief Provides the container definition for media data + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_Metadata { + /* The metadata to retrieve the content type or genre of the data source */ + char *genre; + /* The metadata to retrieve the information about the video orientation */ + char *videoOrientation; + /* The geographical location info of the video */ + OH_AVRecorder_Location location; + /* Custom parameter key-value map read from moov.meta.list */ + OH_AVRecorder_MetadataTemplate customInfo; +} OH_AVRecorder_Metadata; + +/** + * @brief Provides the media recorder configuration definitions + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_Config { + /* Indicates the recording audio source type */ + OH_AVRecorder_AudioSourceType audioSourceType; + /* Indicates the recording video source type */ + OH_AVRecorder_VideoSourceType videoSourceType; + /* Contains the audio and video encoding profile settings */ + OH_AVRecorder_Profile profile; + /* Defines the file URL */ + char *url; + /* Specifies the file generation mode for recording output */ + OH_AVRecorder_FileGenerationMode fileGenerationMode; + /* Contains additional metadata for the recorded media */ + OH_AVRecorder_Metadata metadata; + /* Set the longest duration allowed for current recording */ + int32_t maxDuration; +} OH_AVRecorder_Config; + +/** + * @brief Provides Range with lower and upper limit + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_Range { + /* lower limit of the range */ + int32_t min; + /* upper limit of the range */ + int32_t max; +} OH_AVRecorder_Range; + +/** + * @brief Provides encoder info + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 18 + */ +typedef struct OH_AVRecorder_EncoderInfo { + /* encoder format MIME */ + OH_AVRecorder_CodecMimeType mimeType; + /* encoder type, audio or video */ + char *type; + /* audio or video encoder bitRate range */ + OH_AVRecorder_Range bitRate; + /* video encoder frame rate range */ + OH_AVRecorder_Range frameRate; + /* video encoder width range */ + OH_AVRecorder_Range width; + /* video encoder height range */ + OH_AVRecorder_Range height; + /* audio encoder channel range */ + OH_AVRecorder_Range channels; + /* audio encoder sample rate collection */ + int32_t *sampleRate; + /* length of sampleRate list */ + int32_t sampleRateLen; +} OH_AVRecorder_EncoderInfo; + +/** + * @brief Called when the state changed of current recording. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder The pointer to an OH_AVRecorder instance. + * @param state Indicates the recorder state. For details, see {@link OH_AVRecorder_State}. + * @param reason Reason for recorder state change. For details, see {@link OH_AVRecorder_StateChangeReason}. + * @param userData Pointer to user specific data. + * @since 18 + */ +typedef void (*OH_AVRecorder_OnStateChange)(OH_AVRecorder *recorder, + OH_AVRecorder_State state, OH_AVRecorder_StateChangeReason reason, void *userData); + +/** + * @brief Called when an error occurred during recording + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance. + * @param errorCode Error code. + * @param errorMsg Error message. + * @param userData Pointer to user specific data. + * @since 18 + */ +typedef void (*OH_AVRecorder_OnError)(OH_AVRecorder *recorder, int32_t errorCode, const char *errorMsg, + void *userData); + +/** + * @brief Called when current recording is finished in OH_AVRecorder_FileGenerationMode.AUTO_CREATE_CAMERA_SCENE + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @param recorder Pointer to an OH_AVRecorder instance. + * @param asset Pointer to an OH_MediaAsset instance. + * @param userData Pointer to user specific data. + * @since 18 + */ +typedef void (*OH_AVRecorder_OnUri)(OH_AVRecorder *recorder, OH_MediaAsset *asset, void *userData); + +#ifdef __cplusplus +} +#endif + +#endif // MULTIMEDIA_PLAYER_FRAMEWORK_NATIVE_AVRECORDER_BASE_H diff --git a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json index 1e53ae7d709c96066e430869fe0ca9439238991b..d175c78a730a8663fa828c1bc08125b1291ba346 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -98,5 +98,17 @@ { "first_introduced": "12", "name": "OH_AVScreenCapture_SkipPrivacyMode" + }, + { + "first_introduced": "14", + "name": "OH_AVScreenCapture_SetMaxVideoFrameRate" + }, + { + "first_introduced": "15", + "name": "OH_AVScreenCapture_ShowCursor" + }, + { + "first_introduced": "18", + "name": "OH_AVScreenCapture_SetDisplayCallback" } ] \ No newline at end of file diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index c260023c6dc873d65a298ab2b4bcd7874b9f2841..150ebef4f1755430aca165442f0d158ecef65138 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -374,8 +374,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent(struct OH_AVScreen * @brief Add Window content to the screen capture content filter * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param filter Pointer to an OH_AVScreenCapture_ContentFilter instance - * @param Pointer to windowIDs to be added - * @param windowCount to be added + * @param windowIDs Pointer to windowIDs to be added + * @param windowCount length of windowID list * @return Returns AV_SCREEN_CAPTURE_ERR_OK if the execution is successful, * otherwise returns a specific error code, refer to {@link OH_AVSCREEN_CAPTURE_ErrCode} * @since 12 @@ -404,8 +404,8 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas(struct OH_AVScreenCa * @brief skip some windows' privacy mode of current app during the screen recording * @syscap SystemCapability.Multimedia.Media.AVScreenCapture * @param capture Pointer to an OH_AVScreenCapture instance - * @param Pointer of windowID list - * @param length of windowID list + * @param windowIDs Pointer of windowID list + * @param windowCount length of windowID list * @return Function result code. * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr or input windowIDs are not belong current @@ -416,6 +416,53 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas(struct OH_AVScreenCa */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SkipPrivacyMode(struct OH_AVScreenCapture *capture, int32_t *windowIDs, int32_t windowCount); + +/** + * @brief set up the max number of video frame per second + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param frameRate max frame rate of video + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr or frameRate is not support. + * {@link AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT} opertation not be permitted. + * @since 14 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMaxVideoFrameRate(struct OH_AVScreenCapture *capture, + int32_t frameRate); + +/** + * @brief determines whether the cursor is visible in the session + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param showCursor The switch of the cursor + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr. + * {@link AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT} opertation not be permitted, show cursor failed. + * @since 15 + * @version 1.0 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor(struct OH_AVScreenCapture *capture, + bool showCursor); + +/** + * @brief Set the display device selection callback function so that your application can respond to the + * display device selected event generated by the av screen capture. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param callback display device selection callback function, see {@link OH_AVScreenCapture_OnDisplaySelected} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr or input callback is nullptr. + * {@link AV_SCREEN_CAPTURE_ERR_NO_MEMORY} no memory, mem allocate failed. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_STATE} This interface should be called before Start is called. + * @since 15 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnDisplaySelected callback, void *userData); #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index deed04f4c93cd0f0a2719db11cfc641399f65497..85b1280d10cdf856dadf3dc95455a06119f0a192 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -521,6 +521,17 @@ typedef void (*OH_AVScreenCapture_OnError)(OH_AVScreenCapture *capture, int32_t typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture, OH_AVBuffer *buffer, OH_AVScreenCaptureBufferType bufferType, int64_t timestamp, void *userData); +/** + * @brief When one of the display devices start being captured, the function pointer will be called + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param displayId Id of the display device that being captured + * @param userData Pointer to user specific data + * + * @since 15 + */ +typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture, uint64_t displayId, void *userData); + #ifdef __cplusplus } #endif diff --git a/multimedia/video_processing_engine/image_processing/libimage_processing.ndk.json b/multimedia/video_processing_engine/image_processing/libimage_processing.ndk.json index 13425858fa88f767255e51b7d47018a4f2ab6921..918e744ee31dd9e7ed26bfb6aa6c125780860029 100644 --- a/multimedia/video_processing_engine/image_processing/libimage_processing.ndk.json +++ b/multimedia/video_processing_engine/image_processing/libimage_processing.ndk.json @@ -83,5 +83,10 @@ "first_introduced": "13", "name": "IMAGE_PROCESSING_TYPE_DETAIL_ENHANCER", "type": "variable" + }, + { + "first_introduced": "13", + "name": "IMAGE_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL", + "type": "variable" } ] diff --git a/multimedia/video_processing_engine/video_processing/libvideo_processing.ndk.json b/multimedia/video_processing_engine/video_processing/libvideo_processing.ndk.json index dd2fe35ab8f4213a5d7bb16038f621ffa9c8f74c..19fc6e2cc0dfa42b931163299b783ed0a34a8248 100644 --- a/multimedia/video_processing_engine/video_processing/libvideo_processing.ndk.json +++ b/multimedia/video_processing_engine/video_processing/libvideo_processing.ndk.json @@ -89,5 +89,10 @@ "first_introduced": "12", "name": "VIDEO_PROCESSING_TYPE_DETAIL_ENHANCER", "type": "variable" + }, + { + "first_introduced": "12", + "name": "VIDEO_DETAIL_ENHANCER_PARAMETER_KEY_QUALITY_LEVEL", + "type": "variable" } ] diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 0a2b5b4716bf1c9112b3a18632b7cd3534269bf2..3934be3b9a6cb19b0627d706c5bd9dc89ee03dfb 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_INPUT_MANAGER_H -#define OH_INPUT_MANAGER_H - /** * @addtogroup input * @{ @@ -35,6 +32,9 @@ * @since 12 */ +#ifndef OH_INPUT_MANAGER_H +#define OH_INPUT_MANAGER_H + #include #include "oh_axis_type.h" @@ -231,7 +231,7 @@ typedef struct Input_AxisEvent Input_AxisEvent; /** * @brief Defines the hot key structure. * - * @since 13 + * @since 14 */ typedef struct Input_Hotkey Input_Hotkey; @@ -249,25 +249,32 @@ typedef enum Input_Result { INPUT_NOT_SYSTEM_APPLICATION = 202, /** @error Parameter check failed */ INPUT_PARAMETER_ERROR = 401, + /** @error Device not support */ + INPUT_DEVICE_NOT_SUPPORTED = 801, /** @error Service error */ INPUT_SERVICE_EXCEPTION = 3800001, /** @error Interceptor repeatedly created for an application */ INPUT_REPEAT_INTERCEPTOR = 4200001, /** * @error Already occupied by the system - * @since 13 + * @since 14 */ INPUT_OCCUPIED_BY_SYSTEM = 4200002, /** * @error Already occupied by the other - * @since 13 + * @since 14 */ INPUT_OCCUPIED_BY_OTHER = 4200003, + /** + * @error No keyboard device connected + * @since 15 + */ + INPUT_KEYBOARD_DEVICE_NOT_EXIST = 3900002 } Input_Result; /** * @brief Callback used to return shortcut key events. - * @since 13 + * @since 14 */ typedef void (*Input_HotkeyCallback)(Input_Hotkey* hotkey); @@ -538,6 +545,46 @@ void OH_Input_SetKeyEventActionTime(struct Input_KeyEvent* keyEvent, int64_t act */ int64_t OH_Input_GetKeyEventActionTime(const struct Input_KeyEvent* keyEvent); +/** + * @brief Sets the windowId for a key event. + * + * @param keyEvent Key event object. + * @param windowId The windowId for a key event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetKeyEventWindowId(struct Input_KeyEvent* keyEvent, int32_t windowId); + +/** + * @brief Obtains the windowId of a key event. + * + * @param keyEvent Key event object. + * @return windowId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +int32_t OH_Input_GetKeyEventWindowId(const struct Input_KeyEvent* keyEvent); + +/** + * @brief Sets the displayId for a key event. + * + * @param keyEvent Key event object. + * @param displayId The displayId for a key event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetKeyEventDisplayId(struct Input_KeyEvent* keyEvent, int32_t displayId); + +/** + * @brief Obtains the displayId of a key event. + * + * @param keyEvent Key event object. + * @return displayId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +int32_t OH_Input_GetKeyEventDisplayId(const struct Input_KeyEvent* keyEvent); + /** * @brief Inject mouse event. * @@ -674,7 +721,7 @@ int32_t OH_Input_GetMouseEventAxisType(const struct Input_MouseEvent* mouseEvent * @brief Sets the axis value for a mouse axis event. * * @param mouseEvent Mouse event object. - * @param axisType Axis value. A positive value means scrolling forward, + * @param axisValue Axis value. A positive value means scrolling forward, * and a negative number means scrolling backward. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 @@ -704,13 +751,53 @@ void OH_Input_SetMouseEventActionTime(struct Input_MouseEvent* mouseEvent, int64 /** * @brief Obtains the time when a mouse event occurs. * - * @param keyEvent Mouse event object. + * @param mouseEvent Mouse event object. * @return Returns the time when the mouse event occurs. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int64_t OH_Input_GetMouseEventActionTime(const struct Input_MouseEvent* mouseEvent); +/** + * @brief Sets the windowId for a mouse event. + * + * @param mouseEvent Mouse event object. + * @param windowId The windowId for a mouse event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetMouseEventWindowId(struct Input_MouseEvent* mouseEvent, int32_t windowId); + +/** + * @brief Obtains the windowId of a mouse event. + * + * @param mouseEvent Mouse event object. + * @return windowId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +int32_t OH_Input_GetMouseEventWindowId(const struct Input_MouseEvent* mouseEvent); + +/** + * @brief Sets the displayId for a mouse event. + * + * @param mouseEvent Mouse event object. + * @param displayId The displayId for a mouse event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_t displayId); + +/** + * @brief Obtains the displayId of a mouse event. + * + * @param mouseEvent Mouse event object. + * @return displayId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +int32_t OH_Input_GetMouseEventDisplayId(const struct Input_MouseEvent* mouseEvent); + /** * @brief Inject touch event. * @@ -825,7 +912,7 @@ int32_t OH_Input_GetTouchEventDisplayY(const struct Input_TouchEvent* touchEvent /** * @brief Sets the time when a touch event occurs. * - * @param keyEvent Touch event object. + * @param touchEvent Touch event object. * @param actionTime Time when the touch event occurs. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 @@ -835,13 +922,53 @@ void OH_Input_SetTouchEventActionTime(struct Input_TouchEvent* touchEvent, int64 /** * @brief Obtains the time when a touch event occurs. * - * @param keyEvent touch event object. + * @param touchEvent touch event object. * @return Returns the time when the touch event occurs. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int64_t OH_Input_GetTouchEventActionTime(const struct Input_TouchEvent* touchEvent); +/** + * @brief Sets the windowId for a touch event. + * + * @param touchEvent Touch event object. + * @param windowId The windowId for a touch event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetTouchEventWindowId(struct Input_TouchEvent* touchEvent, int32_t windowId); + +/** + * @brief Obtains the windowId of a touch event. + * + * @param touchEvent Touch event object. + * @return windowId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 +*/ +int32_t OH_Input_GetTouchEventWindowId(const struct Input_TouchEvent* touchEvent); + +/** + * @brief Sets the displayId for a touch event. + * + * @param touchEvent Touch event object. + * @param displayId The displayId for a touch event. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_t displayId); + +/** + * @brief Obtains the displayId of a touch event. + * + * @param touchEvent Touch event object. + * @return displayId. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 +*/ +int32_t OH_Input_GetTouchEventDisplayId(const struct Input_TouchEvent* touchEvent); + /** * @brief Cancels event injection and revokes authorization. * @@ -1050,7 +1177,7 @@ Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEv * @brief Obtains the axis event source type. * * @param axisEvent Axis event object. - * @param axisEventType Axis event source type. The values are defined in {@link InputEvent_SourceType}. + * @param sourceType Axis event source type. The values are defined in {@link InputEvent_SourceType}. * @return OH_Input_GetAxisEventSourceType function result code. * {@link INPUT_SUCCESS} Obtains the axis event source type success.\n * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL or the sourceType is NULL.\n @@ -1059,6 +1186,58 @@ Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEv */ Input_Result OH_Input_GetAxisEventSourceType(const Input_AxisEvent* axisEvent, InputEvent_SourceType* sourceType); +/** + * @brief Sets the windowId of an axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param windowId The windowId for the axis event. + * @return OH_Input_SetAxisEventDisplayY function result code. + * {@link INPUT_SUCCESS} Sets the Y coordinate of the axis event success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +Input_Result OH_Input_SetAxisEventWindowId(Input_AxisEvent* axisEvent, int32_t windowId); + +/** + * @brief Obtains the windowId of an axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param windowId The windowId for the axis event. + * @return OH_Input_GetAxisEventDisplayY function result code. + * {@link INPUT_SUCCESS} Obtains the Y coordinate of the axis event success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL or the displayY is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +Input_Result OH_Input_GetAxisEventWindowId(const Input_AxisEvent* axisEvent, int32_t* windowId); + +/** + * @brief Sets the displayId of an axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param displayId The displayId for the axis event. + * @return OH_Input_SetAxisEventDisplayY function result code. + * {@link INPUT_SUCCESS} Sets the Y coordinate of the axis event success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t displayId); + +/** + * @brief Obtains the displayId of an axis event. + * + * @param axisEvent Axis event object. For details, see {@Link Input_AxisEvent}. + * @param displayId The displayId for the axis event. + * @return OH_Input_GetAxisEventDisplayY function result code. + * {@link INPUT_SUCCESS} Obtains the Y coordinate of the axis event success.\n + * {@link INPUT_PARAMETER_ERROR} The axisEvent is NULL or the displayY is NULL.\n + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId); + /** * @brief Adds a listener of key events. * @@ -1285,7 +1464,7 @@ Input_Result OH_Input_RemoveInputEventInterceptor(void); * {@Link INPUT_SERVICE_EXCEPTION} Failed to get the interval because the service is exception.\n * {@Link INPUT_PARAMETER_ERROR} The timeInterval is NULL.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval); @@ -1295,7 +1474,7 @@ Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval); * @return Returns an {@Link Input_Hotkey} pointer object if the operation is successful. Otherwise, a null pointer is * returned. The possible cause is memory allocation failure. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Hotkey *OH_Input_CreateHotkey(void); @@ -1304,7 +1483,7 @@ Input_Hotkey *OH_Input_CreateHotkey(void); * * @param hotkey Hot key object. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ void OH_Input_DestroyHotkey(Input_Hotkey **hotkey); @@ -1315,7 +1494,7 @@ void OH_Input_DestroyHotkey(Input_Hotkey **hotkey); * @param preKeys List of modifier keys. * @param size Number of modifier keys. One or two modifier keys are supported. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size); @@ -1328,9 +1507,10 @@ void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size); * @return OH_Input_GetPreKeys status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n * {@link INPUT_PARAMETER_ERROR} The hotkey is NULL or the pressedKeys is NULL or the pressedKeyCount - * is NULL.\n + * is NULL;\n + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount); @@ -1340,7 +1520,7 @@ Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, * @param hotkey Hotkey key object. * @param finalKey Modified key. Only one modified key is supported. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ void OH_Input_SetFinalKey(Input_Hotkey *hotkey, int32_t finalKey); @@ -1351,9 +1531,10 @@ void OH_Input_SetFinalKey(Input_Hotkey *hotkey, int32_t finalKey); * @param finalKeyCode Returns the key value of the decorated key. * @return OH_Input_GetfinalKey status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n - * {@link INPUT_PARAMETER_ERROR} The hotkey is NULL or the finalKeyCode is NULL.\n + * {@link INPUT_PARAMETER_ERROR} The hotkey is NULL or the finalKeyCode is NULL;\n + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_GetFinalKey(const Input_Hotkey *hotkey, int32_t *finalKeyCode); @@ -1366,7 +1547,7 @@ Input_Result OH_Input_GetFinalKey(const Input_Hotkey *hotkey, int32_t *finalKeyC * operation fails, a null pointer is returned. The possible cause is memory allocation failure or count is not equal * to the number of system hotkeys. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count); @@ -1377,7 +1558,7 @@ Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count); * {@Link OH_Input_CreateAllSystemHotkeys} method. * @param count Count of the array to be destroyed, which must be the same as the number of system shortcut keys. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count); @@ -1390,9 +1571,10 @@ void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count); * @return OH_Input_GetAllSystemHotkeys status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n * {@link INPUT_PARAMETER_ERROR} The hotkey or count is NULL, or the value of count does not match the number - * of system shortcut keys supported by the system. + * of system shortcut keys supported by the system; + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count); @@ -1403,7 +1585,7 @@ Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count) * @param isRepeat Whether to report repeated key events. * The value true means to report repeated key events, and the value false means the opposite. * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat); @@ -1414,9 +1596,10 @@ void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat); * @param isRepeat Whether a key event is repeated. * @return OH_Input_GetIsRepeat status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n - * {@link INPUT_PARAMETER_ERROR} otherwise.\n + * {@link INPUT_PARAMETER_ERROR} otherwise;\n + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat); @@ -1428,11 +1611,12 @@ Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat); * @return OH_Input_AddHotkeyMonitor status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n * {@link INPUT_PARAMETER_ERROR} if hotkey or callback is NULL;\n + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported;\n * {@Link INPUT_OCCUPIED_BY_SYSTEM} The hotkey has been used by the system. You can call the {@Link * GetAllSystemHotkeys} interface to query all system shortcut keys.\n * {@Link INPUT_OCCUPIED_BY_OTHER} The hotkey has been subscribed to by another.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback); @@ -1444,8 +1628,9 @@ Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyC * @return OH_Input_RemoveHotkeyMonitor status code, specifically, * {@link INPUT_SUCCESS} if the operation is successful;\n * {@link INPUT_PARAMETER_ERROR} if hotkey or callback is NULL;\n + * {@Link INPUT_DEVICE_NOT_SUPPORTED} Capability not supported.\n * @syscap SystemCapability.MultimodalInput.Input.Core - * @since 13 + * @since 14 */ Input_Result OH_Input_RemoveHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback); @@ -1637,6 +1822,21 @@ Input_Result OH_Input_GetDeviceVendor(Input_DeviceInfo *deviceInfo, int32_t *ven * @since 13 */ Input_Result OH_Input_GetDeviceAddress(Input_DeviceInfo *deviceInfo, char **address); + +/** + * @brief Obtains the function key status. + * + * @param keyCode Function key value. Supported function keys include capsLock, NumLock, and ScrollLock. + * @param state Function key status. The value 0 indicates that the function key is disabled, + * and the value 1 indicates the opposite. + * @return OH_Input_GetFunctionKeyState function api result code + * {@link INPUT_SUCCESS} if the operation is successful; + * {@link INPUT_PARAMETER_ERROR} if keyCode is invalid or state is a null pointer. + * {@link INPUT_KEYBOARD_DEVICE_NOT_EXIST} no keyboard device connected. + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 15 + */ +Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state); #ifdef __cplusplus } #endif diff --git a/multimodalinput/kits/c/input/oh_key_code.h b/multimodalinput/kits/c/input/oh_key_code.h index 29233f3118db6cc72bfb5a5069a662917bff07fa..32b3b9bcfb6a773d9941da6256cf6c727101e41d 100644 --- a/multimodalinput/kits/c/input/oh_key_code.h +++ b/multimodalinput/kits/c/input/oh_key_code.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef OH_KEY_CODE_H -#define OH_KEY_CODE_H - /** * @addtogroup input * @{ @@ -35,6 +32,9 @@ * @since 12 */ +#ifndef OH_KEY_CODE_H +#define OH_KEY_CODE_H + #ifdef __cplusplus extern "C" { #endif diff --git a/multimodalinput/kits/c/ohinput.ndk.json b/multimodalinput/kits/c/ohinput.ndk.json index 0a906be7133067bf80f1d5789d8ace2272d313cd..ed19a127abf21626e7e1cb6a0c0ca3786106effa 100644 --- a/multimodalinput/kits/c/ohinput.ndk.json +++ b/multimodalinput/kits/c/ohinput.ndk.json @@ -316,59 +316,59 @@ "name": "OH_Input_RemoveInputEventInterceptor" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_GetIntervalSinceLastInput" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_CreateAllSystemHotkeys" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_DestroyAllSystemHotkeys" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_GetAllSystemHotkeys" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_CreateHotkey" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_DestroyHotkey" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_SetPreKeys" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_GetPreKeys" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_SetFinalKey" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_GetFinalKey" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_AddHotkeyMonitor" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_RemoveHotkeyMonitor" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_SetRepeat" }, { - "first_introduced": "13", + "first_introduced": "14", "name": "OH_Input_GetRepeat" }, { @@ -430,5 +430,73 @@ { "first_introduced": "13", "name": "OH_Input_UnregisterDeviceListeners" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetFunctionKeyState" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetKeyEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetKeyEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetKeyEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetKeyEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetMouseEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetMouseEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetMouseEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetMouseEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetTouchEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetTouchEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetTouchEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetTouchEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetAxisEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetAxisEventWindowId" + }, + { + "first_introduced": "15", + "name": "OH_Input_SetAxisEventDisplayId" + }, + { + "first_introduced": "15", + "name": "OH_Input_GetAxisEventDisplayId" } ] \ No newline at end of file diff --git a/ndk_targets.gni b/ndk_targets.gni new file mode 100644 index 0000000000000000000000000000000000000000..a8299154bc473e47fdcc44498c6804a8c0c321c8 --- /dev/null +++ b/ndk_targets.gni @@ -0,0 +1,337 @@ +# Copyright (c) 2021-2025 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("//build/ohos_var.gni") + +# ndk library, ndk header configuration +_ndk_library_targets = [ + "//interface/sdk_c/sensors/miscdevice/vibrator:lib_vibrator_ndk", + "//interface/sdk_c/sensors/miscdevice/vibrator:ndk_vibrator_header", + "//interface/sdk_c/third_party/zlib:libz_ndk", + "//interface/sdk_c/third_party/zlib:zlib_header", + "//interface/sdk_c/global/resource_management:librawfile_ndk", + "//interface/sdk_c/global/resource_management:rawfile_header", + "//interface/sdk_c/global/resource_management:native_resmgr_ndk", + "//interface/sdk_c/global/resource_management:native_resmgr_header", + "//interface/sdk_c/hiviewdfx/hiappevent:libhiappevent_header", + "//interface/sdk_c/hiviewdfx/hiappevent:libhiappevent_ndk", + "//interface/sdk_c/hiviewdfx/hidebug:libohhidebug", + "//interface/sdk_c/hiviewdfx/hidebug:oh_hidebug_header", + "//interface/sdk_c/hiviewdfx/hicollie:libohhicollie", + "//interface/sdk_c/hiviewdfx/hicollie:oh_hicollie_header", + "//interface/sdk_c/hiviewdfx/hilog:hilog_header", + "//interface/sdk_c/hiviewdfx/hilog:libhilog_ndk", + "//interface/sdk_c/hiviewdfx/hitrace:hitrace_header", + "//interface/sdk_c/hiviewdfx/hitrace:libhitrace_ndk", + "//interface/sdk_c/network/netstack/net_websocket:libnet_websocket", + "//interface/sdk_c/network/netstack/net_websocket:websocket_header", + "//interface/sdk_c/network/netssl:libnet_ssl_ndk", + "//interface/sdk_c/network/netssl:net_ssl_header", + "//interface/sdk_c/security/access_token:libability_access_control", + "//interface/sdk_c/security/access_token:accesstoken_header", + "//interface/sdk_c/security/huks:libhuks_ndk", + "//interface/sdk_c/security/huks:huks_header", + "//interface/sdk_c/security/asset:libasset_ndk", + "//interface/sdk_c/security/asset:asset_header", + "//interface/sdk_c/startup/init/syscap:libdeviceinfo_ndk", + "//interface/sdk_c/startup/init/syscap:deviceinfo_header", + "//interface/sdk_c/third_party/mindspore/kits:mindspore_header", + "//interface/sdk_c/third_party/mindspore/kits:mindspore_lib", + "//interface/sdk_c/web/webview/interfaces/native:web_header", + "//interface/sdk_c/web/webview/interfaces/native:libohweb", + "//interface/sdk_c/BasicServicesKit:libos_account_ndk", + "//interface/sdk_c/BasicServicesKit:os_account_ndk_header", + "//interface/sdk_c/ability/ability_runtime/child_process:child_process_header", + "//interface/sdk_c/ability/ability_runtime/child_process:libchild_process", + "//interface/sdk_c/AbilityKit/ability_runtime:ability_runtime_ndk_header", + "//interface/sdk_c/AbilityKit/ability_runtime:libability_runtime", + "//interface/sdk_c/AbilityKit/ability_base:ability_base_want_ndk_header", + "//interface/sdk_c/AbilityKit/ability_base:libability_base_want", + "//interface/sdk_c/arkui/ace_engine/native:ace_header", + "//interface/sdk_c/arkui/ace_engine/native:arkui_header", + "//interface/sdk_c/arkui/ace_engine/native:libace_ndk", + "//interface/sdk_c/arkui/napi:libnapi_ndk", + "//interface/sdk_c/arkui/napi:napi_header", + "//interface/sdk_c/arkui/window_manager:window_manager_header", + "//interface/sdk_c/arkui/window_manager:native_window_manager", + "//interface/sdk_c/arkui/display_manager:display_manager_header", + "//interface/sdk_c/arkui/display_manager:native_display_manager", + "//interface/sdk_c/ark_runtime/jsvm:libjsvm_ndk", + "//interface/sdk_c/ark_runtime/jsvm:jsvm_header", + "//interface/sdk_c/bundlemanager/bundle_framework/bundle:bundle_header", + "//interface/sdk_c/bundlemanager/bundle_framework/bundle:libbundle_ndk", + "//interface/sdk_c/third_party/node:node_header", + "//interface/sdk_c/graphic/graphic_2d/EGL:libEGL_ndk", + "//interface/sdk_c/graphic/graphic_2d/EGL:EGL_header", + "//interface/sdk_c/graphic/graphic_2d/GLES2:libGLESv2_ndk", + "//interface/sdk_c/graphic/graphic_2d/GLES2:GLES2_header", + "//interface/sdk_c/graphic/graphic_2d/GLES3:libGLESv3_ndk", + "//interface/sdk_c/graphic/graphic_2d/GLES3:GLES3_header", + "//interface/sdk_c/graphic/graphic_2d/KHR:KHR_header", + "//interface/sdk_c/graphic/graphic_2d/native_window:libnative_window_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_window:native_window_header", + "//interface/sdk_c/graphic/graphic_2d/native_buffer:libnative_buffer_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_buffer:native_buffer_header", + "//interface/sdk_c/graphic/graphic_2d/native_image:libnative_image_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_image:native_image_header", + "//interface/sdk_c/graphic/graphic_2d/native_vsync:libnative_vsync_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_vsync:native_vsync_header", + "//interface/sdk_c/graphic/graphic_2d/native_color_space_manager:libnative_color_space_manager_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_color_space_manager:native_color_space_manager_header", + "//interface/sdk_c/graphic/graphic_2d/native_drawing:libnative_drawing_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_drawing:native_drawing_header", + "//interface/sdk_c/graphic/graphic_2d/native_effect:libnative_effect_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_effect:native_effect_header", + "//interface/sdk_c/IPCKit:libipc_capi", + "//interface/sdk_c/IPCKit:ipc_capi_header", + "//interface/sdk_c/LocationKit:liblocation_ndk", + "//interface/sdk_c/LocationKit:location_ndk_header", + "//interface/sdk_c/NotificationKit:libnotification_ndk", + "//interface/sdk_c/NotificationKit:ohnotification_header", + "//interface/sdk_c/ConnectivityKit/bluetooth:libbluetooth_ndk", + "//interface/sdk_c/ConnectivityKit/bluetooth:bluetooth_ndk_header", + "//interface/sdk_c/third_party/libuv:libuv_ndk", + "//interface/sdk_c/third_party/libuv:libuv_header", + "//interface/sdk_c/third_party/libuv:libuv_uv_header", + "//interface/sdk_c/third_party/icu4c:libicu_ndk", + "//interface/sdk_c/third_party/icu4c:icu_unicode_header", + "//interface/sdk_c/multimedia/av_codec/audio_decoder:libnative_media_adec", + "//interface/sdk_c/multimedia/av_codec/audio_decoder:native_media_adec_header", + "//interface/sdk_c/multimedia/av_codec/audio_encoder:libnative_media_aenc", + "//interface/sdk_c/multimedia/av_codec/audio_encoder:native_media_aenc_header", + "//interface/sdk_c/multimedia/av_codec/audio_codec:libnative_media_acodec", + "//interface/sdk_c/multimedia/av_codec/audio_codec:native_media_acodec_header", + "//interface/sdk_c/multimedia/av_codec/video_decoder:libnative_media_vdec", + "//interface/sdk_c/multimedia/av_codec/video_decoder:native_media_vdec_header", + "//interface/sdk_c/multimedia/av_codec/video_encoder:libnative_media_venc", + "//interface/sdk_c/multimedia/av_codec/video_encoder:native_media_venc_header", + "//interface/sdk_c/multimedia/av_codec/codec_base:libnative_media_codecbase", + "//interface/sdk_c/multimedia/av_codec/codec_base:native_media_codecbase_header", + "//interface/sdk_c/multimedia/av_codec/avmuxer:libnative_media_avmuxer", + "//interface/sdk_c/multimedia/av_codec/avmuxer:native_media_avmuxer_header", + "//interface/sdk_c/multimedia/av_codec/avdemuxer:libnative_media_avdemuxer", + "//interface/sdk_c/multimedia/av_codec/avdemuxer:native_media_avdemuxer_header", + "//interface/sdk_c/multimedia/av_codec/avsource:libnative_media_avsource", + "//interface/sdk_c/multimedia/av_codec/avsource:native_media_avsource_header", + "//interface/sdk_c/multimedia/av_codec/avcencinfo:libnative_media_avcencinfo", + "//interface/sdk_c/multimedia/av_codec/avcencinfo:native_media_avcencinfo_header", + "//interface/sdk_c/multimedia/drm_framework:libnative_drm", + "//interface/sdk_c/multimedia/drm_framework:native_drm_header", + "//interface/sdk_c/multimedia/media_foundation/core:native_media_core_header", + "//interface/sdk_c/multimedia/media_foundation/core:native_media_core_common_header", + "//interface/sdk_c/multimedia/media_foundation/core:libnative_media_core", + "//interface/sdk_c/multimedia/media_library/media_asset_manager:libmedia_asset_manager", + "//interface/sdk_c/multimedia/media_library/media_asset_manager:media_asset_manager_header", + "//interface/sdk_c/multimedia/player_framework/avscreen_capture:libnative_avscreen_capture", + "//interface/sdk_c/multimedia/player_framework/avscreen_capture:native_avscreen_capture_header", + "//interface/sdk_c/multimedia/player_framework/avplayer:libavplayer", + "//interface/sdk_c/multimedia/player_framework/avplayer:avplayer_header", + "//interface/sdk_c/multimedia/player_framework/avrecorder:libavrecorder", + "//interface/sdk_c/multimedia/player_framework/avrecorder:avrecorder_header", + "//interface/sdk_c/multimedia/player_framework/avmetadata_extractor:libavmetadata_extractor", + "//interface/sdk_c/multimedia/player_framework/avmetadata_extractor:avmetadata_extractor_header", + "//interface/sdk_c/multimedia/player_framework/avimage_generator:libavimage_generator", + "//interface/sdk_c/multimedia/player_framework/avimage_generator:avimage_generator_header", + "//interface/sdk_c/multimedia/audio_framework:libohaudio_ndk", + "//interface/sdk_c/multimedia/audio_framework:ohaudio_header", + "//interface/sdk_c/multimedia/av_session:libohavsession_ndk", + "//interface/sdk_c/multimedia/av_session:ohavsession_header", + "//interface/sdk_c/multimedia/camera_framework:libohcamera", + "//interface/sdk_c/multimedia/camera_framework:camera_ndk_header", + "//interface/sdk_c/multimedia/image_framework:libpixelmap_ndk", + "//interface/sdk_c/multimedia/image_framework:libpixelmap", + "//interface/sdk_c/multimedia/image_framework:libpixelmap_header", + "//interface/sdk_c/multimedia/image_framework:image_header", + "//interface/sdk_c/multimedia/image_framework:libimage_ndk", + "//interface/sdk_c/multimedia/image_framework:image_ndk_header", + "//interface/sdk_c/multimedia/image_framework:libimage_receiver_ndk", + "//interface/sdk_c/multimedia/image_framework:image_receiver_ndk_header", + "//interface/sdk_c/multimedia/image_framework:libimage_source_ndk", + "//interface/sdk_c/multimedia/image_framework:image_source_ndk_header", + "//interface/sdk_c/multimedia/image_framework:libimage_source", + "//interface/sdk_c/multimedia/image_framework:libimage_source_header", + "//interface/sdk_c/multimedia/image_framework:libimage_packer_ndk", + "//interface/sdk_c/multimedia/image_framework:image_packer_ndk_header", + "//interface/sdk_c/multimedia/image_framework:libimage_packer", + "//interface/sdk_c/multimedia/image_framework:libimage_packer_header", + "//interface/sdk_c/multimedia/image_framework:libpicture", + "//interface/sdk_c/multimedia/image_framework:libpicture_header", + "//interface/sdk_c/multimedia/image_framework:libimage_common", + "//interface/sdk_c/multimedia/image_framework:libimage_common_header", + "//interface/sdk_c/multimedia/image_effect:libimage_effect", + "//interface/sdk_c/multimedia/image_effect:libimage_effect_header", + "//interface/sdk_c/multimedia/video_processing_engine/video_processing:libvideo_processing_ndk", + "//interface/sdk_c/multimedia/video_processing_engine/video_processing:video_processing_ndk_headers", + "//interface/sdk_c/multimedia/video_processing_engine/image_processing:libimage_processing_ndk", + "//interface/sdk_c/multimedia/video_processing_engine/image_processing:image_processing_ndk_headers", + "//interface/sdk_c/third_party/openSLES:sles_header", + "//interface/sdk_c/third_party/openSLES:libOpenSLES_ndk", + "//interface/sdk_c/ai/neural_network_runtime:libneural_network_core_ndk", + "//interface/sdk_c/ai/neural_network_runtime:libneural_network_runtime_ndk", + "//interface/sdk_c/ai/neural_network_runtime:libneural_network_runtime_header", + "//interface/sdk_c/commonlibrary/memory_utils/libpurgeablemem:libpurgeable_memory_ndk", + "//interface/sdk_c/commonlibrary/memory_utils/libpurgeablemem:purgeable_memory_header", + "//interface/sdk_c/distributeddatamgr/relational_store:data_ndk_header", + "//interface/sdk_c/distributeddatamgr/relational_store:native_rdb_ndk_header", + "//interface/sdk_c/distributeddatamgr/relational_store:libnative_rdb_ndk", + "//interface/sdk_c/distributeddatamgr/udmf:libudmf", + "//interface/sdk_c/distributeddatamgr/udmf:udmf_ndk_header", + "//interface/sdk_c/distributeddatamgr/pasteboard:libpasteboard", + "//interface/sdk_c/distributeddatamgr/pasteboard:pasteboard_ndk_header", + "//interface/sdk_c/distributeddatamgr/preferences:preferences_ndk_header", + "//interface/sdk_c/distributeddatamgr/preferences:libohpreferences", + "//interface/sdk_c/drivers/external_device_manager/usb:libusb_ndk", + "//interface/sdk_c/drivers/external_device_manager/usb:usb_header", + "//interface/sdk_c/drivers/external_device_manager/usb_serial:libusb_serial", + "//interface/sdk_c/drivers/external_device_manager/usb_serial:usb_serial_header", + "//interface/sdk_c/drivers/external_device_manager/scsi_peripheral:libscsi", + "//interface/sdk_c/drivers/external_device_manager/scsi_peripheral:scsi_header", + "//interface/sdk_c/drivers/external_device_manager/hid:libhid", + "//interface/sdk_c/drivers/external_device_manager/hid:hid_header", + "//interface/sdk_c/drivers/external_device_manager/base:libddk_base", + "//interface/sdk_c/drivers/external_device_manager/base:ddk_header", + "//interface/sdk_c/graphic/graphic_2d/vulkan:libvulkan_ndk", + "//interface/sdk_c/graphic/graphic_2d/vulkan:vulkan_header", + "//interface/sdk_c/graphic/graphic_2d/vulkan:vulkan_header_vk_video", + "//interface/sdk_c/resourceschedule/ffrt:libffrt_ndk", + "//interface/sdk_c/resourceschedule/ffrt:ffrt_header", + "//interface/sdk_c/network/netmanager:libnet_connection", + "//interface/sdk_c/network/netmanager:netconn_header", + "//interface/sdk_c/sensors/sensor:libsensor_ndk", + "//interface/sdk_c/sensors/sensor:sensor_ndk_header", + "//interface/sdk_c/resourceschedule/qos_manager:libqos_ndk", + "//interface/sdk_c/resourceschedule/qos_manager:qos_header", + "//interface/sdk_c/resourceschedule/background_process_manager:libbackground_process_manager_ndk", + "//interface/sdk_c/resourceschedule/background_process_manager:background_process_manager_header", + "//interface/sdk_c/filemanagement/fileio:libohfileio", + "//interface/sdk_c/filemanagement/fileio:oh_fileio_header", + "//interface/sdk_c/filemanagement/environment:libohenvironment", + "//interface/sdk_c/filemanagement/environment:oh_environment_header", + "//interface/sdk_c/filemanagement/file_uri:libohfileuri", + "//interface/sdk_c/filemanagement/file_uri:oh_file_uri_header", + "//interface/sdk_c/filemanagement/fileshare:libohfileshare", + "//interface/sdk_c/filemanagement/fileshare:oh_file_share_header", + "//interface/sdk_c/multimodalinput/kits/c:libohinput_ndk", + "//interface/sdk_c/multimodalinput/kits/c:ohinput_header", + "//interface/sdk_c/BasicServicesKit:libohprint_ndk", + "//interface/sdk_c/BasicServicesKit:ohprint_header", + "//interface/sdk_c/multimedia/image_framework:libohimage", + "//interface/sdk_c/multimedia/image_framework:ohimage_header", + "//interface/sdk_c/multimedia/image_framework:libimage_receiver", + "//interface/sdk_c/multimedia/image_framework:image_receiver_header", + "//interface/sdk_c/graphic/graphic_2d/native_display_soloist:libnative_display_soloist_ndk", + "//interface/sdk_c/graphic/graphic_2d/native_display_soloist:native_display_soloist_header", + "//interface/sdk_c/third_party/musl/ndk_script:copy_compatible_config", + "//interface/sdk_c/CryptoArchitectureKit:libohcrypto", + "//interface/sdk_c/CryptoArchitectureKit:crypto_capi_header", + "//interface/sdk_c/BasicServicesKit:libohscan_ndk", + "//interface/sdk_c/BasicServicesKit:ohscan_header", + "//interface/sdk_c/BasicServicesKit:libtime_service_ndk", + "//interface/sdk_c/BasicServicesKit:time_service_ndk_header", + "//interface/sdk_c/BasicServicesKit:libcommonevent_ndk", + "//interface/sdk_c/BasicServicesKit:ohcommonevent_header", + "//interface/sdk_c/DataProtectionKit:libohdlp_permission", + "//interface/sdk_c/DataProtectionKit:dlppermission_capi_header", + "//interface/sdk_c/inputmethod:libohinputmethod", + "//interface/sdk_c/inputmethod:libohinputmethod_header", + "//interface/sdk_c/backgroundtasks/transient:libtransient_task_ndk", + "//interface/sdk_c/backgroundtasks/transient:transient_task_header", + "//interface/sdk_c/BasicServicesKit:ohbattery_info_header", + "//interface/sdk_c/BasicServicesKit:libohbattery_info_ndk", + "//interface/sdk_c/telephony/cellular_data:libtelephony_data", + "//interface/sdk_c/telephony/cellular_data:telephony_data_header", + "//interface/sdk_c/telephony/core_service:libtelephony_radio", + "//interface/sdk_c/telephony/core_service:telephony_radio_header", + "//interface/sdk_c/ConnectivityKit/wifi:libwifi_ndk", + "//interface/sdk_c/ConnectivityKit/wifi:wifi_ndk_header", +] + +_ndk_base_libs = [ + "//interface/sdk_c/third_party/musl/ndk_script/adapter:libc_ndk", + "//interface/sdk_c/third_party/musl/ndk_script:musl_ndk_libs_arm32", + "//interface/sdk_c/third_party/musl/ndk_script:musl_ndk_libs_aarch64", + "//interface/sdk_c/third_party/musl/ndk_script:musl_ndk_libs_x86_64", + "//interface/sdk_c/third_party/musl/ndk_script:ndk_toolchain", +] +_ndk_sysroot_uapi = + [ "//interface/sdk_c/third_party/musl/ndk_script:musl_sysroot" ] + +_ndk_cmake = [ "//build/ohos/ndk:ndk_cmake_files" ] + +if (host_os == "mac") { + _ndk_cmake += [ + "//prebuilts/cmake/darwin-universal:darwin_cmake_copy", + "//build/ohos/ndk:copy_darwin_ohos_cmake", + ] +} else { + _ndk_cmake += [ + "//prebuilts/cmake/linux-x86:linux_cmake_copy", + "//prebuilts/cmake/windows-x86:windows_cmake_copy", + "//prebuilts/cmake/ohos:ohos_cmake_copy", + "//build/ohos/ndk:copy_linux_ohos_cmake", + "//build/ohos/ndk:copy_windows_ohos_cmake", + "//build/ohos/ndk:copy_ohos_ohos_cmake", + ] +} + +_ndk_ninja = [] +if (host_os == "mac") { + _ndk_ninja += [ "//prebuilts/build-tools/darwin-x86/bin:darwin_ninja_copy" ] +} else { + _ndk_ninja += [ + "//prebuilts/build-tools/linux-x86/bin:linux_ninja_copy", + "//prebuilts/build-tools/windows-x86/bin:windows_ninja_copy", + "//prebuilts/build-tools/ohos/bin:ohos_ninja_copy", + ] +} + +all_ndk_targets_list = _ndk_library_targets + _ndk_base_libs + + _ndk_sysroot_uapi + _ndk_cmake + _ndk_ninja + +if (build_windows_ndk_target) { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:windows_x86_64" ] +} +if (build_mac_ndk_target) { + if (host_cpu == "arm64") { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:darwin_arm64" ] + } else { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:darwin_x86_64" ] + } +} +if (build_linux_ndk_target) { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:linux_x86_64" ] +} +if (build_ohos_ndk_target) { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:ohos_arm64" ] +} else if (ndk_platform == "default") { + if (host_os == "mac") { + if (host_cpu == "arm64") { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:darwin_arm64" ] + } else { + all_ndk_targets_list += + [ "//interface/sdk_c/third_party/musl/ndk_script:darwin_x86_64" ] + } + } else { + all_ndk_targets_list += [ + "//interface/sdk_c/third_party/musl/ndk_script:windows_x86_64", + "//interface/sdk_c/third_party/musl/ndk_script:linux_x86_64", + "//interface/sdk_c/third_party/musl/ndk_script:ohos_arm64", + ] + } +} diff --git a/network/netmanager/include/net_connection.h b/network/netmanager/include/net_connection.h index 76d12d40616de36d6fff164f9651640c5c8b3e10..1cd795d0568fa1e3baf0a249651b974108324c83 100644 --- a/network/netmanager/include/net_connection.h +++ b/network/netmanager/include/net_connection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_NET_CONN_API_H -#define NATIVE_NET_CONN_API_H - /** * @addtogroup NetConnection * @{ @@ -38,6 +35,9 @@ * @version 1.0 */ +#ifndef NATIVE_NET_CONN_API_H +#define NATIVE_NET_CONN_API_H + #include #include "net_connection_type.h" @@ -186,6 +186,8 @@ int32_t OH_NetConn_GetAllNets(NetConn_NetHandleList *netHandleList); * 2100003 - Internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core + * @deprecated since 13 + * @useinstead OH_NetConn_RegisterDnsResolver * @since 11 * @version 1.0 */ @@ -199,11 +201,41 @@ int32_t OHOS_NetConn_RegisterDnsResolver(OH_NetConn_CustomDnsResolver resolver); * 2100003 - Internal error. * @permission ohos.permission.INTERNET * @syscap SystemCapability.Communication.NetManager.Core + * @deprecated since 13 + * @useinstead OH_NetConn_UnregisterDnsResolver * @since 11 * @version 1.0 */ int32_t OHOS_NetConn_UnregisterDnsResolver(void); +/** + * @brief Registers a custom DNS resolver. + * + * @param resolver Pointer to the custom DNS resolver. + * @return Returns the result code. + * {@link NETMANAGER_EXT_SUCCESS} if the operation is successful. + * {@link NETMANAGER_ERR_PERMISSION_DENIED} Missing permissions, add permission. + * {@link NETMANAGER_ERR_PARAMETER_ERROR} Parameter error. Please enter a correct parameter. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 13 + * @version 1.0 + */ +int32_t OH_NetConn_RegisterDnsResolver(OH_NetConn_CustomDnsResolver resolver); + +/** + * @brief Unregisters a custom DNS resolver. + * + * @return 0 - Success. 201 - Missing permissions. + * 401 - Parameter error. 2100002 - Unable to connect to service. + * 2100003 - Internal error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.Communication.NetManager.Core + * @since 13 + * @version 1.0 + */ +int32_t OH_NetConn_UnregisterDnsResolver(void); + /** * @brief Binds a socket to the specific network. * @@ -312,6 +344,33 @@ int32_t OH_NetConn_RegisterDefaultNetConnCallback(NetConn_NetConnCallback *netCo */ int32_t OH_NetConn_UnregisterNetConnCallback(uint32_t callBackId); +/** + * @brief Sets the URL of the current PAC script. + * + * @param pacUrl the URL of the current PAC script. + * @return the result defines in {@link NetConn_ErrorCode}. + * {@link NETCONN_SUCCESS} Success. + * {@link NETCONN_PERMISSION_DENIED} Permission denied. + * {@link NETCONN_PARAMETER_ERROR} Parameter check failed. + * {@link NETCONN_OPERATION_FAILED} Failed to connect to the service. + * {@link NETCONN_INTERNAL_ERROR} System internal error. + * @permission ohos.permission.SET_PAC_URL + * @since 15 + */ +NetConn_ErrorCode OH_NetConn_SetPacUrl(const char *pacUrl); + +/** + * @brief Obtains the URL of the current PAC script. + * + * @param pacUrl the URL of the current PAC script. + * @return the result defines in {@link NetConn_ErrorCode}. + * {@link NETCONN_SUCCESS} Success. + * {@link NETCONN_PARAMETER_ERROR} Parameter check failed. + * {@link NETCONN_OPERATION_FAILED} Failed to connect to the service. + * {@link NETCONN_INTERNAL_ERROR} System internal error. + * @since 15 + */ +NetConn_ErrorCode OH_NetConn_GetPacUrl(char *pacUrl); #ifdef __cplusplus } #endif diff --git a/network/netmanager/include/net_connection_type.h b/network/netmanager/include/net_connection_type.h index e52b40d062458178e51c987b2daf3e4c66cb7381..664656fd5a7410eca228c7c32ae8108ff43b41b8 100644 --- a/network/netmanager/include/net_connection_type.h +++ b/network/netmanager/include/net_connection_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_NET_CONN_TYPE_H -#define NATIVE_NET_CONN_TYPE_H - /** * @addtogroup NetConnection * @{ @@ -38,6 +35,10 @@ * */ +#ifndef NATIVE_NET_CONN_TYPE_H +#define NATIVE_NET_CONN_TYPE_H + +#include #include #include @@ -107,6 +108,28 @@ typedef enum NetConn_NetBearerType { NETCONN_BEARER_VPN = 4, } NetConn_NetBearerType; +/** + * @brief Enumerates NetConn error codes. + * + * @since 15 + */ +typedef enum NetConn_ErrorCode { + /** @error Success return code on success*/ + NETCONN_SUCCESS = 0, + /** @error Permission verification failed */ + NETCONN_PERMISSION_DENIED = 201, + /** @error Parameter check failed */ + NETCONN_PARAMETER_ERROR = 401, + /** @error Failed to connect to the service */ + NETCONN_OPERATION_FAILED = 2100002, + /** + * @error System internal error. + * 1. Memory-related error, for example, insufficient memory or memory data copy failures. + * 2. Null pointer error, for example, using memory that has already been released. + */ + NETCONN_INTERNAL_ERROR = 2100003 +} NetConn_ErrorCode; + /** * @brief Defines the network handle. * diff --git a/network/netmanager/libnet_connection.ndk.json b/network/netmanager/libnet_connection.ndk.json index 792eff18ed13c4be4641d798da6a60e14a7d1e1f..56325004e9c7e6378d22ad0f7fb94f20b2d53ad6 100644 --- a/network/netmanager/libnet_connection.ndk.json +++ b/network/netmanager/libnet_connection.ndk.json @@ -70,5 +70,21 @@ { "first_introduced": "12", "name": "OH_NetConn_UnregisterNetConnCallback" + }, + { + "first_introduced": "13", + "name": "OH_NetConn_RegisterDnsResolver" + }, + { + "first_introduced": "13", + "name": "OH_NetConn_UnregisterDnsResolver" + }, + { + "first_introduced": "15", + "name": "OH_NetConn_SetPacUrl" + }, + { + "first_introduced": "15", + "name": "OH_NetConn_GetPacUrl" } ] \ No newline at end of file diff --git a/network/netssl/include/net_ssl_c.h b/network/netssl/include/net_ssl_c.h index 779ccab79a6402acf5377a9a29ce5ec2715b6b5e..15d86407af31f76d38115ec32d6e9ed0a26a0aa6 100644 --- a/network/netssl/include/net_ssl_c.h +++ b/network/netssl/include/net_ssl_c.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NET_SSL_C_H -#define NET_SSL_C_H - /** * @addtogroup netstack * @{ @@ -38,6 +35,9 @@ * @version 1.0 */ +#ifndef NET_SSL_C_H +#define NET_SSL_C_H + #include "net_ssl_c_type.h" #ifdef __cplusplus @@ -109,8 +109,37 @@ int32_t OH_NetStack_GetCertificatesForHostName(const char *hostname, NetStack_Ce */ void OH_Netstack_DestroyCertificatesContent(NetStack_Certificates *certs); +/** + * @brief Checks whether the Cleartext traffic is permitted. + * + * @permission ohos.permission.INTERNET + * @return 0 - Success. + * 201 - Permission denied. + * 401 - Parameter error. + * @param isCleartextPermitted Indicates output parameter, + * {@code true} if the Cleartext traffic is permitted, {@code false} otherwise. + * @since 18 + */ +int32_t OH_Netstack_IsCleartextPermitted(bool *isCleartextPermitted); + + +/** + * @brief Checks whether the Cleartext traffic for a specified hostname is permitted. + * + * @permission ohos.permission.INTERNET + * @return 0 - Success. + * 201 - Permission denied. + * 401 - Parameter error. + * @param hostname Indicates the host name. + * @param isCleartextPermitted Indicates output parameter, + * {@code true} if the Cleartext traffic for a specified hostname is permitted, {@code false} otherwise. + * @since 18 + */ +int32_t OH_Netstack_IsCleartextPermittedByHostName(const char *hostname, bool *isCleartextPermitted); + #ifdef __cplusplus } #endif +/** @} */ #endif // NET_SSL_C_H diff --git a/network/netssl/include/net_ssl_c_type.h b/network/netssl/include/net_ssl_c_type.h index c7096a558ae3f101144d730b530a7975b4cf89d6..cea7eba7ea2ee032c38c0c80476ae02e941d7534 100644 --- a/network/netssl/include/net_ssl_c_type.h +++ b/network/netssl/include/net_ssl_c_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NET_SSL_C_TYPE_H -#define NET_SSL_C_TYPE_H - /** * @addtogroup netstack * @{ @@ -37,8 +34,15 @@ * @version 1.0 */ +#ifndef NET_SSL_C_TYPE_H +#define NET_SSL_C_TYPE_H + #include +#ifdef __cplusplus #include +#else +#include +#endif #ifdef __cplusplus extern "C" { @@ -130,4 +134,5 @@ typedef struct NetStack_Certificates { } #endif +/** @} */ #endif // NET_SSL_C_TYPE_H diff --git a/network/netssl/libnet_ssl_c.json b/network/netssl/libnet_ssl_c.json index af49f5a35b1957fe244000d6d3ff788a4befdeff..4336fd70a34482a4ad1d7740f228abca28576ae3 100644 --- a/network/netssl/libnet_ssl_c.json +++ b/network/netssl/libnet_ssl_c.json @@ -14,5 +14,13 @@ { "first_introduced":"12", "name": "OH_Netstack_DestroyCertificatesContent" + }, + { + "first_introduced":"18", + "name": "OH_Netstack_IsCleartextPermitted" + }, + { + "first_introduced":"18", + "name": "OH_Netstack_IsCleartextPermittedByHostName" } ] diff --git a/network/netstack/net_websocket/net_websocket.h b/network/netstack/net_websocket/net_websocket.h index d83f96f7389a4c8228d308b5fe49269bf1f46c8b..5381cb8acc05e2d3c3c5661ec460ef80e8775c54 100755 --- a/network/netstack/net_websocket/net_websocket.h +++ b/network/netstack/net_websocket/net_websocket.h @@ -13,13 +13,6 @@ * limitations under the License. */ -#ifndef NET_WEBSOCKET_H -#define NET_WEBSOCKET_H - -#include -#include -#include - /** * @addtogroup netstack * @{ @@ -42,6 +35,13 @@ * @version 1.0 */ +#ifndef NET_WEBSOCKET_H +#define NET_WEBSOCKET_H + +#include +#include +#include + #include "net_websocket_type.h" #ifdef __cplusplus @@ -51,10 +51,11 @@ extern "C" { /** * @brief Constructor of websocket. * + * @param onOpen Callback function invoked when a connection setup message is received. * @param onMessage Callback function invoked when a message is received. - * @param onClose Callback function invoked when a connection closing message is closed. * @param onError Callback function invoked when a connection error message is received. - * @param onOpen Callback function invoked when a connection setup message is received. + * @param onclose Callback function invoked when a connection closing message is closed. + * * @return Pointer to the websocket client if success; NULL otherwise. * @syscap SystemCapability.Communication.NetStack * @since 11 @@ -107,7 +108,6 @@ int OH_WebSocketClient_Send(struct WebSocket *client, char *data, size_t length) * @brief Closes a webSocket connection. * * @param client Pointer to the websocket client. - * @param url URL for the client to connect to the server. * @param options Optional parameters. * @return 0 if success; non-0 otherwise. For details about error codes, see {@link OH_Websocket_ErrCode}. * @permission ohos.permission.INTERNET @@ -133,4 +133,5 @@ int OH_WebSocketClient_Destroy(struct WebSocket *client); } #endif +/** @} */ #endif // NET_WEBSOCKET_H diff --git a/network/netstack/net_websocket/net_websocket_type.h b/network/netstack/net_websocket/net_websocket_type.h index c22e5ce130a0c661732091b20259bd4ce0d56810..c5f6f7b055067b8995d8e64c2e2192b1dd1eff2f 100755 --- a/network/netstack/net_websocket/net_websocket_type.h +++ b/network/netstack/net_websocket/net_websocket_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NET_WEBSOCKET_TYPE_H -#define NET_WEBSOCKET_TYPE_H - /** * @addtogroup netstack * @{ @@ -37,6 +34,9 @@ * @version 1.0 */ +#ifndef NET_WEBSOCKET_TYPE_H +#define NET_WEBSOCKET_TYPE_H + #ifdef __cplusplus extern "C" { #endif @@ -280,4 +280,5 @@ typedef enum WebSocket_ErrCode { } #endif +/** @} */ #endif // NET_WEBSOCKET_TYPE_H \ No newline at end of file diff --git a/resourceschedule/background_process_manager/BUILD.gn b/resourceschedule/background_process_manager/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e074dddca20d28bdbeebfecbd3df99c5d7910021 --- /dev/null +++ b/resourceschedule/background_process_manager/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2025 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("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") + +ohos_ndk_headers("background_process_manager_header") { + dest_dir = "$ndk_headers_out_dir/background_process_manager" + sources = [ "include/background_process_manager.h" ] +} + +ohos_ndk_library("libbackground_process_manager_ndk") { + output_name = "background_process_manager" + ndk_description_file = "./background_process_manager.ndk.json" + system_capability = + "SystemCapability.Resourceschedule.BackgroundProcessManager" + system_capability_headers = + [ "background_process_manager/background_process_manager.h" ] +} diff --git a/resourceschedule/background_process_manager/background_process_manager.ndk.json b/resourceschedule/background_process_manager/background_process_manager.ndk.json new file mode 100644 index 0000000000000000000000000000000000000000..022e9497562bd27122e3edbccbeea32394f87f61 --- /dev/null +++ b/resourceschedule/background_process_manager/background_process_manager.ndk.json @@ -0,0 +1,10 @@ +[ + { + "first_introduced": "15", + "name": "OH_BackgroundProcessManager_SetProcessPriority" + }, + { + "first_introduced": "15", + "name": "OH_BackgroundProcessManager_ResetProcessPriority" + } +] \ No newline at end of file diff --git a/resourceschedule/background_process_manager/include/background_process_manager.h b/resourceschedule/background_process_manager/include/background_process_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..c9e3c085c02b91e650e312fc88b457118bcbf6e8 --- /dev/null +++ b/resourceschedule/background_process_manager/include/background_process_manager.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2025 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 BackgroundProcessManager + * @{ + * + * @brief BackgroundProcessManager provides APIs. + * + * @since 15 + */ + +/** + * @file background_process_manager.h + * + * @brief Declares the BackgroundProcessManager interfaces in C. + * + * BackgroundProcessManager refers to set or reset priority of process + * + * @library libbackground_process_manager.z.so + * @kit BackgroundTasksKit + * @syscap SystemCapability.Resourceschedule.BackgroundProcessManager + * @since 15 + */ + +#ifndef RESOURCESCHEDULE_BACKGROUND_PROCESS_MANAGER_H +#define RESOURCESCHEDULE_BACKGROUND_PROCESS_MANAGER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Describes the level of BackgroundProcessManager priority. + * + * @since 15 + */ +typedef enum BackgroundProcessManager_ProcessPriority { + /** + * @brief Means the process has stopped working and in the background + */ + PROCESS_BACKGROUND = 1, + + /** + * @brief Means the process is working in the background + */ + PROCESS_INACTIVE = 2, +} BackgroundProcessManager_ProcessPriority; + +/** + * @brief Enum for BackgroundProcessManager error code. + * + * @since 15 + */ +typedef enum BackgroundProcessManager_ErrorCode { + /** + * @error result is OK. + */ + ERR_BACKGROUND_PROCESS_MANAGER_SUCCESS = 0, + + /** + * @error invalid parameter. Possible causes: + * 1. priority is out of range. + */ + ERR_BACKGROUND_PROCESS_MANAGER_INVALID_PARAM = 401, + + /** + * @error remote error. Possible causes: + * 1. remote is not work. + */ + ERR_BACKGROUND_PROCESS_MANAGER_REMOTE_ERROR = 31800001, +} BackgroundProcessManager_ErrorCode; + +/** + * @brief Set the priority of process. + * + * @param pid Indicates the pid of the process to be set. + * @param priority Indicates the priority to be set. + Specific priority can be referenced {@link BackgroundProcessManager_ProcessPriority}. + * @return {@link ERR_BACKGROUND_PROCESS_MANAGER_SUCCESS} 0 - Success. + * {@link ERR_BACKGROUND_PROCESS_MANAGER_INVALID_PARAM} 401 - Parameter error. + * {@link ERR_BACKGROUND_PROCESS_MANAGER_REMOTE_ERROR} 31800001 - Remote error. + * @since 15 + */ +int OH_BackgroundProcessManager_SetProcessPriority(int pid, BackgroundProcessManager_ProcessPriority priority); + +/** + * @brief Reset the priority of process. + * + * @param pid Indicates the pid of the process to be reset. + * @return {@link ERR_BACKGROUND_PROCESS_MANAGER_SUCCESS} 0 - Success. + * {@link ERR_BACKGROUND_PROCESS_MANAGER_REMOTE_ERROR} 31800001 - Remote error. + * @since 15 + */ +int OH_BackgroundProcessManager_ResetProcessPriority(int pid); +#ifdef __cplusplus +}; +#endif +#endif // RESOURCESCHEDULE_BACKGROUND_PROCESS_MANAGER_H +/** @} */ diff --git a/resourceschedule/ffrt/c/condition_variable.h b/resourceschedule/ffrt/c/condition_variable.h index 0e80e02c2fe8b2e0ecba06e48f55c02c6c006b9d..8472dba1b768be4f847e692201578df5a3f73acf 100644 --- a/resourceschedule/ffrt/c/condition_variable.h +++ b/resourceschedule/ffrt/c/condition_variable.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the condition variable interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -45,8 +45,8 @@ * * @param cond Indicates a pointer to the condition variable. * @param attr Indicates a pointer to the condition variable attribute. - * @return Returns ffrt_thrd_success if the condition variable is initialized; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the condition variable is initialized; + returns ffrt_error otherwise. * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -57,8 +57,8 @@ FFRT_C_API int ffrt_cond_init(ffrt_cond_t* cond, const ffrt_condattr_t* attr); * @brief Unblocks at least one of the threads that are blocked on a condition variable. * * @param cond Indicates a pointer to the condition variable. - * @return Returns ffrt_thrd_success if the thread is unblocked; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the thread is unblocked; + returns ffrt_error otherwise. * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -69,8 +69,8 @@ FFRT_C_API int ffrt_cond_signal(ffrt_cond_t* cond); * @brief Unblocks all threads currently blocked on a condition variable. * * @param cond Indicates a pointer to the condition variable. - * @return Returns ffrt_thrd_success if the threads are unblocked; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the threads are unblocked; + returns ffrt_error otherwise. * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -82,8 +82,8 @@ FFRT_C_API int ffrt_cond_broadcast(ffrt_cond_t* cond); * * @param cond Indicates a pointer to the condition variable. * @param mutex Indicates a pointer to the mutex. - * @return Returns ffrt_thrd_success if the thread is unblocked after being blocked; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the thread is unblocked after being blocked; + returns ffrt_error otherwise. * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -98,9 +98,9 @@ FFRT_C_API int ffrt_cond_wait(ffrt_cond_t* cond, ffrt_mutex_t* mutex); * @param time_point Indicates the maximum duration that the thread is blocked. * If ffrt_cond_signal or ffrt_cond_broadcast is not called to unblock the thread * when the maximum duration reaches, the thread is automatically unblocked. - * @return Returns ffrt_thrd_success if the thread is unblocked after being blocked; - returns ffrt_thrd_timedout if the maximum duration reaches; - returns ffrt_thrd_error if the blocking fails. + * @return Returns ffrt_success if the thread is unblocked after being blocked; + returns ffrt_error_timedout if the maximum duration reaches; + returns ffrt_error if the blocking fails. * @since 10 * @version 1.0 */ @@ -110,10 +110,11 @@ FFRT_C_API int ffrt_cond_timedwait(ffrt_cond_t* cond, ffrt_mutex_t* mutex, const * @brief Destroys a condition variable. * * @param cond Indicates a pointer to the condition variable. - * @return Returns ffrt_thrd_success if the condition variable is destroyed; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the condition variable is destroyed; + returns ffrt_error otherwise. * @since 10 * @version 1.0 */ FFRT_C_API int ffrt_cond_destroy(ffrt_cond_t* cond); #endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/loop.h b/resourceschedule/ffrt/c/loop.h index 95d6a8befa494d9a1cb37659a0e85c5c282c03bc..0b330a18f448f1d6a2b569067916852c3fe9f686 100644 --- a/resourceschedule/ffrt/c/loop.h +++ b/resourceschedule/ffrt/c/loop.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the loop interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 12 * @version 1.0 @@ -133,4 +133,5 @@ FFRT_C_API ffrt_timer_t ffrt_loop_timer_start( */ FFRT_C_API int ffrt_loop_timer_stop(ffrt_loop_t loop, ffrt_timer_t handle); -#endif \ No newline at end of file +#endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/mutex.h b/resourceschedule/ffrt/c/mutex.h index 1c397cdd31c02da8d4e853301faf87d4fac61a83..ec8eede4cabecf63d595a04e5d2e5906332a623d 100644 --- a/resourceschedule/ffrt/c/mutex.h +++ b/resourceschedule/ffrt/c/mutex.h @@ -24,13 +24,13 @@ * * @since 10 */ - + /** * @file mutex.h * @kit FunctionFlowRuntimeKit * * @brief Declares the mutex interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -42,7 +42,6 @@ /** * @brief Initializes mutex attr. * - * @param mutex Indicates a pointer to the mutex. * @param attr Indicates a pointer to the mutex attribute. * @return {@link ffrt_success} 0 - success * {@link ffrt_error_inval} 22 - if attr is null. @@ -91,8 +90,8 @@ FFRT_C_API int ffrt_mutexattr_destroy(ffrt_mutexattr_t* attr); * * @param mutex Indicates a pointer to the mutex. * @param attr Indicates a pointer to the mutex attribute. - * @return Returns ffrt_thrd_success if the mutex is initialized; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the mutex is initialized; + returns ffrt_error otherwise. * @since 10 * @version 1.0 */ @@ -102,8 +101,8 @@ FFRT_C_API int ffrt_mutex_init(ffrt_mutex_t* mutex, const ffrt_mutexattr_t* attr * @brief Locks a mutex. * * @param mutex Indicates a pointer to the mutex. - * @return Returns ffrt_thrd_success if the mutex is locked; - returns ffrt_thrd_error or blocks the calling thread otherwise. + * @return Returns ffrt_success if the mutex is locked; + returns ffrt_error or blocks the calling thread otherwise. * @since 10 * @version 1.0 */ @@ -113,8 +112,8 @@ FFRT_C_API int ffrt_mutex_lock(ffrt_mutex_t* mutex); * @brief Unlocks a mutex. * * @param mutex Indicates a pointer to the mutex. - * @return Returns ffrt_thrd_success if the mutex is unlocked; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the mutex is unlocked; + returns ffrt_error otherwise. * @since 10 * @version 1.0 */ @@ -124,8 +123,8 @@ FFRT_C_API int ffrt_mutex_unlock(ffrt_mutex_t* mutex); * @brief Attempts to lock a mutex. * * @param mutex Indicates a pointer to the mutex. - * @return Returns ffrt_thrd_success if the mutex is locked; - returns ffrt_thrd_error or ffrt_thrd_busy otherwise. + * @return Returns ffrt_success if the mutex is locked; + returns ffrt_error or ffrt_error_busy otherwise. * @since 10 * @version 1.0 */ @@ -135,10 +134,11 @@ FFRT_C_API int ffrt_mutex_trylock(ffrt_mutex_t* mutex); * @brief Destroys a mutex. * * @param mutex Indicates a pointer to the mutex. - * @return Returns ffrt_thrd_success if the mutex is destroyed; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the mutex is destroyed; + returns ffrt_error otherwise. * @since 10 * @version 1.0 */ FFRT_C_API int ffrt_mutex_destroy(ffrt_mutex_t* mutex); #endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/queue.h b/resourceschedule/ffrt/c/queue.h index 9b6deb65553a605826abd971212893738a3a2e32..114d861672e3759d3e0bc2d0f5153eb2ec0b22c7 100644 --- a/resourceschedule/ffrt/c/queue.h +++ b/resourceschedule/ffrt/c/queue.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the queue interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -72,7 +72,7 @@ FFRT_C_API void ffrt_queue_attr_destroy(ffrt_queue_attr_t* attr); * @brief Sets the QoS for a queue attribute. * * @param attr Indicates a pointer to the queue attribute. - * @param attr Indicates the QoS. + * @param qos Indicates the QoS. * @since 10 * @version 1.0 */ @@ -230,7 +230,9 @@ FFRT_C_API ffrt_queue_t ffrt_get_main_queue(); * @return Returns application worker(ArkTs) thread queue. * @since 12 * @version 1.0 + * @deprecated since 15 */ FFRT_C_API ffrt_queue_t ffrt_get_current_queue(); -#endif // FFRT_API_C_QUEUE_H \ No newline at end of file +#endif // FFRT_API_C_QUEUE_H +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/sleep.h b/resourceschedule/ffrt/c/sleep.h index ee4a7196fcffabab15ad79faf5c70b9e4a0e5585..d45668ed14c1c73e3bd3b99a46434cc28b4a2569 100644 --- a/resourceschedule/ffrt/c/sleep.h +++ b/resourceschedule/ffrt/c/sleep.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the sleep and yield interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -44,8 +44,8 @@ * @brief Suspends the calling thread for a given duration. * * @param usec Indicates the duration that the calling thread is suspended, in microseconds. - * @return Returns ffrt_thrd_success if the thread is suspended; - returns ffrt_thrd_error otherwise. + * @return Returns ffrt_success if the thread is suspended; + returns ffrt_error otherwise. * @since 10 * @version 1.0 */ @@ -59,3 +59,4 @@ FFRT_C_API int ffrt_usleep(uint64_t usec); */ FFRT_C_API void ffrt_yield(void); #endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/task.h b/resourceschedule/ffrt/c/task.h index b789fdc74ddf5d5bbea7b4770eb6aa022f49e939..786661d8214186e089bae896fe842dddc42a95a5 100644 --- a/resourceschedule/ffrt/c/task.h +++ b/resourceschedule/ffrt/c/task.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the task interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -276,3 +276,4 @@ FFRT_C_API void ffrt_wait_deps(const ffrt_deps_t* deps); FFRT_C_API void ffrt_wait(void); #endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/timer.h b/resourceschedule/ffrt/c/timer.h index 99ce5254a22f5aa161a33f120c2b4f2f8828b94b..a12610aae44664395b4dd5ccf7ccfe99eaff8e86 100644 --- a/resourceschedule/ffrt/c/timer.h +++ b/resourceschedule/ffrt/c/timer.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares the timer interfaces in C. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 12 * @version 1.0 @@ -66,4 +66,5 @@ FFRT_C_API ffrt_timer_t ffrt_timer_start(ffrt_qos_t qos, uint64_t timeout, void* * @version 1.0 */ FFRT_C_API int ffrt_timer_stop(ffrt_qos_t qos, ffrt_timer_t handle); -#endif \ No newline at end of file +#endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/ffrt/c/type_def.h b/resourceschedule/ffrt/c/type_def.h index 8d9f7c1abd02874a24720f933c86e47d4306251d..2a4343bff0731da5551c8c97d321c44e426109e3 100644 --- a/resourceschedule/ffrt/c/type_def.h +++ b/resourceschedule/ffrt/c/type_def.h @@ -30,7 +30,7 @@ * @kit FunctionFlowRuntimeKit * * @brief Declares common types. - * + * @library libffrt.z.so * @syscap SystemCapability.Resourceschedule.Ffrt.Core * @since 10 * @version 1.0 @@ -65,6 +65,7 @@ typedef enum { /** * @brief Enumerates the task QoS types. * + * @since 10 */ typedef enum { /** Inheritance. */ @@ -85,6 +86,7 @@ typedef void(*ffrt_function_t)(void*); /** * @brief Defines a task executor. * + * @since 10 */ typedef struct { /** Function used to execute a task. */ @@ -98,6 +100,7 @@ typedef struct { /** * @brief Defines the storage size of multiple types of structs. * + * @since 10 */ typedef enum { /** Task attribute storage size. */ @@ -115,6 +118,7 @@ typedef enum { /** * @brief Enumerates the task types. * + * @since 10 */ typedef enum { /** General task. */ @@ -126,6 +130,7 @@ typedef enum { /** * @brief dependency type. * + * @since 10 */ typedef enum { /** Data dependency type. */ @@ -137,6 +142,7 @@ typedef enum { /** * @brief dependency data structure. * + * @since 10 */ typedef struct { /** Dependency type. */ @@ -148,6 +154,7 @@ typedef struct { /** * @brief Defines the dependency struct. * + * @since 10 */ typedef struct { /** Number of dependencies. */ @@ -244,3 +251,4 @@ using qos = int; } #endif #endif +/** @} */ \ No newline at end of file diff --git a/resourceschedule/qos_manager/c/qos.h b/resourceschedule/qos_manager/c/qos.h index b264a23d9114a447c9731c2d3769b9cc1c93095c..8cc30a05140862f673485e221c82ec70d12d06f4 100644 --- a/resourceschedule/qos_manager/c/qos.h +++ b/resourceschedule/qos_manager/c/qos.h @@ -13,8 +13,6 @@ * limitations under the License. */ -#ifndef QOS_H -#define QOS_H /** * @addtogroup QoS * @{ @@ -35,9 +33,14 @@ * schedule the time and running order of tasks according to the QoS set by the tasks. * * @library libqos.so + * @kit KernelEnhanceKit * @syscap SystemCapability.Resourceschedule.QoS.Core * @since 12 */ + +#ifndef QOS_H +#define QOS_H + #ifdef __cplusplus extern "C" { #endif @@ -114,4 +117,5 @@ int OH_QoS_GetThreadQoS(QoS_Level *level); #ifdef __cplusplus }; #endif -#endif //QOS_H +#endif // QOS_H +/** @} */ diff --git a/security/asset/inc/asset_api.h b/security/asset/inc/asset_api.h index 794a04e02009198abb8219d1a6ce72d30c63c457..cda927aac42a5993ee6f13785d945feb0adb171e 100755 --- a/security/asset/inc/asset_api.h +++ b/security/asset/inc/asset_api.h @@ -13,14 +13,6 @@ * limitations under the License. */ -#ifndef ASSET_API_H -#define ASSET_API_H - -#include -#include - -#include "asset_type.h" - /** * @addtogroup AssetApi * @{ @@ -44,6 +36,14 @@ * @since 11 */ +#ifndef ASSET_API_H +#define ASSET_API_H + +#include +#include + +#include "asset_type.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/security/asset/inc/asset_type.h b/security/asset/inc/asset_type.h index 8d64e56d51a9bfdd0dfc65c809271134e095e6ed..1706eb602a1d20748d9300114d888cc427a6f8be 100755 --- a/security/asset/inc/asset_type.h +++ b/security/asset/inc/asset_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef ASSET_TYPE_H -#define ASSET_TYPE_H - /** * @addtogroup AssetType * @{ @@ -36,6 +33,9 @@ * @since 11 */ +#ifndef ASSET_TYPE_H +#define ASSET_TYPE_H + #include #include @@ -208,9 +208,21 @@ typedef enum { /** * A tag whose value is a bool indicating whether the attributes of an asset are required to be encrypted. * - * @since 13 + * @since 14 */ ASSET_TAG_REQUIRE_ATTR_ENCRYPTED = ASSET_TYPE_BOOL | 0x47, + /** + * A tag whose value is a byte array indicating the group id an asset belongs to. + * + * @since 18 + */ + ASSET_TAG_GROUP_ID = ASSET_TYPE_BYTES | 0x48, + /** + * A tag whose value is a 32-bit unsigned integer indicating the type of Asset encapsulation. + * + * @since 18 + */ + ASSET_TAG_WRAP_TYPE = ASSET_TYPE_NUMBER | 0x49, } Asset_Tag; /** @@ -324,6 +336,22 @@ typedef enum { ASSET_SYNC_TYPE_TRUSTED_ACCOUNT = 1 << 2, } Asset_SyncType; +/** + * @brief An enum type indicates the type of Asset encapsulation. + * + * @since 18 + */ +typedef enum { + /** + * An Asset with this attribute value is never allowed to be wrapped up. + */ + ASSET_WRAP_TYPE_NEVER = 0, + /** + * An Asset with this attribute value can only be wrapped or unwrapped on devices logged in with trusted accounts. + */ + ASSET_WRAP_TYPE_TRUSTED_ACCOUNT = 1, +} Asset_WrapType; + /** * @brief Enumerates the policies for resolving the conflict (for example, duplicate alias) occurred when * an asset is added. diff --git a/security/huks/include/native_huks_api.h b/security/huks/include/native_huks_api.h index d806c778bd6a87e95c0ecc216bb9a2ad3738d847..37d74511b6a9d3e1b1e1b2d3f03092aec10e2b63 100644 --- a/security/huks/include/native_huks_api.h +++ b/security/huks/include/native_huks_api.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_HUKS_API_H -#define NATIVE_HUKS_API_H - /** * @addtogroup HuksKeyApi * @{ @@ -34,12 +31,18 @@ * * @brief Defines the Universal Keystore Kit APIs. * + * @library libhuks_ndk.z.so + * @syscap SystemCapability.Security.Huks + * * include "huks/include/native_huks_type.h" * @kit UniversalKeystoreKit * @since 9 * @version 1.0 */ +#ifndef NATIVE_HUKS_API_H +#define NATIVE_HUKS_API_H + #include "native_huks_type.h" #ifdef __cplusplus @@ -52,7 +55,7 @@ extern "C" { * @param sdkVersion Indicates the pointer to the SDK version (in string format) obtained. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If sdkVersion or - * sdkVersion->data is null, or if sdkVersion->size is too small. + * sdkVersion->data is null, or if sdkVersion->size is too small. * @since 9 * @version 1.0 */ @@ -68,21 +71,21 @@ struct OH_Huks_Result OH_Huks_GetSdkVersion(struct OH_Huks_Blob *sdkVersion); * not of a temporary type, this parameter is a null pointer. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSetIn or - * paramSetOut is invalid. + * paramSetOut is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FILE_OPERATION_FAIL} 12000004 - If failed to remove file, - * or if failed to write file. + * or if failed to write file. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the base key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CALL_SERVICE_FAILED} 12000015 - If connect userIam failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_DEVICE_PASSWORD_UNSET} 12000016 - If device password is required - * but not set. + * but not set. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. * @since 9 * @version 1.0 @@ -99,15 +102,14 @@ struct OH_Huks_Result OH_Huks_GenerateKeyItem(const struct OH_Huks_Blob *keyAlia * @param key Indicates the pointer to the key to import. The key must be in the format required by the HUKS. * For details, see {@link HuksTypeApi}. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. - * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet or - * key is invalid. + * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet or key is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FILE_OPERATION_FAIL} 12000004 - If failed to remove file, - * or if failed to write file. + * or if failed to write file. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CALL_SERVICE_FAILED} 12000015 - If connect userIam failed. @@ -130,14 +132,14 @@ struct OH_Huks_Result OH_Huks_ImportKeyItem(const struct OH_Huks_Blob *keyAlias, * The key must be in the format required by the HUKS. For details, see {@link OH_Huks_AlgSuite}. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or wrappingKeyAlias or - * paramSet or wrappedKeyData is invalid. + * paramSet or wrappedKeyData is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FILE_OPERATION_FAIL} 12000004 - If failed to remove file, - * or if failed to write file. + * or if failed to write file. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. @@ -158,14 +160,13 @@ struct OH_Huks_Result OH_Huks_ImportWrappedKeyItem(const struct OH_Huks_Blob *ke * @param paramSet Indicates the pointer to the parameters required for exporting the public key. * @param key Indicates the pointer to the public key exported. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. - * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or - * paramSet or key is invalid. + * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet or key is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. @@ -186,10 +187,10 @@ struct OH_Huks_Result OH_Huks_ExportPublicKeyItem(const struct OH_Huks_Blob *key * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * @since 9 @@ -207,13 +208,13 @@ struct OH_Huks_Result OH_Huks_DeleteKeyItem(const struct OH_Huks_Blob *keyAlias, * @param paramSetOut Indicates the pointer to the attributes obtained. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSetIn or - * paramSetOut is invalid. + * paramSetOut is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. @@ -233,10 +234,10 @@ struct OH_Huks_Result OH_Huks_GetKeyItemParamSet(const struct OH_Huks_Blob *keyA * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * @since 9 @@ -253,20 +254,20 @@ struct OH_Huks_Result OH_Huks_IsKeyItemExist(const struct OH_Huks_Blob *keyAlias * @param paramSet Indicates the pointer to the parameters required for obtaining the key certificate. * @param certChain Indicates the pointer to the key certificate chain obtained. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. - * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet or - * certChain is invalid. + * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or + * paramSet or certChain is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_PERMISSION_FAIL} 201 - If the permission check failed, - * please apply for the required permissions first. + * please apply for the required permissions first. * @since 9 * @version 1.0 */ @@ -281,19 +282,19 @@ struct OH_Huks_Result OH_Huks_AttestKeyItem(const struct OH_Huks_Blob *keyAlias, * @param certChain Indicates the pointer to the key certificate chain obtained. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or - * paramSet or certChain is invalid. + * paramSet or certChain is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_PERMISSION_FAIL} 201 - If the permission check failed, - * please apply for the required permissions first. + * please apply for the required permissions first. * @since 11 * @version 1.0 * @note this is a networking duration interface caller need to get the certChain in asynchronous thread @@ -309,16 +310,16 @@ struct OH_Huks_Result OH_Huks_AnonAttestKeyItem(const struct OH_Huks_Blob *keyAl * @param handle Indicates the pointer to the handle of the key session obtained. * This handle is required for subsequent operations, including {@link OH_Huks_UpdateSession}, * {@link OH_Huks_FinishSession}, and {@link OH_Huks_AbortSession}. - * @param challenge Indicates the pointer to the challenge value obtained. + * @param token Indicates the pointer to the token used for key access control. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If keyAlias or paramSet or handle or - * token is invalid. + * token is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_SESSION_LIMIT} 12000010 - If reached max session limit. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. @@ -344,24 +345,24 @@ struct OH_Huks_Result OH_Huks_InitSession(const struct OH_Huks_Blob *keyAlias, * @param outData Indicates the pointer to the output data. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If handle or paramSet or inData or - * outData is invalid. + * outData is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit, - * or if the handle is not exist. + * or if the handle is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST} 12000013 - If credemtial is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED} 12000008 - If auth token verify failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED} 12000007 - If auth token info - * verify failed. + * verify failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_TIME_OUT} 12000009 - If authentication token timed out. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_DEVICE_PASSWORD_UNSET} 12000016 - If device password is required - * but not set. + * but not set. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. * @since 9 * @version 1.0 @@ -381,24 +382,24 @@ struct OH_Huks_Result OH_Huks_UpdateSession(const struct OH_Huks_Blob *handle, * @param outData Indicates the pointer to the output data. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If handle or paramSet or inData or - * outData is invalid. + * outData is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - If the key file is not exit, - * or if the handle is not exist. + * or if the handle is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST} 12000013 - If credemtial is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CRYPTO_FAIL} 12000006 - If crypto engine failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED} 12000008 - If auth token verify failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED} 12000007 - If auth token info - * verify failed. + * verify failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_KEY_AUTH_TIME_OUT} 12000009 - If authentication token timed out. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_DEVICE_PASSWORD_UNSET} 12000016 - If device password is required - * but not set. + * but not set. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED} 12000001 - If the feature is not support. * @since 9 * @version 1.0 @@ -417,13 +418,13 @@ struct OH_Huks_Result OH_Huks_FinishSession(const struct OH_Huks_Blob *handle, * By default, this parameter is a null pointer. * @return {@link OH_Huks_ErrCode#OH_HUKS_SUCCESS} 0 - If the operation is successful. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ILLEGAL_ARGUMENT} 401 - If handle or paramSet or inData or - * outData is invalid. + * outData is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INTERNAL_ERROR} 12000012 - If system error ocurred. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT} 12000003 - If the key argument - * is invalid. + * is invalid. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_ITEM_NOT_EXIST} 12000011 - or if the handle is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT} 12000002 - If failed to - * get key argument. + * get key argument. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_COMMUNICATION_FAIL} 12000005 - If Ipc commuication failed. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST} 12000013 - If credemtial is not exist. * {@link OH_Huks_ErrCode#OH_HUKS_ERR_CODE_INSUFFICIENT_MEMORY} 12000014 - If the memory is insufficient. diff --git a/security/huks/include/native_huks_param.h b/security/huks/include/native_huks_param.h index 9b8cf1f60deb87709f7d81a99b2651df09314cf6..8866a8b564e235979af7a858fc6a80e39a447150 100644 --- a/security/huks/include/native_huks_param.h +++ b/security/huks/include/native_huks_param.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_HUKS_PARAM_H -#define NATIVE_HUKS_PARAM_H - /** * @addtogroup HuksParamSetApi * @{ @@ -36,12 +33,18 @@ * * @brief Provides APIs for constructing, using, and destroying parameter sets. * + * @library libhuks_ndk.z.so + * @syscap SystemCapability.Security.Huks + * * include "huks/include/native_huks_type.h" * @kit UniversalKeystoreKit * @since 9 * @version 1.0 */ +#ifndef NATIVE_HUKS_PARAM_H +#define NATIVE_HUKS_PARAM_H + #include "native_huks_type.h" #ifdef __cplusplus diff --git a/security/huks/include/native_huks_type.h b/security/huks/include/native_huks_type.h index 765dc5a87fec29bba53ac3fd05c0c9f596d73310..b3c1838c969889380fb9084428d64a5ca9fd095d 100644 --- a/security/huks/include/native_huks_type.h +++ b/security/huks/include/native_huks_type.h @@ -13,9 +13,6 @@ * limitations under the License. */ -#ifndef NATIVE_OH_HUKS_TYPE_H -#define NATIVE_OH_HUKS_TYPE_H - /** * @addtogroup HuksTypeApi * @{ @@ -33,11 +30,17 @@ * * @brief Defines the structure and enumeration. * + * @library libhuks_ndk.z.so + * @syscap SystemCapability.Security.Huks + * * @kit UniversalKeystoreKit * @since 9 * @version 1.0 */ +#ifndef NATIVE_OH_HUKS_TYPE_H +#define NATIVE_OH_HUKS_TYPE_H + #include #include #include @@ -134,6 +137,14 @@ enum OH_Huks_KeyPadding { OH_HUKS_PADDING_PKCS5 = 4, /** PKCS #7. */ OH_HUKS_PADDING_PKCS7 = 5, + /** ISO IEC 9796-2 + * @since 18 + */ + OH_HUKS_PADDING_ISO_IEC_9796_2 = 6, + /** ISO IEC 9797-1 + * @since 18 + */ + OH_HUKS_PADDING_ISO_IEC_9797_1 = 7, }; /** @@ -214,6 +225,19 @@ enum OH_Huks_KeySize { OH_HUKS_SM2_KEY_SIZE_256 = 256, /** ShangMi4 (SM4) key of 128 bits. */ OH_HUKS_SM4_KEY_SIZE_128 = 128, + + /** DES key of 64 bits. + * @since 18 + */ + OH_HUKS_DES_KEY_SIZE_64 = 64, + /** 3DES key of 128 bits. + * @since 18 + */ + OH_HUKS_3DES_KEY_SIZE_128 = 128, + /** 3DES key of 192 bits. + * @since 18 + */ + OH_HUKS_3DES_KEY_SIZE_192 = 192, }; /** @@ -254,6 +278,19 @@ enum OH_Huks_KeyAlg { OH_HUKS_ALG_SM3 = 151, /** SM4. */ OH_HUKS_ALG_SM4 = 152, + + /** DES. + * @since 18 + */ + OH_HUKS_ALG_DES = 160, + /** 3DES. + * @since 18 + */ + OH_HUKS_ALG_3DES = 161, + /** CMAC. + * @since 18 + */ + OH_HUKS_ALG_CMAC = 162, }; /** diff --git a/sensors/miscdevice/vibrator/include/vibrator_type.h b/sensors/miscdevice/vibrator/include/vibrator_type.h index 1711f730885e3c1279700cffab90de59829e661f..0ce2b1ea3130fef542af482f481d94cc10e3bcbf 100644 --- a/sensors/miscdevice/vibrator/include/vibrator_type.h +++ b/sensors/miscdevice/vibrator/include/vibrator_type.h @@ -34,7 +34,11 @@ #ifndef VIBRATOR_TYPE_H #define VIBRATOR_TYPE_H +#ifdef __cplusplus #include +#else +#include +#endif #ifdef __cplusplus extern "C" { diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index 0641a9c0cf414e456dcedd7e972d3df5bb2d8f50..c53c5e1525f2928c6d7efcc1c3c0f472d21f06cf 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -34,7 +34,11 @@ #ifndef OH_SENSOR_TYPE_H #define OH_SENSOR_TYPE_H +#ifdef __cplusplus #include +#else +#include +#endif #ifdef __cplusplus extern "C" { diff --git a/startup/init/syscap/include/deviceinfo.h b/startup/init/syscap/include/deviceinfo.h index 955759bfb9c18dcf80d22dd9a77fb093a0ccd587..05f1bbd2bcb97ce48d5a7cc0989c6ba612528643 100644 --- a/startup/init/syscap/include/deviceinfo.h +++ b/startup/init/syscap/include/deviceinfo.h @@ -13,6 +13,24 @@ * limitations under the License. */ +/** + * @addtogroup DeviceInfo + * @{ + * + * @brief Provides APIs for querying terminal device information. + * + * @since 10 + */ + +/** + * @file deviceinfo.h + * @kit BasicServicesKit + * @brief Declares APIs for querying terminal device information. + * @library libdeviceinfo_ndk.z.so + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + #ifndef DEVICEINFO_CSDK_H #define DEVICEINFO_CSDK_H @@ -228,3 +246,4 @@ const char *OH_GetDistributionOSReleaseType(void); #endif #endif #endif +/** @} */ diff --git a/startup/init/syscap/include/syscap_ndk.h b/startup/init/syscap/include/syscap_ndk.h index 070a6cb1e66afea5347295bf62258ac4b7fb7458..a52f30603aa88f8ca59b64303c3e7c1d81b344dc 100644 --- a/startup/init/syscap/include/syscap_ndk.h +++ b/startup/init/syscap/include/syscap_ndk.h @@ -13,6 +13,24 @@ * limitations under the License. */ +/** + * @addtogroup SyscapNdk + * @{ + * + * @brief Provides APIs for querying system capabilities. + * + * @since 10 + */ + +/** + * @file syscap_ndk.h + * @kit BasicServicesKit + * @brief Declares APIs for acquiring the set of system capabilities . + * @library NA + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + #ifndef SYSCAP_NDK_H #define SYSCAP_NDK_H @@ -31,4 +49,5 @@ bool canIUse(const char *cap); } #endif #endif -#endif \ No newline at end of file +#endif +/** @} */ diff --git a/startup/init/syscap/init_sync.h b/startup/init/syscap/init_sync.h index ceeefbce390a32bf12cb49334c52fc475fced04c..4ddd5680874e3654e753b55705e34b352a07b3fc 100644 --- a/startup/init/syscap/init_sync.h +++ b/startup/init/syscap/init_sync.h @@ -13,6 +13,24 @@ * limitations under the License. */ +/** + * @addtogroup InitSync + * @{ + * + * @brief Provides APIs for notifying the Init process of events. + * + * @since 10 + */ + +/** + * @file init_sync.h + * @kit BasicServicesKit + * @brief Declares APIs for notifying events to the Init process. + * @library NA + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + #ifndef BASE_STARTUP_INITLITE_NOTIFY_H #define BASE_STARTUP_INITLITE_NOTIFY_H @@ -47,3 +65,4 @@ extern int NotifyInit(unsigned long event); #endif #endif // BASE_STARTUP_INITLITE_NOTIFY_H +/** @} */ diff --git a/tee/include/rpmb_driver_rw_api.h b/tee/include/rpmb_driver_rw_api.h deleted file mode 100644 index 4c96f222e6568ad3dcef5c56943b9bf6c5b76913..0000000000000000000000000000000000000000 --- a/tee/include/rpmb_driver_rw_api.h +++ /dev/null @@ -1,298 +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. - */ - -#ifndef RPMB_DRIVER_RW_API_H -#define RPMB_DRIVER_RW_API_H -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file rpmb_driver_rw_api.h - * - * @brief APIs related to RPMB driver read and write. - * Provides the function of reading and writing RPMB driver. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines the total block number. - * - * @since 12 - * @version 1.0 - */ -#define TOTAL_BLK 4 - -/** - * @brief Defines the size of block. - * - * @since 12 - * @version 1.0 - */ -#define BLK_SIZE 256 - -/** - * @brief Defines the size of the total block. - * - * @since 12 - * @version 1.0 - */ -#define TOTAL_BLK_SIZE (TOTAL_BLK * BLK_SIZE) - -#define SEC_WRITE_PROTECT_ENTRY_NUM 4 -#define SEC_WRITE_PROTECT_ENTRY_RESERVED_NUM 3 -#define SEC_WRITE_PROTECT_ENTRY_RESERVED_SIZE 16 -#define SEC_WRITE_PROTECT_FRAME_RESERVED_NUM 14 -#define SEC_WRITE_PROTECT_FRAME_RESERVED_END_NUM 176 -#define SEC_WRITE_PROTECT_BLK_SIZE 256 -#define SEC_WRITE_PROTECT_LUN_MAX 5 - -/** - * @brief A WPF set to one specifies that the logical unit shall inhibit alteration of the medium for LBA within - * the range indicated by LOGICAL BLOCK ADDRESS field and NUMBER OF LOGICAL BLOCKS field. - * Commands requiring writes to the medium shall be terminated with CHECK CONDITION status, - * with the sense key set to DATA PROTECT, and the additional sense code set to WRITE PROTECTED. - * - * @since 12 - * @version 1.0 - */ -typedef enum { - SEC_WRITE_PROTECT_DISABLE = 0, - SEC_WRITE_PROTECT_ENABLE = 1, -} write_protect_flag; - -/** - * @brief Write Protect Type specifies how WPF bit may be modified. - * - * @since 12 - * @version 1.0 - */ -typedef enum { - /** WPF bit is persistent through power cycle and hardware reset. - * WPF value may only be changed writing to Secure Write Protect Configuration Block. - */ - NV_TYPE = 0, - /** WPF bit is automatically cleared to 0b after power cycle or hardware reset. */ - P_TYPE = 1, - /** WPF bit is automatically set to 1b after power cycle or hardware reset. */ - NV_AWP_TYPE = 2, -} write_protect_type; - -/** - * @brief Secure Write Protect Entry. - * +-----+---+---+---+---+---+---+---+----+ - * | | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - * +-----+---+---+---+---+---+---+---+----+ - * | 0 | Reserved | WFT | WPF| -> wp_data - * +-----+---+---+---+---+---+---+---+----+ - * | 1 | Reserved | - * +-----+---+---+---+---+---+---+---+----+ - * | 2 | Reserved | - * +-----+---+---+---+---+---+---+---+----+ - * | 3 | Reserved | - * +-----+---+---+---+---+---+---+---+----+ - * | 4 | LOGICAL BLOCK ADDRESS | -> logical_blk_addr - * +-----+ + - * | ... | | - * +-----+ + - * | 11 | | - * +-----+ + - * | 12 | | - * +-----+---+---+---+---+---+---+---+----+ - * | ... | NUMBER OF LOGICAL BLOCKS | -> logical_blk_num - * +-----+---+---+---+---+---+---+---+----+ - * | 15 | | - * +-----+---+---+---+---+---+---+---+----+ - * - * @since 12 - * @version 1.0 - */ -struct rpmb_protect_cfg_blk_entry { - uint8_t wp_data; - uint8_t reserved[SEC_WRITE_PROTECT_ENTRY_RESERVED_NUM]; - /** This field specifies the LBA of the first logical address of the Secure Write Protect ares. */ - uint64_t logical_blk_addr; - /** This field specifies the number of contiguous logical size that belong to the Secure Write Protect. */ - uint32_t logical_blk_num; -}__attribute__((packed)); - - -/** - * @brief Secure Write Protect Configuration Block is supported by RPMB region 0 only. - * This block is used for configuring secure write protect areas in logical units. - * Each Secure Write Protect Configuration Block for each logical unit. - * Each entry represents one secure write protect area. - * If an entry is not used, then the related fields shall contain a value of zero. - * +-----+---+---+---+---+---+---+---+----+ - * | | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - * +-----+---+---+---+---+---+---+---+----+ - * | 0 | LUN | - * +-----+---+---+---+---+---+---+---+----+ - * | 1 | DATA LENGTH | - * +-----+---+---+---+---+---+---+---+----+ - * | 2 | | - * +-----+ + - * | ... | Reserved | - * +-----+ + - * | 15 | | - * +-----+---+---+---+---+---+---+---+----+ - * | 16 | | - * +-----+ + - * | ... | Secure Write Protect Entry 0 | - * +-----+ + - * | 31 | | - * +-----+---+---+---+---+---+---+---+----+ - * | 32 | | - * +-----+ + - * | ... | Secure Write Protect Entry 1 | - * +-----+ + - * | 47 | | - * +-----+---+---+---+---+---+---+---+----+ - * | 48 | | - * +-----+ + - * | ... | Secure Write Protect Entry 1 | - * +-----+ + - * | 63 | | - * +-----+---+---+---+---+---+---+---+----+ - * | 64 | | - * +-----+ + - * | ... | Secure Write Protect Entry 1 | - * +-----+ + - * | 79 | | - * +-----+---+---+---+---+---+---+---+----+ - * | 80 | | - * +-----+ + - * | ... | Reserved | - * +-----+ + - * | 255 | | - * +-----+---+---+---+---+---+---+---+----+ - * - * @since 12 - * @version 1.0 - */ -struct rpmb_protect_cfg_block { - uint8_t lun; - uint8_t data_length; - uint8_t reserved[SEC_WRITE_PROTECT_FRAME_RESERVED_NUM]; - struct rpmb_protect_cfg_blk_entry entries[SEC_WRITE_PROTECT_ENTRY_NUM]; - uint8_t reserved_end[SEC_WRITE_PROTECT_FRAME_RESERVED_END_NUM]; -}__attribute__((packed)); - -/** - * @brief Write protect config block by RPMB driver. - * - * @param lun Indicates the logical unit to which secure write protection shall apply, - * and 0 <= lun <= {@code SEC_WRITE_PROTECT_LUN_MAX} - * @param entries Indicates the Secure Write Protect Entry array, The maximum length is 4. - * @param len Indicates the real length of the Secure Write Protect Entry array, which value is less than 4. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the send message fail. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_rpmb_protect_cfg_blk_write(uint8_t lun, struct rpmb_protect_cfg_blk_entry *entries, uint32_t len); - -/** - * @brief Read protect config block by RPMB driver. - * - * @param lun Indicates the logical unit to which secure read protection shall apply, - * and 0 <= lun <= SEC_WRITE_PROTECT_LUN_MAX. - * @param entries Indicates the Secure Read Protect Entry array, The maximum length is 4. - * @param len Indicates the real length of the Secure Read Protect Entry array, which value is less than 4. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the send message fail. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_rpmb_protect_cfg_blk_read(uint8_t lun, struct rpmb_protect_cfg_blk_entry *entries, uint32_t *len); - -/** - * @brief Write plaintext buffer to RPMB driver. - * - * @param buf Indicates the buffer for writing data. - * @param size Indicates the length of buffer, the maximum value is 1024. - * @param block Indicates the block index of the position of start block, the value is [0, 3]. - * @param offset Indicates the offset bytes of data position, and the value of offest bytes is less than 256. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the send message fail. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_rpmb_driver_write(const uint8_t *buf, size_t size, uint32_t block, uint32_t offset); - -/** - * @brief Read plaintext buffer from RPMB driver. - * - * @param buf Indicates the buffer for read data. - * @param size Indicates the length of buffer, the maximum value is 1024. - * @param block Indicates the block index of the position of start block, the value is [0, 3]. - * @param offset Indicates the offset bytes of data position, and the value of offest bytes is less than 256. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the send message fail. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_rpmb_driver_read(uint8_t *buf, size_t size, uint32_t block, uint32_t offset); - -/** - * @brief Remove data from RPMB driver. - * - * @param size Indicates the length of remove data, the maximum value is 1024. - * @param block Indicates the block index of the position of start block, the value is [0, 3]. - * @param offset Indicates the offset bytes of data position, and the value of offest bytes is less than 256. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the send message fail. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_rpmb_driver_remove(size_t size, uint32_t block, uint32_t offset); - -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif diff --git a/tee/include/rpmb_fcntl.h b/tee/include/rpmb_fcntl.h deleted file mode 100644 index bc38160d7d10af7a3deaee7f999d3fc241d86bbf..0000000000000000000000000000000000000000 --- a/tee/include/rpmb_fcntl.h +++ /dev/null @@ -1,297 +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. - */ - -#ifndef RPMB_RPMB_FCNTL_H -#define RPMB_RPMB_FCNTL_H -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file rpmb_fcntl.h - * - * @brief Provides the APIs related to RPMB service. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Partition initialization, perform RPMB Key writing and formatting operations. - * - * @attention This function only needs to be executed once. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_RPMB_GENERIC} if the RPMB controller general error. - * Returns {@code TEE_ERROR_RPMB_MAC_FAIL} if the RPMB controller MAC check error. - * Returns {@code TEE_ERROR_RPMB_RESP_UNEXPECT_MAC} if the RPMB response data MAC check error. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Init(void); - -/** - * @brief RPMB secure storage fully formatted operation. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_RPMB_GENERIC} if the RPMB controller general error. - * Returns {@code TEE_ERROR_RPMB_MAC_FAIL} if the RPMB controller MAC check error. - * Returns {@code TEE_ERROR_RPMB_RESP_UNEXPECT_MAC} if the RPMB response data MAC check error. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Format(void); - -/** - * @brief Write files to RPMB. - * - * @attention If you want to improve the performance of writing files, you need to define the heap size in TA's - * manifest to be at leaset 3 times the file size plus 256KB. - * For example: To write a file with a size of 100KB, the defined heap size is at least - * 556KB (3 * 100 + 256). If the heap size cannot be satisfied, the file writing will still succeed, - * but the performance will be poor. - * - * @param filename Indicates the file name of the data to be written, the maximum length is 64 bytes. - * @param buf Indicates the buffer for writting data. - * @param size Indicates the size of the written data, the maximum size is 160KB. - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, or the file name is longer than 64 - * bytes. - * Returns {@code TEE_ERROR_RPMB_NOSPC} if the RPMB partition has insufficient disk space. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Write(const char *filename, const uint8_t *buf, size_t size); - -/** - * @brief Read files from RPMB. - * - * @attention If you want to improve the performance of reading files, you need to define the heap size in TA's - * manifest to be at leaset 3 times the file size plus 256KB. - * For example: To read a file with a size of 100KB, the defined heap size is at least - * 556KB (3 * 100 + 256). If the heap size cannot be satisfied, the file reading will still succeed, - * but the performance will be poor. - * - * @param filename Indicates the file name of the data to be read, the maximum length is 64 bytes. - * @param buf Indicates the buffer for reading data. - * @param size Indicates the read data size. - * @param count Indicates the size of the actual read. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, or the file name is longer than 64 - * bytes. - * Returns {@code TEE_ERROR_RPMB_FILE_NOT_FOUND} if the file dose not exist. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Read(const char *filename, uint8_t *buf, size_t size, uint32_t *count); - -/** - * @brief Rename file name in RPMB. - * - * @param old_name Indicates the old file name. - * @param new_name Indicates the new file name. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, or the file name is longer than 64 - * bytes. - * Returns {@code TEE_ERROR_RPMB_FILE_NOT_FOUND} if the file dose not exist. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Rename(const char *old_name, const char *new_name); - -/** - * @brief Delete files in RPMB. - * - * @param filename Indicates the file name to be deleted. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, or the file name is longer than 64 - * bytes. - * Returns {@code TEE_ERROR_RPMB_FILE_NOT_FOUND} if the file dose not exist. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Rm(const char *filename); - -/** - * @brief File status stored in RPMB partition, used in {@code TEE_RPMB_FS_Stat}. - * - * @since 12 - */ -struct rpmb_fs_stat { - /** Indicates the file size. */ - uint32_t size; - uint32_t reserved; -}; - -/** - * @brief Get file status in RPMB. - * - * @param filename Indicates the file name in RPMB. - * @param stat Indicates the file status information obtained. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, or the file name is longer than 64 - * bytes. - * Returns {@code TEE_ERROR_RPMB_FILE_NOT_FOUND} if the file dose not exist. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Stat(const char *filename, struct rpmb_fs_stat *stat); - -/** - * @brief Disk status stored in RPMB partition, used in {@code TEE_RPMB_FS_StatDisk}. - * - * @since 12 - */ -struct rpmb_fs_statdisk { - /** Indicates the total size of RPMB partition. */ - uint32_t disk_size; - /** Indicates the TA used size. */ - uint32_t ta_used_size; - /** Indicates the free size of the RPMB partition. */ - uint32_t free_size; - uint32_t reserved; -}; - -/** - * @brief Get the disk status. - * - * @param stat Indicates the disk status information obtained. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_StatDisk(struct rpmb_fs_statdisk *stat); - -/** - * @brief File attribute definition, which means that the file cannot be erased during the factory reset. - * - * @since 12 -*/ -#define TEE_RPMB_FMODE_NON_ERASURE (1U << 0) - -/** - * @brief File attribute definition, which means the attribute value of the cleard file. - * - * @since 12 -*/ -#define TEE_RPMB_FMODE_CLEAR 0 - - -/** - * @brief Set the file attribute in RPMB. - * - * @param filename Indicates the file name in RPMB. - * @param fmode Indicates the file attribute, currently supports {@code TEE_RPMB_FMODE_NON_ERASURE} and - * {@code TEE_RPMB_FMODE_CLEAR} two attributes, other values will return {@code TEE_ERROR_BAD_PARAMETERS}. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect, - * or the file name is longer than 64 bytes. - * Returns {@code TEE_ERROR_RPMB_FILE_NOT_FOUND} if the file dose not exist. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_SetAttr(const char *filename, uint32_t fmode); - -/** - * @brief Format, delete file attribute is erasable file, keep the file attribute is an inerasable file. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_RPMB_GENERIC} if the RPMB controller general error. - * Returns {@code TEE_ERROR_RPMB_MAC_FAIL} if the RPMB controller MAC check error. - * Returns {@code TEE_ERROR_RPMB_RESP_UNEXPECT_MAC} if the RPMB response data MAC check error. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_FS_Erase(void); - -/** - * @brief Enumerates the types of RPMB key status, used in {@code TEE_RPMB_KEY_Status}. - * - * @since 12 -*/ -enum TEE_RPMB_KEY_STAT { - /** RPMB Key status is invalid. */ - TEE_RPMB_KEY_INVALID = 0x0, - /** RPMB Key has been programmed and matched correctly. */ - TEE_RPMB_KEY_SUCCESS, - /** RPMB Key is not programmed. */ - TEE_RPMB_KEY_NOT_PROGRAM, - /** RPMB Key has been programmed but failed to match. */ - TEE_RPMB_KEY_NOT_MATCH, -}; - -/** - * @brief Obtain RPMB Key status. - * - * @return Returns {@code TEE_RPMB_KEY_SUCCESS} if the RPMB Key has been programmed and matched correctly. - * Returns {@code TEE_RPMB_KEY_NOT_PROGRAM} if the RPMB Key is not programmed. - * Returns {@code TEE_RPMB_KEY_NOT_MATCH} if RPMB Key has been programmed but failed to match. - * Returns {@code TEE_RPMB_KEY_INVALID} if the RPMB Key status is invalid. - * - * @since 12 - * @version 1.0 - */ -uint32_t TEE_RPMB_KEY_Status(void); - -/** - * @brief Process the current TA version information. - * - * @param ta_version Indicates the TA version. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RPMB_TAVERSION_Process(uint32_t ta_version); -#ifdef __cplusplus -} -#endif - -/** @} */ -#endif diff --git a/tee/include/tee_arith_api.h b/tee/include/tee_arith_api.h deleted file mode 100644 index b76c6eb371960cd2fc882c19e425a036705f437a..0000000000000000000000000000000000000000 --- a/tee/include/tee_arith_api.h +++ /dev/null @@ -1,578 +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. - */ - -#ifndef TEE_ARITH_API_H -#define TEE_ARITH_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_arith_api.h - * - * @brief Provides APIs for operating big integers. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef uint32_t TEE_BigInt; -typedef uint32_t TEE_BigIntFMM; -typedef uint32_t TEE_BigIntFMMContext; - -/** - * @brief Obtains the size of the array of uint32_t values required to represent a BigInt. - * - * @param n Indicates the TEE_BigInt type. - * - * @return Returns the BigInt size obtained. - * - * @since 12 - * @version 1.0 - */ -#define TEE_BigIntSizeInU32(n) ((((n) + 31) / 32) + 2) - -/** - * @brief Obtains the size of the array of uint32_t values. - * - * @param modulusSizeInBits Indicates the modulus size, in bits. - * - * @return Returns the number of bytes required to store a TEE_BigIntFMM, - * given a modulus of length modSizeInBits. - * - * @since 12 - * @version 1.0 - */ -size_t TEE_BigIntFMMSizeInU32(size_t modulusSizeInBits); - -/** - * @brief Obtains the size of an array of uint32_t values required to represent a fast modular context. - * - * @param modulusSizeInBits Indicates the modulus size, in bits. - * - * @return Returns the number of bytes required to store a TEE_BigIntFMMContext, - * given a modulus of length modSizeInBits. - * - * @since 12 - * @version 1.0 - */ -size_t TEE_BigIntFMMContextSizeInU32(size_t modulusSizeInBits); - -/** - * @brief Initializes a TEE_BigInt. - * - * @param bigInt Indicates the pointer to the TEE_BigInt to initialize. - * @param len Indicates the size of the memory pointed to by TEE_BigInt, in uint32_t. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntInit(TEE_BigInt *bigInt, size_t len); - -/** - * @brief Calculates the necessary prerequisites for fast modular multiplication and stores them in a context. - * - * @param context Indicates the pointer to the TEE_BigIntFMMContext to initialize. - * @param len Indicates the size of the memory pointed to by context, in uint32_t. - * @param modulus Indicates the pointer to the modulus. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntInitFMMContext(TEE_BigIntFMMContext *context, size_t len, const TEE_BigInt *modulus); - -/** - * @brief Calculates the necessary prerequisites for fast modular multiplication and stores them in a context. - * - * @param context Indicates the pointer to the TEE_BigIntFMMContext to initialize. - * @param len Indicates the size of the memory pointed to by context, in uint32_t. - * @param modulus Indicates the pointer to the modulus. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns other values if the operation fails. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntInitFMMContext1(TEE_BigIntFMMContext *context, size_t len, const TEE_BigInt *modulus); - -/** - * @brief Initializes a TEE_BigIntFMM and sets its represented value to zero. - * - * @param bigIntFMM Indicates the pointer to the TEE_BigIntFMM to initialize. - * @param len Indicates the size of the memory pointed to by bigIntFMM, in uint32_t. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntInitFMM(TEE_BigIntFMM *bigIntFMM, size_t len); - -/** - * @brief Converts an octet string buffer into the TEE_BigInt format. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result. - * @param buffer Indicates the pointer to the buffer that holds the octet string representation of the integer. - * @param bufferLen Indicates the buffer length, in bytes. - * @param sign Indicates the sign of dest, which is set to the sign of sign. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW if the memory allocated for dest is too small. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntConvertFromOctetString(TEE_BigInt *dest, const uint8_t *buffer, size_t bufferLen, int32_t sign); - -/** - * @brief Converts the absolute value of an integer in TEE_BigInt format into an octet string. - * - * @param buffer Indicates the pointer to the output buffer that holds the converted octet string representation - * of the integer. - * @param bufferLen Indicates the pointer to the buffer length, in bytes. - * @param bigInt Indicates the pointer to the integer to convert. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_SHORT_BUFFER if the output buffer is too small to hold the octet string. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntConvertToOctetString(void *buffer, size_t *bufferLen, const TEE_BigInt *bigInt); - -/** - * @brief Sets dest to the value shortVal. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result. - * @param shortVal Indicates the value to set. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntConvertFromS32(TEE_BigInt *dest, int32_t shortVal); - -/** - * @brief Sets dest to the value of src, including the sign of src. - * - * @param dest Indicates the pointer to the int32_t that holds the result. - * @param src Indicates the pointer to the value to set. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW if src does not fit within an int32_t. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntConvertToS32(int32_t *dest, const TEE_BigInt *src); - -/** - * @brief Checks whether op1 > op2, op1 == op2, or op1 < op2. - * - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @return Returns 0 if op1 == op2. - * Returns a positive number if op1 > op2. - * - * @since 12 - * @version 1.0 - */ -int32_t TEE_BigIntCmp(const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Checks whether op > shortVal, op == shortVal, or op < shortVal. - * - * @param op Indicates the pointer to the first operand. - * @param shortVal Indicates the pointer to the second operand. - * - * @return Returns 0 if op1 == shortVal. - * Returns a positive number if op1 > shortVal. - * - * @since 12 - * @version 1.0 - */ -int32_t TEE_BigIntCmpS32(const TEE_BigInt *op, int32_t shortVal); - -/** - * @brief Computes |dest| = |op| >> bits. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the shifted result. - * @param op Indicates the pointer to the operand to be shifted. - * @param bits Indicates the number of bits to shift. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntShiftRight(TEE_BigInt *dest, const TEE_BigInt *op, size_t bits); - -/** - * @brief Obtains the bitIndex bit of the natural binary representation of |src|. - * - * @param src Indicates the pointer to the integer. - * @param bitIndex Indicates the offset of the bit to read, starting from offset 0 of the least significant bit. - * - * @return Returns the Boolean value of bitIndexth in |src|. The value true represents a 1, - * and false represents a 0. - * - * @since 12 - * @version 1.0 - */ -bool TEE_BigIntGetBit(const TEE_BigInt *src, uint32_t bitIndex); - -/** - * @brief Obtains the number of bits in the natural binary representation of |src|, - * that is, the magnitude of src. - * - * @param src Indicates the pointer to the integer. - * - * @return Returns 0 if src is 0. - * Returns the number of bits in the natural binary representation of src. - * - * @since 12 - * @version 1.0 - */ -uint32_t TEE_BigIntGetBitCount(const TEE_BigInt *src); - -#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2) -/** - * @brief Sets the first bit of bitIndex in the natural binary representation of op to - * 1 or 0. - * - * @param op Indicates the pointer to the integer. - * @param bitIndex Indicates the offset of the bit to set, starting from offset 0 of the least significant bit. - * @param value Indicates the bit value to set. The value true represents a 1, and the value false - * represents a 0. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW bitIndexth if the bitIndexth bit is larger than the allocated bit - * length of op. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntSetBit(TEE_BigInt *op, uint32_t bitIndex, bool value); - -/** - * @brief Assigns the value of src to dest. - * - * @param dest Indicates the pointer to the TEE_BigInt to be assigned. - * @param src Indicates the pointer to the source operand. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW if the dest operand cannot hold the value of src. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntAssign(TEE_BigInt *dest, const TEE_BigInt *src); - -/** - * @brief Assigns the value of src to dest. - * - * @param dest Indicates the pointer to the TEE_BigInt to be assigned. - * @param src Indicates the pointer to the source operand. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW if the dest operand cannot hold the value of src. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntAbs(TEE_BigInt *dest, const TEE_BigInt *src); -#endif /* API_LEVEL */ - -/** - * @brief Computes dest = op1 + op2. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the sum of op1 and op2. - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntAdd(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Computes dest = op1 – op2. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the difference between op1 - * and op2. - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntSub(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Negates an operand: dest = –op. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result –op. - * @param op Indicates the pointer to the operand to be negated. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntNeg(TEE_BigInt *dest, const TEE_BigInt *op); - -/** - * @brief Computes dest = op1 * op2. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the product of op1 and op2. - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntMul(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Computes dest = op * op. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op * op. - * @param op Indicates the pointer to the operand to be squared. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntSquare(TEE_BigInt *dest, const TEE_BigInt *op); - -/** - * @brief Computes dest_r and dest_q to make op1 = dest_q* op2 + dest_r. - * - * @param dest_q Indicates the pointer to the TEE_BigInt that holds the quotient. - * @param dest_r Indicates the pointer to the TEE_BigInt that holds the remainder. - * @param op1 Indicates the pointer to the first operand, which is the dividend. - * @param op2 Indicates the pointer to the second operand, which is the divisor. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if at least one parameter is null. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntDiv(TEE_BigInt *dest_q, TEE_BigInt *dest_r, const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Computes dest = op (mod n) to make 0 <= dest < n. - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op (mod n). - * @param op Indicates the pointer to the operand to be reduced mod n. - * @param n [IN] Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n); - -/** - * @brief Computes dest = (op1 + op2) (mod n). - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op (op1 + op2)(mod n). - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * @param n Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntAddMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n); - -/** - * @brief Computes dest = (op1 – op2) (mod n). - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op (op1 – op2)(mod n). - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * @param n Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntSubMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n); - -/** - * @brief Computes dest = (op1* op2)(mod n). - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op (op1 * op2)(mod n). - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * @param n Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntMulMod(TEE_BigInt *dest, const TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n); - -/** - * @brief Computes dest = (op * op) (mod n). - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result op (op * op)(mod n). - * @param op Indicates the pointer to the operand. - * @param n [IN] Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntSquareMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n); - -/** - * @brief Computes dest to make dest* op = 1 (mod n). - * - * @param dest Indicates the pointer to the TEE_BigInt that holds the result (op^–1)(mod n). - * @param op Indicates the pointer to the operand. - * @param n [IN] Indicates the pointer to the modulus, which must be greater than 1. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntInvMod(TEE_BigInt *dest, const TEE_BigInt *op, const TEE_BigInt *n); - -/** - * @brief Checks whether gcd(op1, op2) == 1. - * - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @return Returns true if gcd(op1, op2) == 1. - * Returns false if gcd(op1, op2) != 1. - * - * @since 12 - * @version 1.0 - */ -bool TEE_BigIntRelativePrime(const TEE_BigInt *op1, const TEE_BigInt *op2); - -/** - * @brief Computes the greatest common divisor of op1 and op2. - * - * @param gcd Indicates the pointer to the TEE_BigInt that holds the greatest common divisor of op1 - * and op2. - * @param u Indicates the pointer to the TEE_BigInt that holds the first coefficient. - * @param v Indicates the pointer to the TEE_BigInt that holds the second coefficient. - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntComputeExtendedGcd(TEE_BigInt *gcd, TEE_BigInt *u, TEE_BigInt *v, const TEE_BigInt *op1, - const TEE_BigInt *op2); -/** - * @brief Performs a probabilistic primality test on op. - * - * @param op Indicates the pointer to the candidate number that is tested for primality. - * @param confidenceLevel Indicates the expected confidence level for a non-conclusive test. - * - * @return Returns 0 if op is a composite number. - * Returns 1 if op is a prime number. - * Returns –1 if the test is non-conclusive but the probability that op is composite is - * less than 2^(-confidenceLevel). - * - * @since 12 - * @version 1.0 - */ -int32_t TEE_BigIntIsProbablePrime(const TEE_BigInt *op, uint32_t confidenceLevel); - -/** - * @brief Converts src into a representation suitable for doing fast modular multiplication. - * - * @param dest Indicates the pointer to an initialized TEE_BigIntFMM memory area. - * @param src Indicates the pointer to the TEE_BigInt to convert. - * @param n Indicates the pointer to the modulus. - * @param context Indicates the pointer to the context that is previously initialized using - * {@link TEE_BigIntInitFMMContext1}. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntConvertToFMM(TEE_BigIntFMM *dest, const TEE_BigInt *src, const TEE_BigInt *n, - const TEE_BigIntFMMContext *context); - -/** - * @brief Converts src in the fast modular multiplication representation back to a - * TEE_BigInt representation. - * - * @param dest Indicates the pointer to an initialized TEE_BigIntFMM memory area to store the converted result. - * @param src Indicates the pointer to a TEE_BigIntFMM holding the value in the fast modular multiplication - * representation. - * @param n Indicates the pointer to the modulus. - * @param context Indicates the pointer to the context that is previously initialized using - * {@link TEE_BigIntInitFMMContext1}. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntConvertFromFMM(TEE_BigInt *dest, const TEE_BigIntFMM *src, const TEE_BigInt *n, - const TEE_BigIntFMMContext *context); - -/** - * @brief Computes dest = op1* op2 in the fast modular multiplication representation. - * - * @param dest Indicates the pointer to the TEE_BigIntFMM that holds the result op1* op2. - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * @param n Indicates the pointer to the modulus. - * @param context Indicates the pointer to the context that is previously initialized using - * {@link TEE_BigIntInitFMMContext1}. - * - * @since 12 - * @version 1.0 - */ -void TEE_BigIntComputeFMM(TEE_BigIntFMM *dest, const TEE_BigIntFMM *op1, const TEE_BigIntFMM *op2, const TEE_BigInt *n, - const TEE_BigIntFMMContext *context); - -/** - * @brief Computes dest = (op1 ^ op2)(mod n). - * - * @param des Indicates the pointer to the TEE_BigInt that holds the result (op1 ^ op2)(mod n). - * @param op1 Indicates the pointer to the first operand. - * @param op2 Indicates the pointer to the second operand. - * @param n Indicates the pointer to the modulus. - * @param context Indicates the pointer to the context that is previously initialized using - * {@link TEE_BigIntInitFMMContext1} or initialized to null. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_NOT_SUPPORTED if the value of n is not supported. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_BigIntExpMod(TEE_BigInt *des, TEE_BigInt *op1, const TEE_BigInt *op2, const TEE_BigInt *n, - TEE_BigIntFMMContext *context); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_client_api.h b/tee/include/tee_client_api.h deleted file mode 100644 index e9d0a614a1443d2f1c42ae3fb364485405704427..0000000000000000000000000000000000000000 --- a/tee/include/tee_client_api.h +++ /dev/null @@ -1,245 +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. - */ - -#ifndef TEE_CLIENT_API_H -#define TEE_CLIENT_API_H -/** - * @addtogroup TeeClient - * @{ - * - * @brief Provides APIs for the client applications (CAs) in the Rich Execution Environment (normal mode) to - * access the trusted applications (TAs) in a Trusted Execution Environment (TEE). - * - * @since 12 - * @version 1.0 - */ - -/** - * @file tee_client_api.h - * - * @brief Defines APIs for CAs to access TAs. - * - *

Example: - *

1. Initialize a TEE: Call TEEC_InitializeContext to initialize the TEE. - *

2. Open a session: Call TEEC_OpenSession with the Universal Unique Identifier (UUID) of the TA. - *

3. Send a command: Call TEEC_InvokeCommand to send a command to the TA. - *

4. Close the session: Call TEEC_CloseSession to close the session. - *

5. Close the TEE: Call TEEC_FinalizeContext to close the TEE. - * - * @library libteec.so - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include "tee_client_type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines the values of the parameters transmitted between the REE and TEE. - * - * @since 12 - * @version 1.0 - */ -#define TEEC_PARAM_TYPES(param0Type, param1Type, param2Type, param3Type) \ - ((param3Type) << 12 | (param2Type) << 8 | (param1Type) << 4 | (param0Type)) - -/** - * @brief Defines the value of the parameter specified by paramTypes and index. - * - * @since 12 - * @version 1.0 - */ -#define TEEC_PARAM_TYPE_GET(paramTypes, index) \ - (((paramTypes) >> (4*(index))) & 0x0F) - -/** - * @brief Initializes a TEE. - * - * The TEE must be initialized before a session is open or commands are sent. - * After the initialization, a connection is set up between the CA and the TEE. - * - * @param name [IN] Indicates the pointer to the TEE path. - * @param context [IN/OUT] Indicates the context pointer, which is the handle of the TEE. - * - * @return Returns {@code TEEC_SUCCESS} if the TEE is successfully initialized. - * Returns {@code TEEC_ERROR_BAD_PARAMETERS} if name is incorrect or context is null. - * Returns {@code TEEC_ERROR_GENERIC} if the available system resources are insufficient. - * - * @since 12 - * @version 1.0 - */ -TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context); - -/** - * @brief Closes the TEE. - * - * After the TEE is closed, the CA is disconnected from the TEE. - * - * @param context [IN/OUT] Indicates the pointer to the TEE that is successfully initialized. - * - * @since 12 - * @version 1.0 - */ -void TEEC_FinalizeContext(TEEC_Context *context); - -/** - * @brief Opens a session. - * - * This function is used to set up a connection between the CA and the TA of the specified UUID in the specified TEE - * context. The data to be transferred is contained in operation. - * If a session is opened successfully, session is returned providing a description of the connection. - * If the session fails to open, returnOrigin is returned indicating the cause of the failure. - * - * @param context [IN/OUT] Indicates the pointer to the TEE that is successfully initialized. - * @param session [OUT] Indicates the pointer to the session. The value cannot be null. - * @param destination [IN] Indicates the pointer to the UUID of the target TA. Each TA has a unique UUID. - * @param connectionMethod [IN] Indicates the connection method. For details, see {@link TEEC_LoginMethod}. - * @param connectionData [IN] Indicates the pointer to the connection data, which varies with the connection mode. - * If the connection mode is {@code TEEC_LOGIN_PUBLIC}, {@code TEEC_LOGIN_USER}, - * {@code TEEC_LOGIN_USER_APPLICATION}, or {@code TEEC_LOGIN_GROUP_APPLICATION}, the connection data must be null. - * If the connection mode is {@code TEEC_LOGIN_GROUP} or {@code TEEC_LOGIN_GROUP_APPLICATION}, - * the connection data must point to data of the uint32_t type, which indicates the target group user to be connected - * by the CA. - * @param operation [IN/OUT] Indicates the pointer to the data to be transmitted between the CA and TA. - * @param returnOrigin [IN/OUT] Indicates the pointer to the error source. - * For details, see {@code TEEC_ReturnCodeOrigin}. - * - * @return Returns {@code TEEC_SUCCESS} if the session is open successfully. - * Returns {@code TEEC_ERROR_BAD_PARAMETERS} if context, session, or destination is null. - * Returns {@code TEEC_ERROR_ACCESS_DENIED} if the access request is denied. - * Returns {@code TEEC_ERROR_OUT_OF_MEMORY} if the available system resources are insufficient. - * Returns {@code TEEC_ERROR_TRUSTED_APP_LOAD_ERROR} if the TA failed to be loaded. - * For details about other return values, see {@code TEEC_ReturnCode}. - * - * @since 12 - * @version 1.0 - */ -TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session, const TEEC_UUID *destination, - uint32_t connectionMethod, const void *connectionData, TEEC_Operation *operation, uint32_t *returnOrigin); - -/** - * @brief Closes a session. - * - * After the session is closed, the CA is disconnected from the TA. - * - * @param session [IN/OUT] Indicates the pointer to the session to close. - * - * @since 12 - * @version 1.0 - */ -void TEEC_CloseSession(TEEC_Session *session); - -/** - * @brief Sends a command to a TA. - * - * The CA sends the command ID to the TA through the specified session. - * - * @param session [IN/OUT] Indicates the pointer to the session opened. - * @param commandID [IN] Indicates the command ID supported by the TA. It is defined by the TA. - * @param operation [IN/OUT] Indicates the pointer to the data to be sent from the CA to the TA. - * @param returnOrigin [IN/OUT] Indicates the pointer to the error source. - * For details, see {@code TEEC_ReturnCodeOrigin}. - * - * @return Returns {@code TEEC_SUCCESS} if the command is sent successfully. - * Returns {@code TEEC_ERROR_BAD_PARAMETERS} if session is null or - * operation is in incorrect format. - * Returns {@code TEEC_ERROR_ACCESS_DENIED} if the access request is denied. - * Returns {@code TEEC_ERROR_OUT_OF_MEMORY} if the available system resources are insufficient. - * For details about other return values, see {@code TEEC_ReturnCode}. - * - * @since 12 - * @version 1.0 - */ -TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t commandID, - TEEC_Operation *operation, uint32_t *returnOrigin); - -/** - * @brief Registers shared memory in the specified TEE context. - * - * The registered shared memory can implement zero-copy. - * The zero-copy function, however, also requires support by the operating system. - * At present, zero-copy cannot be implemented in this manner. - * - * @param context [IN/OUT] Indicates the pointer to the TEE that is successfully initialized. - * @param sharedMem [IN/OUT] Indicates the pointer to the shared memory. - * The pointed shared memory cannot be null and the size cannot be 0. - * - * @return Returns {@code TEEC_SUCCESS} if the operation is successful. - * Returns {@code TEEC_ERROR_BAD_PARAMETERS} if context or sharedMem is null or - * the pointed memory is empty. - * - * @since 12 - * @version 1.0 - */ -TEEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context, TEEC_SharedMemory *sharedMem); - -/** - * @brief Requests shared memory in the specified TEE context. - * - * The shared memory can be used to implement zero-copy during data transmission between the REE and TEE. - * The zero-copy function, however, also requires support by the operating system. - * At present, zero-copy cannot be implemented in this manner. - * - * @attention If the size field of the input parameter sharedMem is set to 0, TEEC_SUCCESS - * will be returned but the shared memory cannot be used because this memory has neither an address nor size. - * @param context [IN/OUT] Indicates the pointer to the TEE that is successfully initialized. - * @param sharedMem [IN/OUT] Indicates the pointer to the shared memory. The size of the shared memory cannot be 0. - * - * @return Returns {@code TEEC_SUCCESS} if the operation is successful. - * Returns {@code TEEC_ERROR_BAD_PARAMETERS} if context or sharedMem is null. - * Returns {@code TEEC_ERROR_OUT_OF_MEMORY} if the available system resources are insufficient. - * - * @since 12 - * @version 1.0 - */ -TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context, TEEC_SharedMemory *sharedMem); - -/** - * @brief Releases the shared memory registered or acquired. - * - * @attention If the shared memory is acquired by using {@code TEEC_AllocateSharedMemory}, - * the memory released will be reclaimed. If the shared memory is acquired by using {@code TEEC_RegisterSharedMemory}, - * the local memory released will not be reclaimed. - * @param sharedMem [IN/OUT] Indicates the pointer to the shared memory to release. - * - * @since 12 - * @version 1.0 - */ -void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem); - -/** - * @brief Cancels an operation. - * - * @attention This operation is only used to send a cancel message. Whether to perform the cancel operation is - * determined by the TEE or TA. - * At present, the cancel operation does not take effect. - * @param operation [IN/OUT] Indicates the pointer to the data to be sent from the CA to the TA. - * - * @since 12 - * @version 1.0 - */ -void TEEC_RequestCancellation(TEEC_Operation *operation); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_client_constants.h b/tee/include/tee_client_constants.h deleted file mode 100644 index b66056ef9161e9c98b6f008c37db87642bb27f4a..0000000000000000000000000000000000000000 --- a/tee/include/tee_client_constants.h +++ /dev/null @@ -1,227 +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. - */ - -#ifndef TEE_CLIENT_CONSTANTS_H -#define TEE_CLIENT_CONSTANTS_H -/** - * @addtogroup TeeClient - * @{ - * - * @brief Provides APIs for the client applications (CAs) in the Rich Execution Environment (normal mode) to - * access the trusted applications (TAs) in a Trusted Execution Environment (TEE). - * - * @since 12 - * @version 1.0 - */ - -/** - * @file tee_client_constants.h - * - * @brief Defines public data and constants. - * - * @library libteec.so - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -/** - * @brief Defines the number of TEEC_Parameters in TEEC_Operation. - * - * @since 12 - * @version 1.0 - */ -#define TEEC_PARAM_NUM 4 - -/** - * @brief Defines the error codes returned. - * - * @since 12 - * @version 1.0 - */ -enum TEEC_ReturnCode { - /** The operation is successful. */ - TEEC_SUCCESS = 0x0, - /** Invalid command. The command is not supported by the TA. */ - TEEC_ERROR_INVALID_CMD, - /** The TA does not exist. */ - TEEC_ERROR_SERVICE_NOT_EXIST, - /** The session between the CA and TA does not exist. */ - TEEC_ERROR_SESSION_NOT_EXIST, - /** The number of connections to the TA has reached the limit. */ - TEEC_ERROR_SESSION_MAXIMUM, - /** The TA to be registered already exists. */ - TEEC_ERROR_REGISTER_EXIST_SERVICE, - /** Secure OS framework error. */ - TEEC_ERROR_TAGET_DEAD_FATAL, - /** Failed to read the file. */ - TEEC_ERROR_READ_DATA, - /** Failed to write the file. */ - TEEC_ERROR_WRITE_DATA, - /** Failed to truncate the file. */ - TEEC_ERROR_TRUNCATE_OBJECT, - /** Failed to seek data. */ - TEEC_ERROR_SEEK_DATA, - /** File synchronization error. */ - TEEC_ERROR_FSYNC_DATA, - /** Failed to rename the file. */ - TEEC_ERROR_RENAME_OBJECT, - /** Failed to load the TA when opening a session. */ - TEEC_ERROR_TRUSTED_APP_LOAD_ERROR, - /** Failed to initialize the TA. */ - TEEC_ERROR_GENERIC = 0xFFFF0000, - /** Permission verification failed. Permission verification is performed before a TEE or session is opened or - a command is sent. */ - TEEC_ERROR_ACCESS_DENIED = 0xFFFF0001, - /** The operation is canceled. This error code is returned when you operate the parameter with - the cancallation flag. */ - TEEC_ERROR_CANCEL = 0xFFFF0002, - /** Concurrent access causes permission conflict. Concurrent access to files in the trusted storage - service may cause this error. */ - TEEC_ERROR_ACCESS_CONFLICT = 0xFFFF0003, - /** Too much data is passed in the requested operation for the TA to parse. */ - TEEC_ERROR_EXCESS_DATA = 0xFFFF0004, - /** Incorrect data format. The TA failed to parse the parameters sent from the CA. */ - TEEC_ERROR_BAD_FORMAT = 0xFFFF0005, - /** Invalid parameter. The input parameter is null or invalid. */ - TEEC_ERROR_BAD_PARAMETERS = 0xFFFF0006, - /** The operation in the current state is invalid. This error code is returned if the trusted storage service is not - initialized when a trusted storage service operation is requested. */ - TEEC_ERROR_BAD_STATE = 0xFFFF0007, - /** The requested data is not found. */ - TEEC_ERROR_ITEM_NOT_FOUND = 0xFFFF0008, - /** The requested operation has not been implemented yet. This error code is returned when - TEEC_RequestCancellation is called. */ - TEEC_ERROR_NOT_IMPLEMENTED = 0xFFFF0009, - /** The requested operation is valid but is not supported in this implementation. This error code is returned - when certain algorithms of the secure encryption and decryption service, such as DSA, are requested. */ - TEEC_ERROR_NOT_SUPPORTED = 0xFFFF000A, - /** Expected data for the requested operation is not found. */ - TEEC_ERROR_NO_DATA = 0xFFFF000B, - /** The available system resources are insufficient. */ - TEEC_ERROR_OUT_OF_MEMORY = 0xFFFF000C, - /** The system is busy. Some resources are exclusively used by the system. */ - TEEC_ERROR_BUSY = 0xFFFF000D, - /** Communication between an application in the REE and a TA failed. */ - TEEC_ERROR_COMMUNICATION = 0xFFFF000E, - /** A security fault is detected in the TEE. */ - TEEC_ERROR_SECURITY = 0xFFFF000F, - /** The supplied buffer is too short for the output generated. - This error may occur when {@code TEEC_MEMREF_TEMP_OUTPUT} is used. */ - TEEC_ERROR_SHORT_BUFFER = 0xFFFF0010, - /** MAC value check error. */ - TEEC_ERROR_MAC_INVALID = 0xFFFF3071, - /** The TA crashed. */ - TEEC_ERROR_TARGET_DEAD = 0xFFFF3024, - /** Common error. */ - TEEC_FAIL = 0xFFFF5002 -}; - -/** - * @brief Defines the sources of the error codes returned. - * - * @since 12 - * @version 1.0 - */ -enum TEEC_ReturnCodeOrigin { - /** The error code indicates an error originated from the client API. */ - TEEC_ORIGIN_API = 0x1, - /** The error code indicates an error originated from the communication between the REE and TEE. */ - TEEC_ORIGIN_COMMS = 0x2, - /** The error code indicates an error originated within the TEE code. */ - TEEC_ORIGIN_TEE = 0x3, - /** The error code indicates an error originated within the TA code. */ - TEEC_ORIGIN_TRUSTED_APP = 0x4, -}; - -/** - * @brief Defines the identifiers of the shared memory. - * - * @since 12 - * @version 1.0 - */ -enum TEEC_SharedMemCtl { - /** The shared memory can carry data from CAs to TAs. */ - TEEC_MEM_INPUT = 0x1, - /** The shared memory can carry data from TAs to CAs. */ - TEEC_MEM_OUTPUT = 0x2, - /** The shared memory can carry data transmitted between CAs and TAs. */ - TEEC_MEM_INOUT = 0x3, -}; - -/** - * @brief Defines the parameter types. - * - * @since 12 - * @version 1.0 - */ -enum TEEC_ParamType { - /** The parameter is not used. */ - TEEC_NONE = 0x0, - /** The parameter is a {@code TEEC_Value} tagged as input. Data flows from a CA to a TA. */ - TEEC_VALUE_INPUT = 0x01, - /** The parameter is a {@code TEEC_Value} tagged as output. Data flows from a TA to a CA. */ - TEEC_VALUE_OUTPUT = 0x02, - /** The parameter is a {@code TEEC_Value} tagged as both input and output. */ - TEEC_VALUE_INOUT = 0x03, - /** The parameter is a {@code TEEC_TempMemoryReference} tagged as input. Data flows from a CA to a TA. */ - TEEC_MEMREF_TEMP_INPUT = 0x05, - /** The parameter is a {@code TEEC_TempMemoryReference} tagged as output. Data flows from a TA to a CA. */ - TEEC_MEMREF_TEMP_OUTPUT = 0x06, - /** The parameter is a {@code TEEC_TempMemoryReference} tagged as both input and output. - Data is transmitted between a TA and a CA. */ - TEEC_MEMREF_TEMP_INOUT = 0x07, - /** The parameter is a {@code TEEC_IonReference} tagged as input. Data flows from a CA to a TA**/ - TEEC_ION_INPUT = 0x08, - /** The parameter is a {@code TEEC_IonSglistReference} tagged as input. Data flows from a CA to a TA**/ - TEEC_ION_SGLIST_INPUT = 0x09, - /** The parameter is a {@code TEEC_RegisteredMemoryReference} that refers to the entire memory block. - The data flow is the same as that of {@code TEEC_SharedMemCtl}. */ - TEEC_MEMREF_WHOLE = 0xc, - /** The parameter is a {@code TEEC_RegisteredMemoryReference} tagged as input. Data flows from a CA to a TA. */ - TEEC_MEMREF_PARTIAL_INPUT = 0xd, - /** The parameter is a {@code TEEC_RegisteredMemoryReference} tagged as output. Data flows from a TA to a CA. */ - TEEC_MEMREF_PARTIAL_OUTPUT = 0xe, - /** The parameter is a {@code TEEC_RegisteredMemoryReference} tagged as both input and output. - Data is transmitted between a TA and a CA. */ - TEEC_MEMREF_PARTIAL_INOUT = 0xf -}; - -/** - * @brief Defines the login methods. - * - * @since 12 - * @version 1.0 -*/ -enum TEEC_LoginMethod { - /** No login data is provided. */ - TEEC_LOGIN_PUBLIC = 0x0, - /** The login data about the user running the CA process is provided. */ - TEEC_LOGIN_USER, - /** The login data about the group running the CA process is provided. */ - TEEC_LOGIN_GROUP, - /** The login data about the running CA is provided. */ - TEEC_LOGIN_APPLICATION = 0x4, - /** The login data about the user running the CA process and about the CA are provided. */ - TEEC_LOGIN_USER_APPLICATION = 0x5, - /** The login data about the group running the CA process and about the CA are provided. */ - TEEC_LOGIN_GROUP_APPLICATION = 0x6, - /** Login method reserved for TEEOS. */ - TEEC_LOGIN_IDENTIFY = 0x7, -}; - -/** @} */ -#endif diff --git a/tee/include/tee_client_type.h b/tee/include/tee_client_type.h deleted file mode 100644 index 5b89ceb8d407c6b1d9e2e3e1c4491f527c04bcc2..0000000000000000000000000000000000000000 --- a/tee/include/tee_client_type.h +++ /dev/null @@ -1,212 +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. - */ - -#ifndef TEE_CLIENT_TYPE_H -#define TEE_CLIENT_TYPE_H -/** - * @addtogroup TeeClient - * @{ - * - * @brief Provides APIs for the client applications (CAs) in the Rich Execution Environment (normal mode) to - * access the trusted applications (TAs) in a Trusted Execution Environment (TEE). - * - * @since 12 - * @version 1.0 - */ - -/** - * @file tee_client_type.h - * - * @brief Defines basic data types and data structures. - * - * @library libteec.so - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include -#include -#include -#include -#include "tee_client_constants.h" - -/** - * @brief Defines the linked list type. - * - * @since 12 - * @version 1.0 - */ -struct ListNode { - struct ListNode *next; - struct ListNode *prev; -}; - -/** - * @brief Defines the return values. - * - * @since 12 - * @version 1.0 - */ -typedef enum TEEC_ReturnCode TEEC_Result; - -/** - * @brief Defines the universally unique identifier (UUID) as defined in RFC4122 [2]. - * The UUIDs are used to identify TAs. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - uint32_t timeLow; - uint16_t timeMid; - uint16_t timeHiAndVersion; - uint8_t clockSeqAndNode[8]; -} TEEC_UUID; - -/** - * @brief Defines the context, a logical connection between a CA and a TEE. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - int32_t fd; - uint8_t *ta_path; - struct ListNode session_list; - struct ListNode shrd_mem_list; - union { - struct { - void *buffer; - sem_t buffer_barrier; - } share_buffer; - uint64_t imp; - }; -} TEEC_Context; - -/** - * @brief Defines the session between a CA and a TA. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - uint32_t session_id; - TEEC_UUID service_id; - uint32_t ops_cnt; - union { - struct ListNode head; - uint64_t imp; - }; - TEEC_Context *context; -} TEEC_Session; - -/** - * @brief Defines a shared memory block, which can be registered or allocated. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - void *buffer; - uint32_t size; - uint32_t flags; - uint32_t ops_cnt; - bool is_allocated; - union { - struct ListNode head; - void* imp; - }; - TEEC_Context *context; -} TEEC_SharedMemory; - -/** - * @brief Defines a pointer to a temporary buffer. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - void *buffer; - uint32_t size; -} TEEC_TempMemoryReference; - -/** - * @brief Defines a pointer to the shared memory that is registered or allocated. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - TEEC_SharedMemory *parent; - uint32_t size; - uint32_t offset; -} TEEC_RegisteredMemoryReference; - -/** - * @brief Describes a parameter that carries small raw data passed by value. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - uint32_t a; - uint32_t b; -} TEEC_Value; - -/** - * @brief Describes the size and handle of the ION memory. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - int ionShareFd; - uint32_t ionSize; -} TEEC_IonReference; - -/** - * @brief Defines a parameter of {@code TEEC_Operation}. - * - * @since 12 - * @version 1.0 - */ -typedef union { - TEEC_TempMemoryReference tmpref; - TEEC_RegisteredMemoryReference memref; - TEEC_Value value; - TEEC_IonReference ionref; -} TEEC_Parameter; - -/** - * @brief Defines the parameters for opening a session or sending a command. - * - * @since 12 - * @version 1.0 - */ -typedef struct { - /** The value 0 means to cancel the command, and other values mean to execute the command. */ - uint32_t started; - /** Use {@code TEEC_PARAM_TYPES} to create this parameter. */ - uint32_t paramTypes; - TEEC_Parameter params[TEEC_PARAM_NUM]; - TEEC_Session *session; - bool cancel_flag; -} TEEC_Operation; - -/** @} */ -#endif diff --git a/tee/include/tee_core_api.h b/tee/include/tee_core_api.h deleted file mode 100644 index 11a3b46d61c2889120c7403bcf5bf1d18fe3a4d9..0000000000000000000000000000000000000000 --- a/tee/include/tee_core_api.h +++ /dev/null @@ -1,124 +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. - */ - -#ifndef __TEE_CORE_API_H -#define __TEE_CORE_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - * @version 1.0 - */ - - /** - * @file tee_core_api.h - * - * @brief Provides APIs for managing trusted application (TA) sessions. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif -#ifndef _TEE_TA_SESSION_HANDLE -#define _TEE_TA_SESSION_HANDLE -/** - * @brief Defines the handle of TA session. - * - * @since 12 - */ -typedef uint32_t TEE_TASessionHandle; -#endif - -/** - * @brief Raises a panic in the TA instance. - * - * @param panicCode Indicates an informative panic code defined by the TA. - * - * @since 12 - * @version 1.0 - */ -void TEE_Panic(TEE_Result panicCode); - -/** - * @brief Opens a new session with a TA. - * - * @param destination Indicates the pointer to the TEE_UUID structure that contains - * the Universal Unique Identifier (UUID) of the target TA. - * @param cancellationRequestTimeout Indicates the timeout period in milliseconds or a special value - * if there is no timeout. - * @param paramTypes Indicates the types of all parameters passed in the operation. - * @param params Indicates the parameters passed in the operation. - * @param session Indicates the pointer to the variable that will receive the client session handle. - * @param returnOrigin Indicates the pointer to the variable that holds the return origin. - * - * @return Returns TEE_SUCCESS if the session is opened. - * Returns TEE_ERROR_ITEM_NOT_FOUND if the TA cannot be found in the Trusted Execution Environment (TEE). - * Returns TEE_ERROR_ACCESS_DENIED if the access request to the TA is denied. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_OpenTASession(const TEE_UUID *destination, uint32_t cancellationRequestTimeout, uint32_t paramTypes, - TEE_Param params[TEE_PARAMS_NUM], TEE_TASessionHandle *session, uint32_t *returnOrigin); - -/** - * @brief Closes a client session. - * - * @param session Indicates the handle of the session to close. - * - * @since 12 - * @version 1.0 - */ -void TEE_CloseTASession(TEE_TASessionHandle session); - -/** - * @brief Invokes a command in a session opened between this client TA instance and a target TA instance. - * - * @param session Indicates the handle of the opened session. - * @param cancellationRequestTimeout Indicates the timeout period in milliseconds or a special value - * if there is no timeout. - * @param commandID Indicates the identifier of the command to invoke. - * @param paramTypes Indicates the types of all parameters passed in the operation. - * @param params Indicates the parameters passed in the operation. - * @param returnOrigin Indicates the pointer to the variable that holds the return origin. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_ACCESS_DENIED if the command fails to be invoked. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_InvokeTACommand(TEE_TASessionHandle session, uint32_t cancellationRequestTimeout, uint32_t commandID, - uint32_t paramTypes, TEE_Param params[TEE_PARAMS_NUM], uint32_t *returnOrigin); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_crypto_api.h b/tee/include/tee_crypto_api.h deleted file mode 100644 index 1d0372e051dc5fbccb6497d6f3c9d082a0c4eb23..0000000000000000000000000000000000000000 --- a/tee/include/tee_crypto_api.h +++ /dev/null @@ -1,1045 +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. - */ - -#ifndef TEE_CRYPTO_API_H -#define TEE_CRYPTO_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_crypto_api.h - * - * @brief Provides APIs for cryptographic operations. - * - * You can use these APIs to implement encryption and decryption. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include /* pthread_mutex_t */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -/** - * @brief Definition of NULL. - * - * @since 12 - */ -#define NULL ((void *)0) -#endif -/** - * @brief Defines the maximum key length, in bits. - * - * @since 12 - */ -#define TEE_MAX_KEY_SIZE_IN_BITS (1024 * 8) -/** - * @brief Defines the length of the SW_RSA key, in bytes. - * - * @since 12 - */ -#define SW_RSA_KEYLEN 1024 -/** - * @brief Defines the maximum length of other Diffie-Hellman (DH) information, in bytes. - * - * @since 12 - */ -#define TEE_DH_MAX_SIZE_OF_OTHER_INFO 64 /* bytes */ - -/** - * @brief Enumerates the cryptographic operation handles. - * - * @since 12 - */ -enum __TEE_Operation_Constants { - /** Cipher */ - TEE_OPERATION_CIPHER = 0x1, - /** MAC */ - TEE_OPERATION_MAC = 3, - /** AE */ - TEE_OPERATION_AE = 4, - /** Digest */ - TEE_OPERATION_DIGEST = 5, - /** Asymmetric Cipher */ - TEE_OPERATION_ASYMMETRIC_CIPHER = 6, - /** Asymmetric Signature */ - TEE_OPERATION_ASYMMETRIC_SIGNATURE = 7, - /** Key Derivation */ - TEE_OPERATION_KEY_DERIVATION = 8, -}; - -/** - * @brief Enumerates the cryptographic algorithms. - * - * @since 12 - */ -enum __tee_crypto_algorithm_id { - /** Invalid algorithm */ - TEE_ALG_INVALID = 0x0, - /** AES_ECB_NOPAD */ - TEE_ALG_AES_ECB_NOPAD = 0x10000010, - /** AES_CBC_NOPAD */ - TEE_ALG_AES_CBC_NOPAD = 0x10000110, - /** AES_CTR */ - TEE_ALG_AES_CTR = 0x10000210, - /** AES_CTS */ - TEE_ALG_AES_CTS = 0x10000310, - /** AES_XTS */ - TEE_ALG_AES_XTS = 0x10000410, - /** AES_CBC_MAC_NOPAD */ - TEE_ALG_AES_CBC_MAC_NOPAD = 0x30000110, - /** AES_CBC_MAC_PKCS5 */ - TEE_ALG_AES_CBC_MAC_PKCS5 = 0x30000510, - /** AES_CMAC */ - TEE_ALG_AES_CMAC = 0x30000610, - /** AES_GMAC */ - TEE_ALG_AES_GMAC = 0x30000810, - /** AES_CCM */ - TEE_ALG_AES_CCM = 0x40000710, - /** AES_GCM */ - TEE_ALG_AES_GCM = 0x40000810, - /** DES_ECB_NOPAD */ - TEE_ALG_DES_ECB_NOPAD = 0x10000011, - /** DES_CBC_NOPAD */ - TEE_ALG_DES_CBC_NOPAD = 0x10000111, - /** DES_CBC_MAC_NOPAD */ - TEE_ALG_DES_CBC_MAC_NOPAD = 0x30000111, - /** DES_CBC_MAC_PKCS5 */ - TEE_ALG_DES_CBC_MAC_PKCS5 = 0x30000511, - /** DES3_ECB_NOPAD */ - TEE_ALG_DES3_ECB_NOPAD = 0x10000013, - /** DES3_CBC_NOPAD */ - TEE_ALG_DES3_CBC_NOPAD = 0x10000113, - /** DES3_CBC_MAC_NOPAD */ - TEE_ALG_DES3_CBC_MAC_NOPAD = 0x30000113, - /** DES3_CBC_MAC_PKCS5 */ - TEE_ALG_DES3_CBC_MAC_PKCS5 = 0x30000513, - /** RSASSA_PKCS1_V1_5_MD5 */ - TEE_ALG_RSASSA_PKCS1_V1_5_MD5 = 0x70001830, - /** RSASSA_PKCS1_V1_5_SHA1 */ - TEE_ALG_RSASSA_PKCS1_V1_5_SHA1 = 0x70002830, - /** RSASSA_PKCS1_V1_5_SHA224 */ - TEE_ALG_RSASSA_PKCS1_V1_5_SHA224 = 0x70003830, - /** RSASSA_PKCS1_V1_5_SHA256 */ - TEE_ALG_RSASSA_PKCS1_V1_5_SHA256 = 0x70004830, - /** RSASSA_PKCS1_V1_5_SHA384 */ - TEE_ALG_RSASSA_PKCS1_V1_5_SHA384 = 0x70005830, - /** RSASSA_PKCS1_V1_5_SHA512 */ - TEE_ALG_RSASSA_PKCS1_V1_5_SHA512 = 0x70006830, - /** RSASSA_PKCS1_PSS_MGF1_MD5 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_MD5 = 0x70111930, - /** RSASSA_PKCS1_PSS_MGF1_SHA1 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1 = 0x70212930, - /** RSASSA_PKCS1_PSS_MGF1_SHA224 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224 = 0x70313930, - /** RSASSA_PKCS1_PSS_MGF1_SHA256 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256 = 0x70414930, - /** RSASSA_PKCS1_PSS_MGF1_SHA384 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384 = 0x70515930, - /** RSASSA_PKCS1_PSS_MGF1_SHA512 */ - TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512 = 0x70616930, - /** RSAES_PKCS1_V1_5 */ - TEE_ALG_RSAES_PKCS1_V1_5 = 0x60000130, - /** RSAES_PKCS1_OAEP_MGF1_SHA1 */ - TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1 = 0x60210230, - /** RSAES_PKCS1_OAEP_MGF1_SHA224 */ - TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224 = 0x60211230, - /** RSAES_PKCS1_OAEP_MGF1_SHA256 */ - TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256 = 0x60212230, - /** RSAES_PKCS1_OAEP_MGF1_SHA384 */ - TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384 = 0x60213230, - /** RSAES_PKCS1_OAEP_MGF1_SHA512 */ - TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512 = 0x60214230, - /** RSA_NOPAD */ - TEE_ALG_RSA_NOPAD = 0x60000030, - /** DSA_SHA1 */ - TEE_ALG_DSA_SHA1 = 0x70002131, - /** DSA_SHA224 */ - TEE_ALG_DSA_SHA224 = 0x70003131, - /** DSA_SHA256 */ - TEE_ALG_DSA_SHA256 = 0x70004131, - /** DH_DERIVE_SHARED_SECRET */ - TEE_ALG_DH_DERIVE_SHARED_SECRET = 0x80000032, - /** MD5 */ - TEE_ALG_MD5 = 0x50000001, - /** SHA1 */ - TEE_ALG_SHA1 = 0x50000002, - /** SHA224 */ - TEE_ALG_SHA224 = 0x50000003, - /** SHA256 */ - TEE_ALG_SHA256 = 0x50000004, - /** SHA384 */ - TEE_ALG_SHA384 = 0x50000005, - /** SHA512 */ - TEE_ALG_SHA512 = 0x50000006, - /** HMAC_MD5 */ - TEE_ALG_HMAC_MD5 = 0x30000001, - /** HMAC_SHA1 */ - TEE_ALG_HMAC_SHA1 = 0x30000002, - /** HMAC_SHA1 */ - TEE_ALG_HMAC_SHA224 = 0x30000003, - /** HMAC_SHA224 */ - TEE_ALG_HMAC_SHA256 = 0x30000004, - /** HMAC_SHA256 */ - TEE_ALG_HMAC_SHA384 = 0x30000005, - /** HMAC_SHA384 */ - TEE_ALG_HMAC_SHA512 = 0x30000006, - /** HMAC_SHA512 */ - TEE_ALG_HMAC_SM3 = 0x30000007, - /** HMAC_SM3 */ - TEE_ALG_AES_ECB_PKCS5 = 0x10000020, - /** AES_ECB_PKCS5 */ - TEE_ALG_AES_CBC_PKCS5 = 0x10000220, - /** AES_CBC_PKCS5 */ - TEE_ALG_ECDSA_SHA1 = 0x70001042, - /** ECDSA_SHA1 */ - TEE_ALG_ECDSA_SHA224 = 0x70002042, - /** ECDSA_SHA224 */ - TEE_ALG_ECDSA_SHA256 = 0x70003042, - /** ECDSA_SHA256 */ - TEE_ALG_ECDSA_SHA384 = 0x70004042, - /** ECDSA_SHA384 */ - TEE_ALG_ECDSA_SHA512 = 0x70005042, - /** ECDSA_SHA512 */ - TEE_ALG_ED25519 = 0x70005043, - /** ED25519 */ - TEE_ALG_ECDH_DERIVE_SHARED_SECRET = 0x80000042, - /** ECDH_DERIVE_SHARED_SECRET */ - TEE_ALG_X25519 = 0x80000044, - /** X25519 */ - TEE_ALG_ECC = 0x80000001, - /** ECC */ - TEE_ALG_ECDSA_P192 = 0x70001042, - /** ECDSA_P192 */ - TEE_ALG_ECDSA_P224 = 0x70002042, - /** ECDSA_P224 */ - TEE_ALG_ECDSA_P256 = 0x70003042, - /** ECDSA_P256 */ - TEE_ALG_ECDSA_P384 = 0x70004042, - /** ECDSA_P521 */ - TEE_ALG_ECDSA_P521 = 0x70005042, - /** ECDH_P192 */ - TEE_ALG_ECDH_P192 = 0x80001042, - /** ECDH_P224 */ - TEE_ALG_ECDH_P224 = 0x80002042, - /** ECDH_P256 */ - TEE_ALG_ECDH_P256 = 0x80003042, - /** ECDH_P384 */ - TEE_ALG_ECDH_P384 = 0x80004042, - /** ECDH_P521 */ - TEE_ALG_ECDH_P521 = 0x80005042, - /** SIP_HASH */ - TEE_ALG_SIP_HASH = 0xF0000002, - /** SM2_DSA_SM3 */ - TEE_ALG_SM2_DSA_SM3 = 0x70006045, - /** SM2_PKE */ - TEE_ALG_SM2_PKE = 0x80000045, - /** SM3 */ - TEE_ALG_SM3 = 0x50000007, - /** SM4_ECB_NOPAD */ - TEE_ALG_SM4_ECB_NOPAD = 0x10000014, - /** SM4_CBC_NOPAD */ - TEE_ALG_SM4_CBC_NOPAD = 0x10000114, - /** SM4_CBC_PKCS7 */ - TEE_ALG_SM4_CBC_PKCS7 = 0xF0000003, - /** SM4_CTR */ - TEE_ALG_SM4_CTR = 0x10000214, - /** SM4_CFB128 */ - TEE_ALG_SM4_CFB128 = 0xF0000000, - /** SM4_XTS */ - TEE_ALG_SM4_XTS = 0x10000414, - /** SM4_OFB */ - TEE_ALG_SM4_OFB = 0x10000514, - /** AES_OFB */ - TEE_ALG_AES_OFB = 0x10000510, - /** SM4_GCM */ - TEE_ALG_SM4_GCM = 0xF0000005, -}; - -/** - * @see __tee_crypto_algorithm_id - */ -typedef enum __tee_crypto_algorithm_id tee_crypto_algorithm_id; -/** - * @brief No element is available. - * - * @since 12 - */ -#define TEE_OPTIONAL_ELEMENT_NONE 0x00000000 - -/** - * @brief Enumerates the Elliptic-Curve Cryptography (ECC) curves supported. - * - * @since 12 - */ -typedef enum { - /** CURVE_NIST_P192 */ - TEE_ECC_CURVE_NIST_P192 = 0x00000001, - /** CURVE_NIST_P224 */ - TEE_ECC_CURVE_NIST_P224 = 0x00000002, - /** CURVE_NIST_P256 */ - TEE_ECC_CURVE_NIST_P256 = 0x00000003, - /** CURVE_NIST_P384 */ - TEE_ECC_CURVE_NIST_P384 = 0x00000004, - /** CURVE_NIST_P521 */ - TEE_ECC_CURVE_NIST_P521 = 0x00000005, - /** CURVE_SM2 256 bits */ - TEE_ECC_CURVE_SM2 = 0x00000300, - /** CURVE_25519 256 bits */ - TEE_ECC_CURVE_25519 = 0x00000200, -} TEE_ECC_CURVE; - -/** - * @brief Enumerates the Mask Generation Function (MGF1) modes. - * - * @since 12 - */ -typedef enum { - TEE_DH_HASH_SHA1_mode = 0, - TEE_DH_HASH_SHA224_mode = 1, - TEE_DH_HASH_SHA256_mode = 2, - TEE_DH_HASH_SHA384_mode = 3, - TEE_DH_HASH_SHA512_mode = 4, - TEE_DH_HASH_NumOfModes, -} TEE_DH_HASH_Mode; - -/** - * @brief Enumerates the cryptographic operation modes. - * - * @since 12 - */ -enum __TEE_OperationMode { - /** Encryption */ - TEE_MODE_ENCRYPT = 0x0, - /** Decryption */ - TEE_MODE_DECRYPT, - /** Signing */ - TEE_MODE_SIGN, - /** Signature verification */ - TEE_MODE_VERIFY, - /** MAC */ - TEE_MODE_MAC, - /** Digest */ - TEE_MODE_DIGEST, - /** Key derivation */ - TEE_MODE_DERIVE -}; - -/** - * @brief Enumerates the cryptographic operation states. - * - * @since 12 - */ -enum tee_operation_state { - /** Initial */ - TEE_OPERATION_STATE_INITIAL = 0x00000000, - /** Active */ - TEE_OPERATION_STATE_ACTIVE = 0x00000001, -}; - -/** - * @see __TEE_OperationMode - */ -typedef uint32_t TEE_OperationMode; - -/** - * @brief Defines the operation information. - * - * @since 12 - */ -struct __TEE_OperationInfo { - /** Algorithm ID */ - uint32_t algorithm; /* #__TEE_CRYPTO_ALGORITHM_ID */ - /** Operation type */ - uint32_t operationClass; /* #__TEE_Operation_Constants */ - /** Operation mode */ - uint32_t mode; /* #__TEE_OperationMode */ - /** Digest length */ - uint32_t digestLength; - /** Maximum key length */ - uint32_t maxKeySize; - /** Key length*/ - uint32_t keySize; - /** Required key usage */ - uint32_t requiredKeyUsage; - /** Handle state */ - uint32_t handleState; - /** Key */ - void *keyValue; -}; - -/** - * @brief Defines the __TEE_OperationInfo struct. - * - * @see __TEE_OperationInfo - */ -typedef struct __TEE_OperationInfo TEE_OperationInfo; - -/** - * @brief Defines the key information stored in the OperationInfo. - * - * @since 12 - */ -typedef struct { - /** Key length */ - uint32_t keySize; - /** Required key usage */ - uint32_t requiredKeyUsage; -} TEE_OperationInfoKey; - -/** - * @brief Defines information about an operation. - * - * @since 12 - */ -typedef struct { - /** Algorithm ID */ - uint32_t algorithm; - /** Operation type */ - uint32_t operationClass; - /** Operation mode */ - uint32_t mode; - /** Digest length */ - uint32_t digestLength; - /** Maximum key length */ - uint32_t maxKeySize; - /** Handle state */ - uint32_t handleState; - /** Operation state */ - uint32_t operationState; - /** Number of keys */ - uint32_t numberOfKeys; - /** Key information */ - TEE_OperationInfoKey keyInformation[]; -} TEE_OperationInfoMultiple; - -/** - * @brief Defines the cryptographic operation handle. - * - * @since 12 - */ -struct __TEE_OperationHandle { - /** Algorithm ID */ - uint32_t algorithm; - /** Operation type */ - uint32_t operationClass; - /** Operation mode */ - uint32_t mode; - /** Digest length */ - uint32_t digestLength; - /** Maximum key length */ - uint32_t maxKeySize; - /** Key length */ - uint32_t keySize; - /** Key length */ - uint32_t keySize2; - /** Required key usage */ - uint32_t requiredKeyUsage; - /** Handle state */ - uint32_t handleState; - /** Key */ - void *keyValue; - /** Key */ - void *keyValue2; - /** */ - void *crypto_ctxt; - /** */ - void *hmac_rest_ctext; - /** iv */ - void *IV; - /** Public key */ - void *publicKey; - /** Length of the public key */ - uint32_t publicKeyLen; - /** Private key */ - void *privateKey; - /** Length of the private key */ - uint32_t privateKeyLen; - /** Length of the IV */ - uint32_t IVLen; - /** Operation lock */ - pthread_mutex_t operation_lock; - /** HAL information */ - void *hal_info; -}; - -/** - * @brief Defines the data used for conversion of integers. - * - * @since 12 - */ -typedef struct { - /** Source */ - uint32_t src; - /** Destination */ - uint32_t dest; -} crypto_uint2uint; - -/** - * @brief Defines the maximum length of an RSA public key. - * - * @since 12 - */ -#define RSA_PUBKEY_MAXSIZE sizeof(CRYS_RSAUserPubKey_t) -/** - * @brief Defines the maximum length of an RES private key. - * - * @since 12 - */ -#define RSA_PRIVKEY_MAXSIZE sizeof(CRYS_RSAUserPrivKey_t) - -/** - * @brief Defines a structure to hold the input and output data. - * - * @since 12 - */ -typedef struct { - /** Source data */ - void *src_data; - /** Length of the source data */ - size_t src_len; - /** Destination data */ - void *dest_data; - /** Length of the destination data */ - size_t *dest_len; -} operation_src_dest; - -/** - * @brief Defines the AE initialization data. - * - * @since 12 - */ -typedef struct { - /** nonce */ - void *nonce; - /** Leng of nonce */ - size_t nonce_len; - /** Length of the tag */ - uint32_t tag_len; - /** Length of the additional authenticated data (AAD) */ - size_t aad_len; - /** Length of the payload */ - size_t payload_len; -} operation_ae_init; - -/** - * @brief Defines the pointer to __TEE_OperationHandle. - * - * @see __TEE_OperationHandle - * - * @since 12 - */ -typedef struct __TEE_OperationHandle *TEE_OperationHandle; - -/** - * @brief Defines the __TEE_OperationHandle struct. - * - * @see __TEE_OperationHandle - * - * @since 12 - */ -typedef struct __TEE_OperationHandle TEE_OperationHandleVar; - -/** - * @brief Defines the __TEE_ObjectHandle struct. - * - * @since 12 - */ -typedef struct __TEE_ObjectHandle TEE_ObjectHandleVar; - -/** - * @brief Allocates an operation handle. - * - * @param operation Indicates the pointer to the operation handle. - * @param algorithm Indicates the cipher algorithm. - * @param mode Indicates the operation mode. - * @param maxKeySize Indicates the maximum length of the key. - * - * @return Returns TEE_SUCCESS if the operation handle is allocated. - * Returns TEE_ERROR_OUT_OF_MEMORY if there is no enough memory for this operation. - * Returns TEE_ERROR_NOT_SUPPORTED if the specified algorithm is not supported. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AllocateOperation(TEE_OperationHandle *operation, uint32_t algorithm, uint32_t mode, - uint32_t maxKeySize); - -/** - * @brief Releases an operation handle. - * - * @param operation Indicates the operation handle to release. - * - * @since 12 - * @version 1.0 - */ -void TEE_FreeOperation(TEE_OperationHandle operation); - -/** - * @brief Obtains operation information. - * - * @param operation Indicates the operation handle. - * @param operationInfo Indicates the pointer to the operation information. - * - * @since 12 - * @version 1.0 - */ -void TEE_GetOperationInfo(const TEE_OperationHandle operation, TEE_OperationInfo *operationInfo); - -/** - * @brief Resets an operation handle. - * - * @param operation Indicates the operation handle to reset. - * - * @since 12 - * @version 1.0 - */ -void TEE_ResetOperation(TEE_OperationHandle operation); - -/** - * @brief Sets the key for an operation. - * - * @param operation Indicates the operation handle. - * @param key Indicates the key. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_OUT_OF_MEMORY if there is no enough memory for this operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SetOperationKey(TEE_OperationHandle operation, const TEE_ObjectHandle key); - -/** - * @brief Sets two keys for an operation. - * - * @param operation Indicates the operation handle. - * @param key1 Indicates key 1. - * @param key2 Indicates key 2. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SetOperationKey2(TEE_OperationHandle operation, const TEE_ObjectHandle key1, - const TEE_ObjectHandle key2); - -/** - * @brief Copies an operation handle. - * - * @param dstOperation Indicates the destination operation handle. - * @param srcOperation Indicates the source operation handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_CopyOperation(TEE_OperationHandle dstOperation, const TEE_OperationHandle srcOperation); - -/** - * @brief Initializes the context to start a cipher operation. - * - * @param operation Indicates the operation handle. - * @param IV Indicates the pointer to the buffer storing the operation IV. If this parameter is not used, - * set it to NULL. - * @param IVLen Indicates the length of the IV buffer. - * - * @since 12 - * @version 1.0 - */ -void TEE_CipherInit(TEE_OperationHandle operation, const void *IV, size_t IVLen); - -/** - * @brief Updates the data for a cipher operation. - * - * @param operation Indicates the operation handle. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_CipherUpdate(TEE_OperationHandle operation, const void *srcData, size_t srcLen, void *destData, - size_t *destLen); - -/** - * @brief Finalizes a cipher operation. - * - * @param operation Indicates the operation handle. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_CipherDoFinal(TEE_OperationHandle operation, const void *srcData, size_t srcLen, void *destData, - size_t *destLen); - -/** - * @brief Updates the digest. - * - * @param operation Indicates the operation handle. - * @param chunk Indicates the pointer to the chunk of data to be hashed. - * @param chunkSize Indicates the length of the chunk. - * - * @since 12 - * @version 1.0 - */ -void TEE_DigestUpdate(TEE_OperationHandle operation, const void *chunk, size_t chunkSize); - -/** - * @brief Finalizes the message digest operation. - * - * @param operation Indicates the operation handle. - * @param chunk Indicates the pointer to the chunk of data to be hashed. - * @param chunkLen Indicates the length of the chunk. - * @param hash Indicates the pointer to the buffer storing the message hash. - * @param hashLen - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_DigestDoFinal(TEE_OperationHandle operation, const void *chunk, size_t chunkLen, void *hash, - size_t *hashLen); - -/** - * @brief Initializes a MAC operation. - * - * @param operation Indicates the operation handle. - * @param IV Indicates the pointer to the buffer storing the operation IV. If this parameter is not used, - * set it to NULL. - * @param IVLen Indicates the length of the IV buffer. - * - * @since 12 - * @version 1.0 - */ -void TEE_MACInit(TEE_OperationHandle operation, void *IV, size_t IVLen); - -/** - * @brief Updates the MAC. - * - * @param operation Indicates the operation handle. - * @param chunk Indicates the pointer to the chunk of MAC data. - * @param chunkSize Indicates the size of the chunk. - * - * @since 12 - * @version 1.0 - */ -void TEE_MACUpdate(TEE_OperationHandle operation, const void *chunk, size_t chunkSize); - -/** - * @brief MAC Finalizes the MAC operation with a last chunk of message and computes the MAC. - * - * @param operation Indicates the operation handle. - * @param message Indicates the pointer to the buffer containing the last message chunk to MAC. - * @param messageLen Indicates the length of the message buffer. - * @param mac Indicates the pointer to the buffer storing the computed MAC. - * @param macLen Indicates the pointer to the MAC buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_MACComputeFinal(TEE_OperationHandle operation, const void *message, size_t messageLen, void *mac, - size_t *macLen); - -/** - * @brief Finalizes the MAC operation and compares the MAC with the one passed in. - * - * @param operation Indicates the operation handle. - * @param message Indicates the pointer to the buffer containing the last message chunk to MAC. - * @param messageLen Indicates the length of the buffer. - * @param mac Indicates the pointer to the buffer storing the computed MAC. - * @param macLen Indicates the MAC buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * Returns TEE_ERROR_MAC_INVALID if the computed MAC is not the same as that passed in. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_MACCompareFinal(TEE_OperationHandle operation, const void *message, size_t messageLen, const void *mac, - const size_t macLen); - -/** - * @brief Derives a key. - * - * @param operation Indicates the operation handle. - * @param params Indicates the pointer to the parameters for this operation. - * @param paramCount Indicates the number of parameters. - * @param derivedKey Indicates the derived key. - * - * @since 12 - * @version 1.0 - */ -void TEE_DeriveKey(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount, - TEE_ObjectHandle derivedKey); - -/** - * @brief Generates random data. - * - * @param randomBuffer Indicates the pointer to the buffer storing the random data generated. - * @param randomBufferLen Indicates the length of the buffer storing the random data. - * - * @since 12 - * @version 1.0 - */ -void TEE_GenerateRandom(void *randomBuffer, size_t randomBufferLen); - -/** - * @brief Initializes an AE operation. - * - * @param operation Indicates the operation handle. - * @param nonce Indicates the pointer to the buffer for storing the nonce. - * @param nonceLen Indicates the length of the nonce. - * @param tagLen Indicates the length of the tag. - * @param AADLen Indicates the length of the AAD. - * @param payloadLen Indicates the length of the payload. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AEInit(TEE_OperationHandle operation, void *nonce, size_t nonceLen, uint32_t tagLen, size_t AADLen, - size_t payloadLen); - -/** - * @brief Updates the AAD in an AE operation. - * - * @param operation Indicates the operation handle. - * @param AADdata Indicates the pointer to the new AAD. - * @param AADdataLen Indicates the length of the new AAD. - * - * @since 12 - * @version 1.0 - */ -void TEE_AEUpdateAAD(TEE_OperationHandle operation, const void *AADdata, size_t AADdataLen); - -/** - * @brief Updates data for an AE operation. - * - * @param operation Indicates the operation handle. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AEUpdate(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, size_t *destLen); - -/** - * @brief Finalizes the AE encryption operation. - * - * @param operation Indicates the operation handle. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * @param tag Indicates the pointer to the buffer storing the computed tag. - * @param tagLen Indicates the pointer to the tag buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AEEncryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, - size_t *destLen, void *tag, size_t *tagLen); - -/** - * @brief Finalizes an AE decryption operation. - * - * @param operation Indicates the operation handle. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * @param tag Indicates the pointer to the buffer storing the computed tag. - * @param tagLen Indicates the tag buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_MAC_INVALID if the computed tag does not match the provided tag. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AEDecryptFinal(TEE_OperationHandle operation, void *srcData, size_t srcLen, void *destData, - size_t *destLen, void *tag, size_t tagLen); - -/** - * @brief Performs asymmetric encryption. - * - * @param operation Indicates the operation handle. - * @param params Indicates the pointer to the parameters for this operation. - * @param paramCount Indicates the number of parameters. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AsymmetricEncrypt(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount, - void *srcData, size_t srcLen, void *destData, size_t *destLen); - -/** - * @brief Performs asymmetric decryption. - * - * @param operation Indicates the operation handle. - * @param params Indicates the pointer to the parameters for this operation. - * @param paramCount Indicates the number of parameters. - * @param srcData Indicates the pointer to the source data. - * @param srcLen Indicates the length of the source data. - * @param destData Indicates the pointer to the destination data. - * @param destLen Indicates the pointer to the destination data length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AsymmetricDecrypt(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount, - void *srcData, size_t srcLen, void *destData, size_t *destLen); - -/** - * @brief Signs a message digest in an asymmetric operation. - * - * @param operation Indicates the operation handle. - * @param params Indicates the pointer to the parameters for this operation. - * @param paramCount Indicates the number of parameters. - * @param digest Indicates the pointer to the message digest. - * @param digestLen Indicates the digest length. - * @param signature Indicates the pointer to the signature. - * @param signatureLen Indicates the pointer to the signature length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AsymmetricSignDigest(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount, - void *digest, size_t digestLen, void *signature, size_t *signatureLen); - -/** - * @brief Verifies a message digest signature in an asymmetric operation. - * - * @param operation Indicates the operation handle. - * @param params Indicates the pointer to the parameters for this operation. - * @param paramCount Indicates the number of parameters. - * @param digest Indicates the pointer to the message digest. - * @param digestLen Indicates the digest length. - * @param signature Indicates the pointer to the signature. - * @param signatureLen Indicates the signature length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_GENERIC if the operation fails due to other errors. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AsymmetricVerifyDigest(TEE_OperationHandle operation, const TEE_Attribute *params, uint32_t paramCount, - void *digest, size_t digestLen, void *signature, size_t signatureLen); - -/** - * @brief Obtains information about the operation involving multiple keys. - * - * @param operation Indicates the operation handle. - * @param operationInfoMultiple Indicates the pointer to the operation information obtained. - * @param operationSize [IN/OUT] Indicates the pointer to the operation information size. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if the operation fails due to invalid parameters. - * Returns TEE_ERROR_SHORT_BUFFER if the operationInfo buffer is not large enough to - * hold the information obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetOperationInfoMultiple(TEE_OperationHandle operation, TEE_OperationInfoMultiple *operationInfoMultiple, - const size_t *operationSize); - -/** - * @brief Checks whether the algorithm is supported. - * - * @param algId Indicates the algorithm to check. - * @param element Indicates the cryptographic element. - * - * @return Returns TEE_SUCCESS if the algorithm is supported. - * Returns TEE_ERROR_NOT_SUPPORTED otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_IsAlgorithmSupported(uint32_t algId, uint32_t element); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_crypto_hal.h b/tee/include/tee_crypto_hal.h deleted file mode 100644 index 6ae67f9a99ff5f8a19a4fc382dc45f24f9c064f7..0000000000000000000000000000000000000000 --- a/tee/include/tee_crypto_hal.h +++ /dev/null @@ -1,93 +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. - */ - -#ifndef TEE_CRYPTO_HAL_H -#define TEE_CRYPTO_HAL_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_crypto_hal.h - * - * @brief Provides APIs for cryptographic operations. - * - * You can use these APIs to implement encryption and decryption. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_crypto_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Enumerates the types of the crypto engine. - * - * @since 12 - */ -enum CRYPTO_ENGINE { - SOFT_CRYPTO = 2, - CRYPTO_ENGINE_MAX = 1024, -}; - -/** - * @brief Sets the encryption and decryption engines to an operation. - * - * @param operation Indicates the handle of the operation to set. - * @param crypto Indicates the engines to set. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if operation is null or crypto is invalid. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SetCryptoFlag(TEE_OperationHandle operation, uint32_t crypto); - -/** - * @brief Sets the encryption and decryption engines to an object. - * - * @param object Indicates the handle of the object to set. - * @param crypto Indicates the engines to set. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_BAD_PARAMETERS if object is null or crypto is invalid. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SetObjectFlag(TEE_ObjectHandle object, uint32_t crypto); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif - diff --git a/tee/include/tee_defines.h b/tee/include/tee_defines.h deleted file mode 100644 index e427afd1209e8dcecb4df8aa5fc8c5c62aecff4b..0000000000000000000000000000000000000000 --- a/tee/include/tee_defines.h +++ /dev/null @@ -1,607 +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. - */ - -#ifndef __TEE_DEFINES_H -#define __TEE_DEFINES_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_defines.h - * - * @brief Defines basic data types and data structures of TEE. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -#ifndef TA_EXPORT -#define TA_EXPORT -#endif - -/** - * @brief Defines the tee mutex handle. - * - * @since 12 - */ -typedef int *tee_mutex_handle; - -#define API_LEVEL1_1_1 2 -#define API_LEVEL1_2 3 - -#define TEE_PARAMS_NUM 4 -#undef true -#define true 1 - -#undef false -#define false 0 - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#define PARAM_NOT_USED(val) ((void)(val)) - -/** - * @brief Enumerates the TEE parameter. - * - * @since 12 - */ -typedef union { - struct { - void *buffer; - size_t size; - } memref; - struct { - unsigned int a; - unsigned int b; - } value; - struct { - void *buffer; - size_t size; - } sharedmem; -} TEE_Param; - -#define TEE_PARAM_TYPES(param0Type, param1Type, param2Type, param3Type) \ - (((param3Type) << 12) | ((param2Type) << 8) | ((param1Type) << 4) | (param0Type)) - -#define TEE_PARAM_TYPE_GET(paramTypes, index) (((paramTypes) >> (4U * (index))) & 0x0F) - -/** - * @brief Checks parameter types. - * - * @param param_to_check Indicates the expected parameter values. - * @param valid0 Indicates the first parameter type to check. - * @param valid1 Indicates the second parameter type to check. - * @param valid2 Indicates the third parameter type to check. - * @param valid3 Indicates the fourth parameter type to check. - * - * @return Returns true if the parameter types are correct. - * Returns false otherwise. - * @since 12 - */ -static inline bool check_param_type(uint32_t param_to_check, uint32_t valid0, uint32_t valid1, uint32_t valid2, - uint32_t valid3) -{ - return (TEE_PARAM_TYPES(valid0, valid1, valid2, valid3) == param_to_check); -} - -/** - * @brief Enumerates the types of the TEE parameter. - * - * @since 12 - */ -enum TEE_ParamType { - TEE_PARAM_TYPE_NONE = 0x0, - TEE_PARAM_TYPE_VALUE_INPUT = 0x1, - TEE_PARAM_TYPE_VALUE_OUTPUT = 0x2, - TEE_PARAM_TYPE_VALUE_INOUT = 0x3, - TEE_PARAM_TYPE_MEMREF_INPUT = 0x5, - TEE_PARAM_TYPE_MEMREF_OUTPUT = 0x6, - TEE_PARAM_TYPE_MEMREF_INOUT = 0x7, - TEE_PARAM_TYPE_ION_INPUT = 0x8, - TEE_PARAM_TYPE_ION_SGLIST_INPUT = 0x9, - TEE_PARAM_TYPE_MEMREF_SHARED_INOUT = 0xa, - TEE_PARAM_TYPE_RESMEM_INPUT = 0xc, - TEE_PARAM_TYPE_RESMEM_OUTPUT = 0xd, - TEE_PARAM_TYPE_RESMEM_INOUT = 0xe, -}; - -#define S_VAR_NOT_USED(variable) \ - do { \ - (void)(variable); \ - } while (0) - -/** - * @brief Defines an object information. - * - * @since 12 - */ -typedef struct { - uint32_t objectType; - uint32_t objectSize; - uint32_t maxObjectSize; - uint32_t objectUsage; - uint32_t dataSize; - uint32_t dataPosition; - uint32_t handleFlags; -} TEE_ObjectInfo; - -/** - * @brief Defines an object attribute. - * - * @since 12 - */ -typedef struct { - uint32_t attributeID; - union { - struct { - void *buffer; - size_t length; - } ref; - struct { - uint32_t a; - uint32_t b; - } value; - } content; -} TEE_Attribute; - -/** - * @brief Enumerates the types of object attribute. - * - * @since 12 - */ -enum TEE_ObjectAttribute { - TEE_ATTR_SECRET_VALUE = 0xC0000000, - TEE_ATTR_RSA_MODULUS = 0xD0000130, - TEE_ATTR_RSA_PUBLIC_EXPONENT = 0xD0000230, - TEE_ATTR_RSA_PRIVATE_EXPONENT = 0xC0000330, - TEE_ATTR_RSA_PRIME1 = 0xC0000430, - TEE_ATTR_RSA_PRIME2 = 0xC0000530, - TEE_ATTR_RSA_EXPONENT1 = 0xC0000630, - TEE_ATTR_RSA_EXPONENT2 = 0xC0000730, - TEE_ATTR_RSA_COEFFICIENT = 0xC0000830, - TEE_ATTR_RSA_MGF1_HASH = 0xF0000830, - TEE_ATTR_DSA_PRIME = 0xD0001031, - TEE_ATTR_DSA_SUBPRIME = 0xD0001131, - TEE_ATTR_DSA_BASE = 0xD0001231, - TEE_ATTR_DSA_PUBLIC_VALUE = 0xD0000131, - TEE_ATTR_DSA_PRIVATE_VALUE = 0xC0000231, - TEE_ATTR_DH_PRIME = 0xD0001032, - TEE_ATTR_DH_SUBPRIME = 0xD0001132, - TEE_ATTR_DH_BASE = 0xD0001232, - TEE_ATTR_DH_X_BITS = 0xF0001332, - TEE_ATTR_DH_PUBLIC_VALUE = 0xD0000132, - TEE_ATTR_DH_PRIVATE_VALUE = 0xC0000232, - TEE_ATTR_RSA_OAEP_LABEL = 0xD0000930, - TEE_ATTR_RSA_PSS_SALT_LENGTH = 0xF0000A30, - TEE_ATTR_ECC_PUBLIC_VALUE_X = 0xD0000141, - TEE_ATTR_ECC_PUBLIC_VALUE_Y = 0xD0000241, - TEE_ATTR_ECC_PRIVATE_VALUE = 0xC0000341, - TEE_ATTR_ECC_CURVE = 0xF0000441, - TEE_ATTR_ED25519_CTX = 0xD0000643, - TEE_ATTR_ED25519_PUBLIC_VALUE = 0xD0000743, - TEE_ATTR_ED25519_PRIVATE_VALUE = 0xC0000843, - TEE_ATTR_ED25519_PH = 0xF0000543, - TEE_ATTR_X25519_PUBLIC_VALUE = 0xD0000944, - TEE_ATTR_X25519_PRIVATE_VALUE = 0xC0000A44, - TEE_ATTR_PBKDF2_HMAC_PASSWORD = 0xD0000133, - TEE_ATTR_PBKDF2_HMAC_SALT = 0xD0000134, - TEE_ATTR_PBKDF2_HMAC_DIGEST = 0xF0000135, -}; - -/** - * @brief Enumerates the types of object. - * - * @since 12 - */ -enum TEE_ObjectType { - TEE_TYPE_AES = 0xA0000010, - TEE_TYPE_DES = 0xA0000011, - TEE_TYPE_DES3 = 0xA0000013, - TEE_TYPE_HMAC_MD5 = 0xA0000001, - TEE_TYPE_HMAC_SHA1 = 0xA0000002, - TEE_TYPE_HMAC_SHA224 = 0xA0000003, - TEE_TYPE_HMAC_SHA256 = 0xA0000004, - TEE_TYPE_HMAC_SHA384 = 0xA0000005, - TEE_TYPE_HMAC_SHA512 = 0xA0000006, - TEE_TYPE_RSA_PUBLIC_KEY = 0xA0000030, - TEE_TYPE_RSA_KEYPAIR = 0xA1000030, - TEE_TYPE_DSA_PUBLIC_KEY = 0xA0000031, - TEE_TYPE_DSA_KEYPAIR = 0xA1000031, - TEE_TYPE_DH_KEYPAIR = 0xA1000032, - TEE_TYPE_GENERIC_SECRET = 0xA0000000, - TEE_TYPE_DATA = 0xA1000033, - TEE_TYPE_DATA_GP1_1 = 0xA00000BF, - TEE_TYPE_ECDSA_PUBLIC_KEY = 0xA0000041, - TEE_TYPE_ECDSA_KEYPAIR = 0xA1000041, - TEE_TYPE_ECDH_PUBLIC_KEY = 0xA0000042, - TEE_TYPE_ECDH_KEYPAIR = 0xA1000042, - TEE_TYPE_ED25519_PUBLIC_KEY = 0xA0000043, - TEE_TYPE_ED25519_KEYPAIR = 0xA1000043, - TEE_TYPE_X25519_PUBLIC_KEY = 0xA0000044, - TEE_TYPE_X25519_KEYPAIR = 0xA1000044, - TEE_TYPE_SM2_DSA_PUBLIC_KEY = 0xA0000045, - TEE_TYPE_SM2_DSA_KEYPAIR = 0xA1000045, - TEE_TYPE_SM2_KEP_PUBLIC_KEY = 0xA0000046, - TEE_TYPE_SM2_KEP_KEYPAIR = 0xA1000046, - TEE_TYPE_SM2_PKE_PUBLIC_KEY = 0xA0000047, - TEE_TYPE_SM2_PKE_KEYPAIR = 0xA1000047, - TEE_TYPE_HMAC_SM3 = 0xA0000007, - TEE_TYPE_SM4 = 0xA0000014, - TEE_TYPE_SIP_HASH = 0xF0000002, - TEE_TYPE_PBKDF2_HMAC = 0xF0000004, - - TEE_TYPE_CORRUPTED_OBJECT = 0xA00000BE, -}; - -#define OBJECT_NAME_LEN_MAX 255 - -/** - * @brief Defines an object handle. - * - * @since 12 - */ -struct __TEE_ObjectHandle { - void *dataPtr; - uint32_t dataLen; - uint8_t dataName[OBJECT_NAME_LEN_MAX]; - TEE_ObjectInfo *ObjectInfo; - TEE_Attribute *Attribute; - uint32_t attributesLen; - uint32_t CRTMode; - void *infoattrfd; - uint32_t generate_flag; - uint32_t storage_id; -}; - -/** - * @brief Defines the __TEE_ObjectHandle struct. - * - * @see __TEE_ObjectHandle - * - * @since 12 - */ -typedef struct __TEE_ObjectHandle *TEE_ObjectHandle; - -#define NODE_LEN 8 - -/** - * @brief Defines an UUID of TA. - * - * @since 12 - */ -typedef struct tee_uuid { - uint32_t timeLow; - uint16_t timeMid; - uint16_t timeHiAndVersion; - uint8_t clockSeqAndNode[NODE_LEN]; -} TEE_UUID; - -/** - * @brief Defines the type of spawn UUID. - * - * @since 12 - */ -typedef struct spawn_uuid { - uint64_t uuid_valid; - TEE_UUID uuid; -} spawn_uuid_t; - -/** - * @brief Enumerates the result codes used in the TEEKit APIs. - * - * @since 12 - */ -enum TEE_Result_Value { - /* The operation is successful. */ - TEE_SUCCESS = 0x00000000, - /* The command is invalid. */ - TEE_ERROR_INVALID_CMD = 0x00000001, - /* The service does not exist. */ - TEE_ERROR_SERVICE_NOT_EXIST = 0x00000002, - /* The session does not exist. */ - TEE_ERROR_SESSION_NOT_EXIST = 0x00000003, - /* The number of sessions exceeds the limit. */ - TEE_ERROR_SESSION_MAXIMUM = 0x00000004, - /* The service has been already registered. */ - TEE_ERROR_REGISTER_EXIST_SERVICE = 0x00000005, - /* An internal error occurs. */ - TEE_ERROR_TARGET_DEAD_FATAL = 0x00000006, - /* Failed to read data. */ - TEE_ERROR_READ_DATA = 0x00000007, - /* Failed to write data. */ - TEE_ERROR_WRITE_DATA = 0x00000008, - /* Failed to truncate data. */ - TEE_ERROR_TRUNCATE_OBJECT = 0x00000009, - /* Failed to seek data. */ - TEE_ERROR_SEEK_DATA = 0x0000000A, - /* Failed to synchronize data. */ - TEE_ERROR_SYNC_DATA = 0x0000000B, - /* Failed to rename the file. */ - TEE_ERROR_RENAME_OBJECT = 0x0000000C, - /* An error occurs when the TA is loaded. */ - TEE_ERROR_TRUSTED_APP_LOAD_ERROR = 0x0000000D, - /* An I/O error occurs when data is stored. */ - TEE_ERROR_STORAGE_EIO = 0x80001001, - /* The storage section is unavailable. */ - TEE_ERROR_STORAGE_EAGAIN = 0x80001002, - /* The operation target is not a directory. */ - TEE_ERROR_STORAGE_ENOTDIR = 0x80001003, - /* This operation cannot be performed on a directory. */ - TEE_ERROR_STORAGE_EISDIR = 0x80001004, - /* The number of opened files exceeds the limit in system. */ - TEE_ERROR_STORAGE_ENFILE = 0x80001005, - /* The number of files opened for the process exceeds the limit.*/ - TEE_ERROR_STORAGE_EMFILE = 0x80001006, - /* The storage section is read only. */ - TEE_ERROR_STORAGE_EROFS = 0x80001007, - /* The file path is not correct. */ - TEE_ERROR_STORAGE_PATH_WRONG = 0x8000100A, - /* The service message queue overflows. */ - TEE_ERROR_MSG_QUEUE_OVERFLOW = 0x8000100B, - /* The file object is corrupted. */ - TEE_ERROR_CORRUPT_OBJECT = 0xF0100001, - /* The storage section is unavailable. */ - TEE_ERROR_STORAGE_NOT_AVAILABLE = 0xF0100003, - /* The cipher text is incorrect. */ - TEE_ERROR_CIPHERTEXT_INVALID = 0xF0100006, - /* Protocol error in socket connection. */ - TEE_ISOCKET_ERROR_PROTOCOL = 0xF1007001, - /* The socket is closed by the remote end. */ - TEE_ISOCKET_ERROR_REMOTE_CLOSED = 0xF1007002, - /* The socket connection timed out. */ - TEE_ISOCKET_ERROR_TIMEOUT = 0xF1007003, - /* There is no resource available for the socket connection. */ - TEE_ISOCKET_ERROR_OUT_OF_RESOURCES = 0xF1007004, - /* The buffer is too large for the socket connection. */ - TEE_ISOCKET_ERROR_LARGE_BUFFER = 0xF1007005, - /* A warning is given in the socket connection. */ - TEE_ISOCKET_WARNING_PROTOCOL = 0xF1007006, - /* Generic error. */ - TEE_ERROR_GENERIC = 0xFFFF0000, - /* The access is denied. */ - TEE_ERROR_ACCESS_DENIED = 0xFFFF0001, - /* The operation has been canceled. */ - TEE_ERROR_CANCEL = 0xFFFF0002, - /* An access conflict occurs. */ - TEE_ERROR_ACCESS_CONFLICT = 0xFFFF0003, - /* The data size exceeds the maximum. */ - TEE_ERROR_EXCESS_DATA = 0xFFFF0004, - /* Incorrect data format. */ - TEE_ERROR_BAD_FORMAT = 0xFFFF0005, - /* Incorrect parameters. */ - TEE_ERROR_BAD_PARAMETERS = 0xFFFF0006, - /* The current state does not support the operation. */ - TEE_ERROR_BAD_STATE = 0xFFFF0007, - /* Failed to find the target item. */ - TEE_ERROR_ITEM_NOT_FOUND = 0xFFFF0008, - /* The API is not implemented. */ - TEE_ERROR_NOT_IMPLEMENTED = 0xFFFF0009, - /* The API is not supported. */ - TEE_ERROR_NOT_SUPPORTED = 0xFFFF000A, - /* There is no data available for this operation. */ - TEE_ERROR_NO_DATA = 0xFFFF000B, - /* There is no memory available for this operation. */ - TEE_ERROR_OUT_OF_MEMORY = 0xFFFF000C, - /* The system does not respond to this operation. */ - TEE_ERROR_BUSY = 0xFFFF000D, - /* Failed to communicate with the target. */ - TEE_ERROR_COMMUNICATION = 0xFFFF000E, - /* A security error occurs. */ - TEE_ERROR_SECURITY = 0xFFFF000F, - /* The buffer is insufficient for this operation. */ - TEE_ERROR_SHORT_BUFFER = 0xFFFF0010, - /* The operation has been canceled. */ - TEE_ERROR_EXTERNAL_CANCEL = 0xFFFF0011, - /* The service is in the pending state (asynchronous state). */ - TEE_PENDING = 0xFFFF2000, - /* The service is in the pending state(). */ - TEE_PENDING2 = 0xFFFF2001, - /* Reserved. */ - TEE_PENDING3 = 0xFFFF2002, - /* The operation timed out. */ - TEE_ERROR_TIMEOUT = 0xFFFF3001, - /* Overflow occurs. */ - TEE_ERROR_OVERFLOW = 0xFFFF300f, - /* The TA is crashed. */ - TEE_ERROR_TARGET_DEAD = 0xFFFF3024, - /* There is no enough space to store data. */ - TEE_ERROR_STORAGE_NO_SPACE = 0xFFFF3041, - /* The MAC operation failed. */ - TEE_ERROR_MAC_INVALID = 0xFFFF3071, - /* The signature verification failed. */ - TEE_ERROR_SIGNATURE_INVALID = 0xFFFF3072, - /* Interrupted by CFC. Broken control flow is detected. */ - TEE_CLIENT_INTR = 0xFFFF4000, - /* Time is not set. */ - TEE_ERROR_TIME_NOT_SET = 0xFFFF5000, - /* Time needs to be reset. */ - TEE_ERROR_TIME_NEEDS_RESET = 0xFFFF5001, - /* System error. */ - TEE_FAIL = 0xFFFF5002, - /* Base value of the timer error code. */ - TEE_ERROR_TIMER = 0xFFFF6000, - /* Failed to create the timer. */ - TEE_ERROR_TIMER_CREATE_FAILED = 0xFFFF6001, - /* Failed to destroy the timer. */ - TEE_ERROR_TIMER_DESTORY_FAILED = 0xFFFF6002, - /* The timer is not found. */ - TEE_ERROR_TIMER_NOT_FOUND = 0xFFFF6003, - /* Generic error of RPMB operations. */ - TEE_ERROR_RPMB_GENERIC = 0xFFFF7001, - /* Verify MAC failed in RPMB operations. */ - TEE_ERROR_RPMB_MAC_FAIL = 0xFFFF7002, - /* Incorrect message data MAC in RPMB response. */ - TEE_ERROR_RPMB_RESP_UNEXPECT_MAC = 0xFFFF7105, - /* The file is not found in RPMB. */ - TEE_ERROR_RPMB_FILE_NOT_FOUND = 0xFFFF7106, - /* No spece left for RPMB operations. */ - TEE_ERROR_RPMB_NOSPC = 0xFFFF7107, - /* sec flash is not available. */ - TEE_ERROR_SEC_FLASH_NOT_AVAILABLE = 0xFFFF7118, - /* The BIO service is not available. */ - TEE_ERROR_BIOSRV_NOT_AVAILABLE = 0xFFFF711A, - /* The ROT service is not available. */ - TEE_ERROR_ROTSRV_NOT_AVAILABLE = 0xFFFF711B, - /* The TA Anti-Rollback service is not available. */ - TEE_ERROR_ARTSRV_NOT_AVAILABLE = 0xFFFF711C, - /* The HSM service is not available. */ - TEE_ERROR_HSMSRV_NOT_AVAILABLE = 0xFFFF711D, - /* Failed to verify AntiRoot response. */ - TEE_ERROR_ANTIROOT_RSP_FAIL = 0xFFFF9110, - /* AntiRoot error in invokeCmd(). */ - TEE_ERROR_ANTIROOT_INVOKE_ERROR = 0xFFFF9111, - /* Audit failed. */ - TEE_ERROR_AUDIT_FAIL = 0xFFFF9112, - /* Unused. */ - TEE_FAIL2 = 0xFFFF9113, -}; - -/** - * @brief Login type definitions - * - * @since 12 - */ -enum TEE_LoginMethod { - TEE_LOGIN_PUBLIC = 0x0, - TEE_LOGIN_USER, - TEE_LOGIN_GROUP, - TEE_LOGIN_APPLICATION = 0x4, - TEE_LOGIN_USER_APPLICATION = 0x5, - TEE_LOGIN_GROUP_APPLICATION = 0x6, - TEE_LOGIN_IDENTIFY = 0x7, /* Customized login type */ -}; - -/** - * @brief Definitions the TEE Identity. - * - * @since 12 - */ -typedef struct { - uint32_t login; - TEE_UUID uuid; -} TEE_Identity; - -/** - * @brief Defines the return values. - * - * @since 12 - * @version 1.0 - */ -typedef uint32_t TEE_Result; - -/** - * @brief Defines the return values. - * - * @since 12 - * @version 1.0 - */ -typedef TEE_Result TEEC_Result; - -#define TEE_ORIGIN_TEE 0x00000003 -#define TEE_ORIGIN_TRUSTED_APP 0x00000004 - -#ifndef _TEE_TA_SESSION_HANDLE -#define _TEE_TA_SESSION_HANDLE -/** - * @brief Defines the handle of TA session. - * - * @since 12 - */ -typedef uint32_t TEE_TASessionHandle; -#endif - -/** - * @brief Defines the pointer to TEE_ObjectEnumHandle. - * - * @see __TEE_ObjectEnumHandle - * - * @since 12 - */ -typedef struct __TEE_ObjectEnumHandle *TEE_ObjectEnumHandle; - -/** - * @brief Defines the pointer to __TEE_OperationHandle. - * - * @see __TEE_OperationHandle - * - * @since 12 - */ -typedef struct __TEE_OperationHandle *TEE_OperationHandle; - -#define TEE_TIMEOUT_INFINITE (0xFFFFFFFF) - -/** - * @brief Definitions the TEE time. - * - * @since 12 - */ -typedef struct { - uint32_t seconds; - uint32_t millis; -} TEE_Time; - -/** - * @brief Definitions the date time of TEE. - * - * @since 12 - */ -typedef struct { - int32_t seconds; - int32_t millis; - int32_t min; - int32_t hour; - int32_t day; - int32_t month; - int32_t year; -} TEE_Date_Time; - -/** - * @brief Definitions the timer property of TEE. - * - * @since 12 - */ -typedef struct { - uint32_t type; - uint32_t timer_id; - uint32_t timer_class; - uint32_t reserved2; -} TEE_timer_property; - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_drv_client.h b/tee/include/tee_drv_client.h deleted file mode 100644 index 4adca85f7d8d1619b3676accf24b5f4c8c3b5199..0000000000000000000000000000000000000000 --- a/tee/include/tee_drv_client.h +++ /dev/null @@ -1,96 +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. - */ -#ifndef TEE_DRV_CLIENT_H -#define TEE_DRV_CLIENT_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_drv_client.h - * - * @brief Declare tee driver client API. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Open the specified driver in the TEE. - * - * @param drv_name [IN] The driver name. - * @param param [IN] The parameter information. - * @param param_len [IN] The length of the parameter. - * - * @return Returns greater than 0, which means the fd of the corresponding driver. - * Returns less than or equal to 0, which means falied to open the driver. - * - * @since 12 - * @version 1.0 - */ -int64_t tee_drv_open(const char *drv_name, const void *param, uint32_t param_len); - -/** - * @brief Cancels an operation. - * - * @param fd [IN] The file descriptor of the driver. - * @param cmd_id [IN] The command id. - * @param param [IN] The parameter information. - * @param param_len [IN] The length of the parameter. - * - * @return Returns 0 if the operation is successful. - * Returns -1 if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -int64_t tee_drv_ioctl(int64_t fd, uint32_t cmd_id, const void *param, uint32_t param_len); - -/** - * @brief Open the specified driver in the TEE. - * - * @param fd [IN] The file descriptor of the driver. - * - * @return Returns 0 if the operation is successful. - * Returns -1 if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -int64_t tee_drv_close(int64_t fd); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif - diff --git a/tee/include/tee_dynamic_srv.h b/tee/include/tee_dynamic_srv.h deleted file mode 100644 index 37ef28f68d855893879b2231705e6f436c5d9766..0000000000000000000000000000000000000000 --- a/tee/include/tee_dynamic_srv.h +++ /dev/null @@ -1,134 +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. - */ - -#ifndef _TEE_DYNAMIC_SRV_H_ -#define _TEE_DYNAMIC_SRV_H_ - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_dynamic_srv.h - * - * @brief Provides APIs related to dynamic service development. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include "tee_service_public.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines thread initialization information of the dynamic service. - * - * @since 12 - */ -struct srv_thread_init_info { - void *(*func)(void *arg); - /** The maximum number of parallel threads. */ - uint32_t max_thread; - int32_t shadow; - /** The stack size of the thread. */ - uint32_t stack_size; - /** The timeout period for thread (in seconds).*/ - uint32_t time_out_sec; -}; - -typedef void (*srv_dispatch_fn_t)(tee_service_ipc_msg *msg, - uint32_t sndr, tee_service_ipc_msg_rsp *rsp); - -struct srv_dispatch_t { - uint32_t cmd; - srv_dispatch_fn_t fn; -}; - -/** - * @brief Get UUID by sender. - * - * @param sender [IN] Indicates the sender's task Id. - * @param uuid [OUT] Indicates the universally unique identifier. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if the input parameter is incorrect, - * or the file name is longer than 64 bytes. - * Returns {@code TEE_ERROR_ITEM_NOT_FOUND} if failed to find the corresponding UUID by sender. - * Returns {@code TEE_ERROR_GENERIC} if failed to obtain the UUID. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_srv_get_uuid_by_sender(uint32_t sender, TEE_UUID *uuid); - -/** - * @brief Releasing the object mapping of a specified address area. - * - * @param va_addr [IN] Indicates the address of the memory area to be released. - * @param size [IN] Indicates the size of the released memory area. - * - * @since 12 - * @version 1.0 - */ -void tee_srv_unmap_from_task(uint32_t va_addr, uint32_t size); - -/** - * @brief Create a new mapping in the virtual address space of the calling process. - * - * @param in_task_id [IN] Indicates the task Id. - * @param va_addr [IN] Indicates the address of the memory area to be mapped. - * @param size [IN] Indicates the size of the memory area to be mapped. - * @param virt_addr [OUT] Indicates the new mapping vitural address. - * - * @return Returns 0 if the operation is successful. - * @return Returns -1 if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -int tee_srv_map_from_task(uint32_t in_task_id, uint32_t va_addr, uint32_t size, uint32_t *virt_addr); - -/** - * @brief Dispatch task by task name. - * - * @param task_name [IN] Indicates the task name. - * @param dispatch [IN] Indicates the dispatch information. - * @param n_dispatch [IN] Indicates the dispatch number. - * @param cur_thread [IN] Indicates the current thread information. - * - * @since 12 - * @version 1.0 - */ -void tee_srv_cs_server_loop(const char *task_name, const struct srv_dispatch_t *dispatch, - uint32_t n_dispatch, struct srv_thread_init_info *cur_thread); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_ext_api.h b/tee/include/tee_ext_api.h deleted file mode 100644 index 37481f6c685bf8e276974ab4e8eb3ac6daf329d3..0000000000000000000000000000000000000000 --- a/tee/include/tee_ext_api.h +++ /dev/null @@ -1,209 +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. - */ - -#ifndef TEE_EXT_API_H -#define TEE_EXT_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_ext_api.h - * - * @brief Provides extended interfaces. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" -#include "tee_hw_ext_api.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ - -/** - * @brief Defines the value of invalid user ID. - * - * @since 12 - */ -#define INVALID_USERID 0xFFFFFFFU - -/** - * @brief Defines the SMC from user mode. - * - * @since 12 - */ -#define TEE_SMC_FROM_USR 0 - -/** - * @brief Defines the SMC from kernel mode. - * - * @since 12 - */ -#define TEE_SMC_FROM_KERNEL 1 - -/** - * @brief Defines the szie of reserved buffer. - * - * @since 12 - */ -#define RESERVED_BUF_SIZE 32 - -/** - * @brief Defines the caller information. - * - * @since 12 - */ -typedef struct ta_caller_info { - uint32_t session_type; - union { - struct { - TEE_UUID caller_uuid; - uint32_t group_id; - }; - uint8_t ca_info[RESERVED_BUF_SIZE]; - } caller_identity; - uint8_t smc_from_kernel_mode; - uint8_t reserved[RESERVED_BUF_SIZE - 1]; -} caller_info; - -/** - * @brief Get caller info of current session, refer caller_info struct for more details. - * - * @param ca_name Indicates the process name of the caller of the CA. - * @param ca_uid Indicates the UID of the caller. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_get_caller_info(caller_info *caller_info_data, uint32_t length); - -/** - * @brief Get user ID of current TA. - * - * @param user_id Indicates the user ID to be returned. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_get_caller_userid(uint32_t *user_id); - -/** - * @brief Adds information about a caller that can invoke this TA. - * This API applies to the client applications (CAs) in the binary executable file format. - * - * @param ca_name Indicates the process name of the caller of the CA. - * @param ca_uid Indicates the UID of the caller. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result AddCaller_CA_exec(const char *ca_name, uint32_t ca_uid); - -/** - * @brief Adds information about a caller that can invoke this TA. - * This API applies to the client applications (CAs) in the native CA and HAP format. - * - * @param cainfo_hash Indicates the hash value of the CA caller information. - * @param length Indicates the length of the hash value. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result AddCaller_CA(const uint8_t *cainfo_hash, uint32_t length); - -/** - * @brief TA call this API allow others TA open session with itself. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - * @version 1.0 - */ -TEE_Result AddCaller_TA_all(void); - -/** - * @brief Defines the session caller from CA. - * - * @since 12 - */ -#define SESSION_FROM_CA 0 - -/** - * @brief Defines the session caller from TA. - * - * @since 12 - */ -#define SESSION_FROM_TA 1 - -/** - * @brief Defines the TA task is not found, for example, from TA sub thread. - * - * @since 12 - */ -#define SESSION_FROM_NOT_SUPPORTED 0xFE - -/** - * @brief Defines the TA caller is not found. - * - * @since 12 - */ -#define SESSION_FROM_UNKNOWN 0xFF - -/** - * @brief Obtains the session type. - * - * @return Returns the session type obtained. - * - * @since 12 - * @version 1.0 - */ -uint32_t tee_get_session_type(void); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ - -#endif diff --git a/tee/include/tee_hw_ext_api.h b/tee/include/tee_hw_ext_api.h deleted file mode 100644 index 3fb3503674c627076f3f79a9102a23767ee54404..0000000000000000000000000000000000000000 --- a/tee/include/tee_hw_ext_api.h +++ /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. - */ - -#ifndef TEE_HW_EXT_API_H -#define TEE_HW_EXT_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_hw_ext_api.h - * - * @brief Provides extended interfaces. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Obtains the unique device ID from the TEE. - * - * @param device_unique_id Indicates the pointer to the buffer for storing the device ID. - * @param length Indicates the pointer to the buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other information otherwise. - * - * @since 12 - */ -TEE_Result tee_ext_get_device_unique_id(uint8_t *device_unique_id, uint32_t *length); - -/** - * @brief Defines the memory information. - * - * @since 12 - */ -struct meminfo_t { - uint64_t buffer; - uint32_t size; -}; - -/** - * @brief Derive key from device rootkey and UUID of the current task for iteration. - * - * @param salt [IN] Indicates the data for salt. - * @param key [OUT] Indicates the pointer where key is saved. - * @param outer_iter_num [IN] Indicates the iteration times in huk service. - * @param inner_iter_num [IN] Indicates the iteration times in platform driver. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - */ -TEE_Result tee_ext_derive_key_iter(const struct meminfo_t *salt, struct meminfo_t *key, - uint32_t outer_iter_num, uint32_t inner_iter_num); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_hw_ext_api_legacy.h b/tee/include/tee_hw_ext_api_legacy.h deleted file mode 100644 index c50471ea98ca72700059e09ac0b0cd23dfba5ae1..0000000000000000000000000000000000000000 --- a/tee/include/tee_hw_ext_api_legacy.h +++ /dev/null @@ -1,123 +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. - */ - -#ifndef __TEE_HW_EXT_API_LEGACY_H__ -#define __TEE_HW_EXT_API_LEGACY_H__ - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_hw_ext_api_legacy.h - * - * @brief Provides extended interfaces. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Derive key from device root key. - * - * @param salt [IN] Indicates the data for salt. - * @param size [IN] Indicates the length of salt. - * @param key [OUT] Indicates the pointer where key is saved. - * @param key_size [IN] Indicates the size of the key, which must be integer times of 16. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_EXT_DeriveTARootKey(const uint8_t *salt, uint32_t size, uint8_t *key, uint32_t key_size); - -/** - * @brief Derive key from device root key by HUK2. - * @attention If the device does not support HUK2, the key is derived by HUK. - * - * @param salt [IN] Indicates the data for salt. - * @param size [IN] Indicates the length of salt. - * @param key [OUT] Indicates the pointer where key is saved. - * @param key_size [IN] Indicates the size of the key, which must be integer times of 16. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_derive_ta_root_key_by_huk2(const uint8_t *salt, uint32_t size, uint8_t *key, uint32_t key_size); - -/** - * @brief Derive key from device root key by HUK2. - * @attention If the device does not support HUK2, the key is derived by HUK. - * - * @param secret [IN] Indicates the input secret. - * @param secret_len [IN] Indicates the length of the input secret. - * @param key [OUT] Indicates the derived key. - * @param key_len [IN] Indicates the length of the derived key. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_root_derive_key2_by_huk2(const uint8_t *secret, uint32_t secret_len, uint8_t *key, uint32_t key_len); - -/** - * @brief Derive key from device root key and UUID of the current task by HUK2. - * @attention If the device does not support HUK2, the key is derived by HUK. - * - * @param salt [IN] Indicates the data for salt. - * @param size [IN] Indicates the length of salt. - * @param key [OUT] Indicates the pointer where key is saved. - * @param key_size [IN] Indicates the size of the generated key, fix-size 32 bytes. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_GENERIC} if the processing failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_root_uuid_derive_key_by_huk2(const uint8_t *salt, uint32_t size, uint8_t *key, uint32_t key_size); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_internal_se_api.h b/tee/include/tee_internal_se_api.h deleted file mode 100644 index 9e4ad28e605dfaca6be348dd96ffb565c5993143..0000000000000000000000000000000000000000 --- a/tee/include/tee_internal_se_api.h +++ /dev/null @@ -1,498 +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. - */ - -#ifndef TEE_INTERNAL_SE_API_H -#define TEE_INTERNAL_SE_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_internal_se_api.h - * - * @brief Provides APIs related to the TEE Secure Element. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct __TEE_SEServiceHandle; -struct __TEE_SEReaderHandle; -struct __TEE_SESessionHandle; -struct __TEE_SEChannelHandle; - -typedef struct __TEE_SEServiceHandle *TEE_SEServiceHandle; -typedef struct __TEE_SEReaderHandle *TEE_SEReaderHandle; -typedef struct __TEE_SESessionHandle *TEE_SESessionHandle; -typedef struct __TEE_SEChannelHandle *TEE_SEChannelHandle; - -#define ATR_LEN_MAX 32U -#define AID_LEN_MIN 5U -#define AID_LEN_MAX 16U - -/** - * @brief Defines the maximum of the logic channel. - * - * @since 12 - */ -#define SE_LOGIC_CHANNEL_MAX 8U - -#define TEE_SC_TYPE_SCP03 0x01 - -#define BYTE_LEN 8 - -/** - * @brief Represents the properties of the SE reader. - * - * @since 12 - */ -typedef struct __TEE_SEReaderProperties { - /** If an SE is present in the reader, the value is true. */ - bool sePresent; - /** If this reader is only accessible via the TEE, the value is true. */ - bool teeOnly; - /** If the response to a SELECT is available in the TEE, the value is true.*/ - bool selectResponseEnable; -} TEE_SEReaderProperties; - -/** - * @brief Defines the SE AID. - * - * @since 12 - */ -typedef struct __TEE_SEAID { - /** The value of the applet's AID. */ - uint8_t *buffer; - /** The lenght of the applet's AID. */ - uint32_t bufferLen; -} TEE_SEAID; - -/** - * @brief Enumerates the types of the key. - * - * @since 12 - */ -typedef enum { - /** A base key acc. to SCP02. */ - TEE_SC_BASE_KEY = 0, - /** A key set (key-MAC, key_ENC) acc. to SCP02, SCP03. */ - TEE_SC_KEY_SET = 1 -} TEE_SC_KeyType; - -typedef struct __TEE_SC_KeySetRef { - /** Key-ENC (Static encryption key). */ - TEE_ObjectHandle scKeyEncHandle; - /** Key-MAC (Static MAC key). */ - TEE_ObjectHandle scKeyMacHandle; -} TEE_SC_KeySetRef; - -/** - * @brief Enumerates the levels of the security. - * - * @since 12 - */ -typedef enum { - /** Nothing will be applied. */ - TEE_SC_NO_SECURE_MESSAGING = 0x00, - /** Command and response APDU not be secured. */ - TEE_SC_AUTHENTICATE = 0x80, - /** Command APDU shall be MAC protected. */ - TEE_SC_C_MAC = 0x01, - /** Response APDU shall be MAC protected. */ - TEE_SC_R_MAC = 0x10, - /** Command and response APDU shall be MAC protected. */ - TEE_SC_CR_MAC = 0x11, - /** Command APDU shall be encrypted and MAC protected. */ - TEE_SC_C_ENC_MAC = 0x03, - /** Response APDU shall be encrypted and MAC protected. */ - TEE_SC_R_ENC_MAC = 0x30, - /** Command and response APDU shall be encrypted and MAC protected. */ - TEE_SC_CR_ENC_MAC = 0x33, - /** Command APDU shall be encrypted, and the command and response APDU shall be MAC protected.*/ - TEE_SC_C_ENC_CR_MAC = 0x13 -} TEE_SC_SecurityLevel; - -#define TEE_AUTHENTICATE TEE_SC_AUTHENTICATE - -/** - * @brief Represents the reference about SC card key. - * - * @since 12 - */ -typedef struct __TEE_SC_CardKeyRef { - /** The key identifier of the SC card key. */ - uint8_t scKeyID; - /** The key version if the SC card key. */ - uint8_t scKeyVersion; -} TEE_SC_CardKeyRef; - -/** - * @brief Represents the reference about the SC device key. - * - * @since 12 - */ -typedef struct __TEE_SC_DeviceKeyRef { - TEE_SC_KeyType scKeyType; - union { - TEE_ObjectHandle scBaseKeyHandle; - TEE_SC_KeySetRef scKeySetRef; - } __TEE_key; -} TEE_SC_DeviceKeyRef; - -/** - * @brief Defines the OID of the SC. - * - * @since 12 - */ -typedef struct __TEE_SC_OID { - /** The value of the OID. */ - uint8_t *buffer; - /** The length of the OID. */ - uint32_t bufferLen; -} TEE_SC_OID; - -/** - * @brief Represents the paramaters about the SC. - * - * @since 12 - */ -typedef struct __TEE_SC_Params { - /** The SC type. */ - uint8_t scType; - /** The SC type defined by OID. */ - TEE_SC_OID scOID; - /** The SC security level. */ - TEE_SC_SecurityLevel scSecurityLevel; - /** Reference to SC card keys. */ - TEE_SC_CardKeyRef scCardKeyRef; - /** Reference to SC device keys. */ - TEE_SC_DeviceKeyRef scDeviceKeyRef; -} TEE_SC_Params; - -/** - * @brief Open the SE service. - * - * @param se_service_handle [IN] Indicates the handle of SE service. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_ACCESS_CONFLICT} if failed to access the SE service due to conflict. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEServiceOpen(TEE_SEServiceHandle *se_service_handle); - -/** - * @brief Close the SE service. - * - * @param se_service_handle [IN] Indicates the handle of SE service. - * - * @since 12 - * @version 1.0 - */ -void TEE_SEServiceClose(TEE_SEServiceHandle se_service_handle); - -/** - * @brief Get the available readers handle of the SE service. - * - * @param se_service_handle [IN] Indicates the handle of SE service. - * @param se_reader_handle_list [OUT] Indicates the available readers handle list. - * @param se_reader_handle_list_len [OUT] Indicates the length of the handle list. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ITEM_NOT_FOUND} if cannot find the input SE service handle. - * Returns {@code TEE_ERROR_SHORT_BUFFER} if the provided buffer is too small to store the readers handle. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEServiceGetReaders(TEE_SEServiceHandle se_service_handle, TEE_SEReaderHandle *se_reader_handle_list, - uint32_t *se_reader_handle_list_len); - -/** - * @brief Get the available readers handle of the SE service. - * - * @param se_reader_handle [IN] Indicates the SE readers handle. - * @param reader_properties [OUT] Indicates the reader's properties. - * - * @since 12 - * @version 1.0 - */ -void TEE_SEReaderGetProperties(TEE_SEReaderHandle se_reader_handle, TEE_SEReaderProperties *reader_properties); - -/** - * @brief Get the SE reader's name. - * - * @param se_reader_handle [IN] Indicates the SE readers handle. - * @param reader_name [OUT] Indicates the SE reader's name. - * @param reader_name_len [OUT] Indicates the length of the reader's name. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ITEM_NOT_FOUND} if cannot find the input SE reader handle. - * Returns {@code TEE_ERROR_BAD_FORMAT} if the input se_reader_handle points to the reader illegally. - * Returns {@code TEE_ERROR_SHORT_BUFFER} if the reader_name_len is too small to store the readers name. - * Returns {@code TEE_ERROR_SECURITY} if the security error is detected. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEReaderGetName(TEE_SEReaderHandle se_reader_handle, char *reader_name, uint32_t *reader_name_len); - -/** - * @brief Open a session between the SE reader to the SE. - * - * @param se_reader_handle Indicates the SE readers handle. - * @param se_session_handle Indicates the session handle. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ITEM_NOT_FOUND} if cannot find the input SE reader handle. - * Returns {@code TEE_ERROR_COMMUNICATION} if communicte failed with the SE. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEReaderOpenSession(TEE_SEReaderHandle se_reader_handle, TEE_SESessionHandle *se_session_handle); - -/** - * @brief Close sessions between the SE reader to the SE. - * - * @param se_reader_handle Indicates the SE readers handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_SEReaderCloseSessions(TEE_SEReaderHandle se_reader_handle); - -/** - * @brief Get the SE ATR. - * - * @param se_session_handle Indicates the session handle. - * @param atr Indicates the SE ATR. - * @param atrLen Indicates the length of ATR. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_SHORT_BUFFER} if the provided buffer is too small to store the ATR. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SESessionGetATR(TEE_SESessionHandle se_session_handle, void *atr, uint32_t *atrLen); - -/** - * @brief Check whether the session is closed. - * - * @param se_session_handle Indicates the session handle. - * - * @return Returns {@code TEE_SUCCESS} if the session is closed or the input handle is invalid. - * Returns {@code TEE_ERROR_COMMUNICATION} if session state is invalid. - * Returns {@code TEE_ERROR_BAD_STATE} if the session is opened. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SESessionIsClosed(TEE_SESessionHandle se_session_handle); - -/** - * @brief Close the SE session. - * - * @param se_session_handle Indicates the session handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_SESessionClose(TEE_SESessionHandle se_session_handle); - -/** - * @brief Close all channels which pointed to by the SE session. - * - * @param se_session_handle Indicates the session handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_SESessionCloseChannels(TEE_SESessionHandle se_session_handle); - -/** - * @brief Open a basic channel which pointed to by the SE session. - * - * @param se_session_handle Indicates the session handle. - * @param se_aid Indicates the SE AID. - * @param se_channel_handle Indicates the SE channel handle. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_STATE} if the session is closed. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ITEM_NOT_FOUND} if cannot find the input SE reader handle. - * Returns other when SE responding to the abnormal status word. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SESessionOpenBasicChannel(TEE_SESessionHandle se_session_handle, TEE_SEAID *se_aid, - TEE_SEChannelHandle *se_channel_handle); - -/** - * @brief Open a logical channel which pointed to by the SE session. - * - * @param se_session_handle Indicates the session handle. - * @param se_aid Indicates the SE AID. - * @param se_channel_handle Indicates the SE channel handle. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_STATE} if the session is closed. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ITEM_NOT_FOUND} if cannot find the input SE reader handle. - * Returns other when SE responding to the abnormal status word. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SESessionOpenLogicalChannel(TEE_SESessionHandle se_session_handle, TEE_SEAID *se_aid, - TEE_SEChannelHandle *se_channel_handle); - -/** - * @brief Close the channel which pointed to by the channel handle. - * - * @param se_channel_handle Indicates the SE channel handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_SEChannelClose(TEE_SEChannelHandle se_channel_handle); - -/** - * @brief Select the next SE service which pointed to by the channel handle. - * - * @param se_channel_handle Indicates the SE channel handle. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is invalid or the mode of SE is wrong. - * Returns other when SE responding to the abnormal status word. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEChannelSelectNext(TEE_SEChannelHandle se_channel_handle); - -/** - * @brief Get the SELECT command response of SE when open the channel handle. - * - * @param se_channel_handle Indicates the SE channel handle. - * @param response Indicates the response of SE. - * @param response_len Indicates the length of the response. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is invalid. - * Returns {@code TEE_ERROR_SHORT_BUFFER} if the provided buffer is too small to store the response. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEChannelGetSelectResponse(TEE_SEChannelHandle se_channel_handle, void *response, - uint32_t *response_len); - -/** - * @brief Transmit the command through the channle. - * - * @param se_channel_handle Indicates the SE channel handle. - * @param command Indicates the transmitted command. - * @param command_len Indicates the length of the command. - * @param response Indicates the response of SE. - * @param response_len Indicates the length of the response. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_COMMUNICATION} if length of command is less than 4. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is invalid. - * Returns {@code TEE_ERROR_BAD_STATE} if the channel is closed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEChannelTransmit(TEE_SEChannelHandle se_channel_handle, void *command, uint32_t command_len, - void *response, uint32_t *response_len); - -/** - * @brief Open a SE secure channel based on the input channel handle. - * Thereafter, when the {@code TEE_SEChannelTransmit} is called, all APDUs(ENC/MAC protected) transmitted based on - * the handle are automatically protected based on the defined secure channel parameter options. - * Currently, only SCP03 is supported. - * - * @param se_channel_handle Indicates the SE channel handle. - * @param sc_params Indicates the parameter reference for the secure channel protocol. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_COMMUNICATION} if communicate failed with the SE. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is invalid or the mode of SE is wrong. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if the parameter of the sc_params is not supported - * Returns {@code TEE_ERROR_MAC_INVALID} if the verification failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SESecureChannelOpen(TEE_SEChannelHandle se_channel_handle, TEE_SC_Params *sc_params); - -/** - * @brief Close the SE secure channel based on the input channel handle. - * The channel, which pointed to by the input channel handle, is not closed. - * It can be used for insecure communication, but the APDU that calls {@code TEE_SEChannelTransmit} - * transmission is not secure. - * - * @param se_channel_handle Indicates the SE channel handle. - * - * @since 12 - * @version 1.0 - */ -void TEE_SESecureChannelClose(TEE_SEChannelHandle se_channel_handle); - -/** - * @brief Get the channel Id which pointed to by the input channel handle. - * - * @param se_channel_handle Indicates the SE channel handle. - * @param channel_id Indicates the SE channel Id. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is invalid. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SEChannelGetID(TEE_SEChannelHandle se_channel_handle, uint8_t *channel_id); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_log.h b/tee/include/tee_log.h deleted file mode 100644 index 0489ba0efa72e0ce9001f86792f9977b1a7457a6..0000000000000000000000000000000000000000 --- a/tee/include/tee_log.h +++ /dev/null @@ -1,290 +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. - */ - -#ifndef __TEE_LOG_H -#define __TEE_LOG_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_log.h - * - * @brief Provides TEE log APIs. - * - * Reference of TEE log APIs and internal definitions. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines the ERROR level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_ERROR 0 - -/** - * @brief Defines the WARNING level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_WARNING 1 - -/** - * @brief Defines the INFO level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_INFO 2 - -/** - * @brief Defines the DEBUG level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_DEBUG 3 - -/** - * @brief Defines the VERBO level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_VERBO 4 - -/** - * @brief Defines the default level of the TA log. - * - * @since 12 - */ -#define TA_LOG_LEVEL_DEFAULT TA_LOG_LEVEL_INFO - -/** - * @brief Defines the default level of the TA log. - * {@code TA_LOG_LEVEL} can be redefined by TA developers - * - * @since 12 - */ -#ifndef TA_LOG_LEVEL -#define TA_LOG_LEVEL TA_LOG_LEVEL_DEFAULT -#endif - -/** - * @brief Defines the tag of the VERBO level TA log. - * - * @since 12 - */ -#define TAG_VERB "[verb]" - -/** - * @brief Defines the tag of the DEBUG level TA log. - * - * @since 12 - */ -#define TAG_DEBUG "[debug]" - -/** - * @brief Defines the tag of the INFO level TA log. - * - * @since 12 - */ -#define TAG_INFO "[info]" - -/** - * @brief Defines the tag of the WARNING level TA log. - * - * @since 12 - */ -#define TAG_WARN "[warn]" - -/** - * @brief Defines the tag of the ERROR level TA log. - * - * @since 12 - */ -#define TAG_ERROR "[error]" - -/** - * @brief Enumerates the levels of the log. - * - * @since 12 - */ -typedef enum { - LOG_LEVEL_ERROR = 0, - LOG_LEVEL_WARN = 1, - LOG_LEVEL_INFO = 2, - LOG_LEVEL_DEBUG = 3, - LOG_LEVEL_VERBO = 4, - LOG_LEVEL_ON = 5, -} LOG_LEVEL; - -/** - * @brief Provides to print UART logs. - * - * @param fmt [IN] The log information. - * - * @since 12 - */ -void uart_cprintf(const char *fmt, ...); - -/** - * @brief Provides to print UART logs. - * - * @param fmt [IN] The log information. - * - * @since 12 - */ -void uart_printf_func(const char *fmt, ...); - -/** - * @brief Provides to print TEE logs. - * - * @param log_level [IN] The level of the log. - * @param fmt [IN] The log information. - * - * @since 12 - */ -void tee_print(LOG_LEVEL log_level, const char *fmt, ...); - -/** - * @brief Provides to print TEE driver logs. - * - * @param log_level [IN] The level of the log. - * @param log_tag [IN] The tag of the log. - * @param fmt [IN] The log information. - * - * @since 12 - */ -void tee_print_driver(LOG_LEVEL log_level, const char *log_tag, const char *fmt, ...); - -extern const char *g_debug_prefix; - -/** - * @brief Defines the API to print TEE log at the VERBO level. - * - * @since 12 - */ -#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_VERBO) -#ifdef DRIVER_LOG_TAG -#define tlogv(fmt, args...) \ - tee_print_driver(LOG_LEVEL_VERBO, DRIVER_LOG_TAG, "%s %d:" fmt "", TAG_VERB, __LINE__, ##args) -#else -#define tlogv(fmt, args...) tee_print(LOG_LEVEL_VERBO, "%s %d:" fmt "", TAG_VERB, __LINE__, ##args) -#endif /* DRIVER_LOG_TAG */ -#else -#define tlogv(fmt, args...) \ - do { \ - } while (0) -#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_VERBO */ - -/** - * @brief Defines the API to print TEE log at the DEBUG level. - * - * @since 12 - */ -#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_DEBUG) -#ifdef DRIVER_LOG_TAG -#define tlogd(fmt, args...) \ - tee_print_driver(LOG_LEVEL_DEBUG, DRIVER_LOG_TAG, "%s %d:" fmt "", TAG_DEBUG, __LINE__, ##args) -#else -#define tlogd(fmt, args...) tee_print(LOG_LEVEL_DEBUG, "%s %d:" fmt "", TAG_DEBUG, __LINE__, ##args) -#endif /* DRIVER_LOG_TAG */ -#else -#define tlogd(fmt, args...) \ - do { \ - } while (0) -#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_DEBUG */ - -/** - * @brief Defines the API to print TEE log at the INFO level. - * - * @since 12 - */ -#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_INFO) -#ifdef DRIVER_LOG_TAG -#define tlogi(fmt, args...) \ - tee_print_driver(LOG_LEVEL_INFO, DRIVER_LOG_TAG, "%s %d:" fmt "", TAG_INFO, __LINE__, ##args) -#else -#define tlogi(fmt, args...) tee_print(LOG_LEVEL_INFO, "%s %d:" fmt "", TAG_INFO, __LINE__, ##args) -#endif /* DRIVER_LOG_TAG */ -#else -#define tlogi(fmt, args...) \ - do { \ - } while (0) -#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_INFO */ - -/** - * @brief Defines the API to print TEE log at the WARNING level. - * - * @since 12 - */ -#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_WARNING) -#ifdef DRIVER_LOG_TAG -#define tlogw(fmt, args...) \ - tee_print_driver(LOG_LEVEL_WARN, DRIVER_LOG_TAG, "%s %d:" fmt "", TAG_WARN, __LINE__, ##args) -#else -#define tlogw(fmt, args...) tee_print(LOG_LEVEL_WARN, "%s %d:" fmt "", TAG_WARN, __LINE__, ##args) -#endif /* DRIVER_LOG_TAG */ -#else -#define tlogw(fmt, args...) \ - do { \ - } while (0) -#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_WARNING */ - -/** - * @brief Defines the API to print TEE log at the ERROR level. - * - * @since 12 - */ -#if (TA_LOG_LEVEL >= TA_LOG_LEVEL_ERROR) /* Always meet this condition. */ -#ifndef TLOGE_NO_TIMESTAMP -#ifdef DRIVER_LOG_TAG -#define tloge(fmt, args...) \ - tee_print_driver(LOG_LEVEL_ERROR, DRIVER_LOG_TAG, "%s %d:" fmt " ", TAG_ERROR, __LINE__, ##args) -#else -#define tloge(fmt, args...) tee_print(LOG_LEVEL_ERROR, "%s %d:" fmt " ", TAG_ERROR, __LINE__, ##args) -#endif /* DRIVER_LOG_TAG */ -#else -#define tloge(fmt, args...) printf("[%s] %s %d:" fmt " ", g_debug_prefix, TAG_ERROR, __LINE__, ##args) -#endif /* TLOGE_NO_TIMESTAMP */ -#else -#define tloge(fmt, args...) \ - do { \ - } while (0) -#endif /* TA_LOG_LEVEL >= TA_LOG_LEVEL_ERROR */ - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif /* __TEE_LOG_H */ diff --git a/tee/include/tee_mem_mgmt_api.h b/tee/include/tee_mem_mgmt_api.h deleted file mode 100644 index fa636a38486a6d5efb6896d04e12f26a07bc8b81..0000000000000000000000000000000000000000 --- a/tee/include/tee_mem_mgmt_api.h +++ /dev/null @@ -1,231 +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. - */ - - -#ifndef TEE_MEM_MGMT_API_H -#define TEE_MEM_MGMT_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_mem_mgmt_api.h - * - * @brief Provides APIs for memory management. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" -#include "tee_mem_monitoring_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The definitions below are defined by Global Platform or Platform SDK released previously - * for compatibility. - * Do not make any change to the content below. - */ -#ifndef ZERO_SIZE_PTR -#define ZERO_SIZE_PTR ((void *)16) -#define zero_or_null_ptr(x) ((unsigned long)(x) <= (unsigned long)ZERO_SIZE_PTR) -#endif - -enum MALLOC_HINT { - ZERO = 0, - NOT_ZERO = 1, - ALIGN_004 = 0x80000002, - /* Buffer alignment */ - ALIGN_008 = 0x80000003, - ALIGN_016 = 0x80000004, - ALIGN_032 = 0x80000005, - ALIGN_064 = 0x80000006, - ALIGN_128 = 0x80000007, - ALIGN_256 = 0x80000008, - ALIGN_004_ZERO = 0x80000012, - /* The buffer is 8-byte aligned and initialized to zeros. */ - ALIGN_008_ZERO = 0x80000013, - ALIGN_016_ZERO = 0x80000014, - ALIGN_032_ZERO = 0x80000015, - ALIGN_064_ZERO = 0x80000016, - ALIGN_128_ZERO = 0x80000017, - ALIGN_256_ZERO = 0x80000018, -}; - -#define TEE_MALLOC_FILL_ZERO 0x00000000 -#define TEE_MALLOC_NO_FILL 0x00000001 -#define TEE_MALLOC_NO_SHARE 0x00000002 - -#define TEE_MEMORY_ACCESS_READ 0x00000001 -#define TEE_MEMORY_ACCESS_WRITE 0x00000002 -#define TEE_MEMORY_ACCESS_ANY_OWNER 0x00000004 - -#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2) -/** - * @brief Fills x into the first size bytes of the buffer. - * - * @param buffer Indicates the pointer to the buffer. - * @param x Indicates the value to fill. - * @param size Indicates the number of bytes to fill. - * - * @since 12 - * @version 1.0 - */ -void TEE_MemFill(void *buffer, uint8_t x, size_t size); -#else -/** - * @brief Fills x into the first size bytes of the buffer. - * - * @param buffer Indicates the pointer to the buffer. - * @param x Indicates the value to fill. - * @param size Indicates the number of bytes to fill. - * - * @since 12 - * @version 1.0 - */ -void TEE_MemFill(void *buffer, uint32_t x, size_t size); -#endif - -/** - * @brief Copies bytes. - * - * @param dest Indicates the pointer to the buffer that holds the bytes copied. - * @param src Indicates the pointer to the buffer that holds the bytes to copy. - * @param size Indicates the number of bytes to copy. - * - * @since 12 - * @version 1.0 - */ -void TEE_MemMove(void *dest, const void *src, size_t size); - -/** - * @brief Allocates space of the specified size for an object. - * - * @param size Indicates the size of the memory to be allocated. - * @param hint Indicates a hint to the allocator. The value 0 indicates that the memory block - * returned is filled with "\0". - * - * @return Returns a pointer to the newly allocated space if the operation is successful. - * @return Returns a NULL pointer if the allocation fails. - * - * @since 12 - * @version 1.0 - */ -void *TEE_Malloc(size_t size, uint32_t hint); - - /** - * @brief Releases the memory allocated by TEE_Malloc. - * - * If the buffer is a NULL pointer, TEE_Free does nothing. - * The buffer to be released must have been allocated by TEE_Malloc or TEE_Realloc and cannot be - * released repeatedly. Otherwise, unexpected result may be caused. - * - * @param buffer Indicates the pointer to the memory to release. - * - * @since 12 - * @version 1.0 - */ -void TEE_Free(void *buffer); - -/** - * @brief Reallocates memory. - * - * If new_size is greater than the old size, the content of the original memory does not change - * and the space in excess of the old size contains unspecified content. - * If the new size of the memory object requires movement of the object, the space for the previous - * instantiation of the object is deallocated. - * If the space cannot be allocated, the original object remains allocated and this function - * returns a NULL pointer. - * If the buffer is NULL, this function is equivalent to TEE_Malloc. - * - * @param buffer Indicates the pointer to the memory to reallocate. - * @param new_size Indicates the new size required. - * - * @return Returns a pointer to the allocated memory if the operation is successful. - * @return Returns a NULL pointer if the operation fails. - * - * @since 12 - * @version 1.0 - */ -void *TEE_Realloc(void *buffer, size_t new_size); - -/** - * @brief Compares memory content from the beginning. - * - * @param buffer1 Indicates the pointer to the first buffer. - * @param buffer2 Indicates the pointer to the second buffer. - * @param size Indicates the number of the bytes to compare. - * - * @return Returns –1 if buffer1 < buffer2. - * @return Returns 0 if buffer1 == buffer2. - * @return Returns 1 if buffer1 > buffer2. - * - * @since 12 - * @version 1.0 - */ -int32_t TEE_MemCompare(const void *buffer1, const void *buffer2, size_t size); - -/** - * @brief Checks whether this TA has the requested permissions to access a buffer. - * - * @param accessFlags Indicates the access permissions to check. - * @param buffer Indicates the pointer to the target buffer. - * @param size Indicates the size of the buffer to check. - * - * @return Returns TEE_SUCCESS if the TA has the requested permissions. - * @return Returns TEE_ERROR_ACCESS_DENIED otherwise. - */ -TEE_Result TEE_CheckMemoryAccessRights(uint32_t accessFlags, const void *buffer, size_t size); - -/** - * @brief Sets the TA instance data pointer. - * - * @param instanceData Indicates the pointer to the global TA instance data. - * - * @since 12 - * @version 1.0 - */ -void TEE_SetInstanceData(void *instanceData); - -/** - * @brief Obtains the instance data pointer set by the TA using TEE_SetInstanceData. - * - * @return Returns the pointer to the instance data set by TEE_SetInstanceData - * @return or NULL if no instance data pointer has been set. - * - * @since 12 - * @version 1.0 - */ -void *TEE_GetInstanceData(void); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_object_api.h b/tee/include/tee_object_api.h deleted file mode 100644 index 723f576c981f4b6db6624074d9c0e6f9401d4ed4..0000000000000000000000000000000000000000 --- a/tee/include/tee_object_api.h +++ /dev/null @@ -1,384 +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. - */ - -#ifndef __TEE_OBJECT_API_H -#define __TEE_OBJECT_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_object_api.h - * - * @brief Provides trusted storage APIs. - * - * You can use these APIs to implement trusted storage features. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines HANDLE_NULL, which is used to denote the absence of a handle. - * - * @since 12 - */ -#define TEE_HANDLE_NULL 0x00000000 - -/** - * @brief Enumerates the usages of the key of the TEE_ObjectHandle. - * - * @since 12 - */ -enum Usage_Constants { - /** The object's key is extractable. */ - TEE_USAGE_EXTRACTABLE = 0x00000001, - /** Used for encryption. */ - TEE_USAGE_ENCRYPT = 0x00000002, - /** Used for decryption. */ - TEE_USAGE_DECRYPT = 0x00000004, - /** Used for hash calculation. */ - TEE_USAGE_MAC = 0x00000008, - /** Used for creating a signature. */ - TEE_USAGE_SIGN = 0x00000010, - /** Used for signature verification. */ - TEE_USAGE_VERIFY = 0x00000020, - /** Used for key derivation. */ - TEE_USAGE_DERIVE = 0x00000040, - /** Used for object initialization, with all permissions assigned by default. */ - TEE_USAGE_DEFAULT = 0xFFFFFFFF, -}; - -/** - * @brief Defines information about the object pointed to by the flag of the TEE_ObjectHandle, - * for example, whether the object is a persistent object or is initialized. - * - * @since 12 - */ -enum Handle_Flag_Constants { - /** The object is a persistent object. */ - TEE_HANDLE_FLAG_PERSISTENT = 0x00010000, - /** The object is initialized. */ - TEE_HANDLE_FLAG_INITIALIZED = 0x00020000, - /** Reserved */ - TEE_HANDLE_FLAG_KEY_SET = 0x00040000, - /** Reserved */ - TEE_HANDLE_FLAG_EXPECT_TWO_KEYS = 0x00080000, -}; - -/** - * @brief Defines a value attribute identifier flag. - * - * @since 12 - */ -#define TEE_ATTR_FLAG_VALUE 0x20000000 - -/** - * @brief Defines a public attribute identifier flag. - * - * @since 12 - */ -#define TEE_ATTR_FLAG_PUBLIC 0x10000000 - -/** - * @brief Check whether the attribute is a buffer. - * - * @since 12 - */ -#define TEE_ATTR_IS_BUFFER(attribute_id) ((((attribute_id) << 2) >> 31) == 0) - -/** - * @brief Check whether the attribute is a value. - * - * @since 12 - */ -#define TEE_ATTR_IS_VALUE(attribute_id) ((((attribute_id) << 2) >> 31) == 1) - -/** - * @brief Check whether the attribute is protected. - * - * @since 12 - */ -#define TEE_ATTR_IS_PROTECTED(attribute_id) ((((attribute_id) << 3) >> 31) == 0) - -/** - * @brief Check whether the attribute is public. - * - * @since 12 - */ -#define TEE_ATTR_IS_PUBLIC(attribute_id) ((((attribute_id) << 3) >> 31) == 1) - -/** - * @brief Obtains a buffer attribute from the TEE_Attribute struct of the object pointed - * to by TEE_ObjectHandle. - * - * The members in the TEE_Attribute struct must be ref. If the TEE_Attribute is private, - * the Usage_Constants of the object must include TEE_USAGE_EXTRACTABLE. - * - * @param object Indicates the handle of the object. - * @param attributeID Indicates the ID of the attribute to obtain, for example, TEE_ObjectAttribute. - * The attribute ID can also be customized. - * @param buffer Indicates the pointer to the buffer that stores the attribute obtained. - * @param size Indicates the pointer to the length of the content stored. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the TEE_Attribute cannot be found in the object - * or the object is not initialized. - * @return Returns TEE_ERROR_SHORT_BUFFER if the buffer is too small to store the content obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, size_t *size); - -/** - * @brief Obtains a value attribute from the TEE_Attribute of an object. - * - * The members of the TEE_Attribute struct must be values. If the TEE_Attribute is private, - * the Usage_Constants of the object must include TEE_USAGE_EXTRACTABLE. - * - * @param object Indicates the handle of the object. - * @param attributeID Indicates the ID of the attribute to obtain, for example, TEE_ObjectAttribute. - * The attribute ID can also be customized. - * @param a Indicates the pointer to the placeholder filled with the attribute field a. - * @param b Indicates the pointer to the placeholder filled with the attribute field b. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the TEE_Attribute cannot be found in the object - * or the object is not initialized. - * @return Returns TEE_ERROR_ACCESS_DENIED if TEE_Attribute is private - * but the object Usage_Constants does not contain the TEE_USAGE_EXTRACTABLE flag. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b); - -/** - * @brief Closes a TEE_ObjectHandle object. - * - * The object can be persistent or transient. - * - * @param object Indicates the TEE_ObjectHandle object to close. - * - * @since 12 - * @version 1.0 - */ -void TEE_CloseObject(TEE_ObjectHandle object); - -/** - * @brief Allocates an uninitialized object to store keys. - * - * objectType and maxObjectSize must be specified. - * - * @param objectType Indicates the type of the object to create. The value is TEE_ObjectType. - * @param maxObjectSize Indicates the maximum number of bytes of the object. - * @param object Indicates the pointer to the handle of the newly created object. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_OUT_OF_MEMORY if the memory is insufficient. - * @return Returns TEE_ERROR_NOT_SUPPORTED if the object type is not supported. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AllocateTransientObject(uint32_t objectType, uint32_t maxObjectSize, TEE_ObjectHandle *object); - -/** - * @brief Releases a transient object that is previously allocated with TEE_AllocateTransientObject. - * - * After the function is called, the handle becomes invalid and all allocated resources are released. - * TEE_FreeTransientObject and TEE_AllocateTransientObject are used in pairs. - * - * @param object Indicates the TEE_ObjectHandle to release. - * - * @since 12 - * @version 1.0 - */ -void TEE_FreeTransientObject(TEE_ObjectHandle object); - -/** - * @brief Resets a transient object to its initial state after allocation. - * - * You can use an allocated object, which has not been initialized or used to store a key, to store a key. - * - * @param object Indicates the TEE_ObjectHandle to reset. - * - * @since 12 - * @version 1.0 - */ -void TEE_ResetTransientObject(TEE_ObjectHandle object); - -/** - * @brief Populates an uninitialized object with object attributes passed by the TA in the attrs parameter. - * - * The object must be uninitialized. \n - * The attrs parameter is passed by a TA. - * - * @param object Indicates the handle on a created but uninitialized object. - * @param attrs Indicates the pointer to an array of object attributes, which can be one or more TEE_Attributes. - * @param attrCount Indicates the number of members in the attribute array. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_BAD_PARAMETERS if an incorrect or inconsistent attribute value is detected. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_PopulateTransientObject(TEE_ObjectHandle object, TEE_Attribute *attrs, uint32_t attrCount); - -/** - * @brief Initializes the TEE_Attribute of the buffer type. - * - * The members in the TEE_Attribute struct must be ref. - * - * @param attr Indicates the pointer to the TEE_Attribute initialized. - * @param attributeID Indicates the ID assigned to the TEE_Attribute. - * @param buffer Indicates the pointer to the buffer that stores the content to be allocated. - * @param length Indicates the length of the assigned value, in bytes. - * - * @since 12 - * @version 1.0 - */ -void TEE_InitRefAttribute(TEE_Attribute *attr, uint32_t attributeID, void *buffer, size_t length); - -/** - * @brief Initializes a TEE_Attribute. - * - * @param attr Indicates the pointer to the TEE_Attribute initialized. - * @param attributeID Indicates the ID assigned to the TEE_Attribute. - * @param a Indicates the value to be assigned to the member a in the TEE_Attribute. - * @param b Indicates the value to be assigned to the member b in the TEE_Attribute. - * - * @since 12 - * @version 1.0 - */ -void TEE_InitValueAttribute(TEE_Attribute *attr, uint32_t attributeID, uint32_t a, uint32_t b); - -/** - * @brief Generates a random key or a key pair and populates a transient key object with the generated key. - * - * @param object Indicates a transient object used to hold the generated key. - * @param keySize Indicates the number of bytes of the key. - * @param params Indicates the pointer to the parameters for key generation. - * @param paramCount Indicates the number of parameters required for key generation. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_BAD_PARAMETERS if the type of the key generated does not match - * the key that can be held in the transient object. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GenerateKey(TEE_ObjectHandle object, uint32_t keySize, TEE_Attribute *params, uint32_t paramCount); - -/** - * @brief Get the information of the object data part, the total length of the data part and the current - * position of the data stream. - * - * @param object Indicates the handle of the object. - * @param pos Indicates the data stream position. - * @param len Indicates the data stream length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns others if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_InfoObjectData(TEE_ObjectHandle object, uint32_t *pos, uint32_t *len); - -/** - * @brief Obtains TEE_ObjectInfo. - * - * This function obtains TEE_ObjectInfo and copies the obtained information to the pre-allocated space - * pointed to by objectInfo. - * - * @param object Indicates the handle of the object. - * @param objectInfo Indicates the pointer to the TEE_ObjectInfo obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_CORRUPT_OBJECT if the object is corrupted and the object handle will be closed. - * @return Returns TEE_ERROR_STORAGE_NOT_AVAILABLE if the object is stored - * in a storage area that is inaccessible currently. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetObjectInfo1(TEE_ObjectHandle object, TEE_ObjectInfo *objectInfo); - -/** - * @brief Assigns the TEE_Attribute of an initialized object to an uninitialized object. - * - * This function populates an uninitialized object with TEE_Attribute. - * That is, it copies TEE_Attribute of srcobject to destobject. - * The TEE_Attribute types and IDs of the two objects must match. - * - * @param destObject Indicates the uninitialized object. - * @param srcObject Indicates the initialized object. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_CORRUPT_OBJECT if the object is corrupted and the object handle will be closed. - * @return Returns TEE_ERROR_STORAGE_NOT_AVAILABLE if the object is stored - * in a storage area that is inaccessible currently. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_CopyObjectAttributes1(TEE_ObjectHandle destObject, TEE_ObjectHandle srcObject); - -/** - * @brief Restricts the objectUse bit of an object. - * - * This bit determines the usage of the key in the object. The value range is Usage_Constant. - * The bit in the objectUse parameter can be set as follows: \n - * If it is set to 1, the corresponding usage flag in the object is left unchanged. \n - * If it is set to 0, the corresponding usage flag in the object is cleared. \n - * The newly created object contains all Usage_Constant, and the usage flag can be cleared only. - * - * @param object Indicates the TEE_ObjectHandle of the target object. - * @param objectUsage Indicates the new object usage. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_CORRUPT_OBJECT if the object is corrupted and the object handle will be closed. - * @return Returns TEE_ERROR_STORAGE_NOT_AVAILABLE if the object is stored - * in a storage area that is inaccessible currently. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RestrictObjectUsage1(TEE_ObjectHandle object, uint32_t objectUsage); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_property_api.h b/tee/include/tee_property_api.h deleted file mode 100644 index 029e28eb74a81d251a0d8e4ca838d10b0f0581cd..0000000000000000000000000000000000000000 --- a/tee/include/tee_property_api.h +++ /dev/null @@ -1,266 +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. - */ - -#ifndef TEE_PROPERTY_API_H -#define TEE_PROPERTY_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_property_api.h - * - * @brief Reference of TEE object api definitions. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif -/** - * The definitions below are defined by Global Platform or Platform SDK released previously - * for compatibility. - * Do not make any change to the content below. - */ - -/** - * @brief Enumerates the types of the property set. - * - * @since 12 - */ -typedef enum { - TEE_PROPSET_UNKNOW = 0, - TEE_PROPSET_TEE_IMPLEMENTATION = 0xFFFFFFFD, - TEE_PROPSET_CURRENT_CLIENT = 0xFFFFFFFE, - TEE_PROPSET_CURRENT_TA = 0xFFFFFFFF, -} Pseudo_PropSetHandle; - -typedef uint32_t TEE_PropSetHandle; - -/** - * @brief Obtains a property from a property set and converts its value into a printable string. - * - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param valueBuffer Indicates the pointer to the buffer for holding the property value obtained. - * @param valueBufferLen Indicates the pointer to the buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * @return Returns TEE_ERROR_SHORT_BUFFER if the value buffer is too small to hold the property value obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsString(TEE_PropSetHandle propsetOrEnumerator, const char *name, char *valueBuffer, - size_t *valueBufferLen); - -/** - * @brief Obtains a property from a property set and converts its value into a Boolean value. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param value Indicates the pointer to the variable that holds the property value obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsBool(TEE_PropSetHandle propsetOrEnumerator, const char *name, bool *value); - -/** - * @brief Obtains a property from a property set and converts its value into a 32-bit unsigned integer. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param value Indicates the pointer to the variable that holds the property value obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsU32(TEE_PropSetHandle propsetOrEnumerator, const char *name, uint32_t *value); - -#if defined(API_LEVEL) && (API_LEVEL >= API_LEVEL1_2) -/** - * @brief Obtains a property from a property set and converts its value into a 64-bit unsigned integer. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param value Indicates the pointer to the variable that holds the property value obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsU64(TEE_PropSetHandle propsetOrEnumerator, const char *name, uint64_t *value); -#endif // API_LEVEL - -/** - * @brief Obtains a property from a property set and converts its value into a binary block. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param valueBuffer Indicates the pointer to the buffer for holding the property value obtained. - * @param valueBufferLen Indicates the pointer to the buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * @return TEE_ERROR_SHORT_BUFFER the value buffer is not large enough to hold the whole property value - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsBinaryBlock(TEE_PropSetHandle propsetOrEnumerator, const char *name, void *valueBuffer, - size_t *valueBufferLen); - -/** - * @brief Obtains a property from a property set and converts its value to the TEE_UUID struct. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param value Indicates the pointer to the variable that holds the property value obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsUUID(TEE_PropSetHandle propsetOrEnumerator, const char *name, TEE_UUID *value); - -/** - * @brief Obtains a property from a property set and converts its value to the TEE_Identity struct. - * - * @param propsetOrEnumerator Indicates one of the TEE_PROPSET_XXX pseudo-handles or a handle on a property enumerator. - * @param name Indicates the pointer to the zero-terminated string containing the name of the property to obtain. - * @param value Indicates the pointer to the variable that holds the property value obtained. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the target property cannot be obtained. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyAsIdentity(TEE_PropSetHandle propsetOrEnumerator, const char *name, TEE_Identity *value); - -/** - * @brief Allocates a property enumerator object. - * - * @param enumerator Indicates the pointer to the property enumerator filled with an opaque handle. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_OUT_OF_MEMORY if there is no enough resources to allocate the property enumerator. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AllocatePropertyEnumerator(TEE_PropSetHandle *enumerator); - -/** - * @brief Releases a property enumerator object. - * - * @param enumerator Indicates the handle on the property enumerator to release. - * - * @return void - * - * @since 12 - * @version 1.0 - */ -void TEE_FreePropertyEnumerator(TEE_PropSetHandle enumerator); - -/** - * @brief Starts to enumerate the properties in an enumerator. - * - * @param enumerator Indicates the handle on the enumerator. - * @param propSet Indicates the pseudo-handle on the property set to enumerate. - * - * @return void - * - * @since 12 - * @version 1.0 - */ -void TEE_StartPropertyEnumerator(TEE_PropSetHandle enumerator, TEE_PropSetHandle propSet); - -/** - * @brief Resets a property enumerator immediately after allocation. - * - * @param enumerator Indicates the handle on the enumerator to reset. - * - * @return void - * - * @since 12 - * @version 1.0 - */ -void TEE_ResetPropertyEnumerator(TEE_PropSetHandle enumerator); - -/** - * @brief Obtains the name of this property in an enumerator. - * - * @param enumerator Indicates the handle on the enumerator. - * @param nameBuffer Indicates the pointer to the buffer that stores the property name obtained. - * @param nameBufferLen Indicates the pointer to the buffer length. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the property is not found because the enumerator has not started - * or has reached the end of the property set. - * @return Returns TEE_ERROR_SHORT_BUFFER if the buffer is too small to hold the property name. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetPropertyName(TEE_PropSetHandle enumerator, void *nameBuffer, size_t *nameBufferLen); - -/** - * @brief Obtains the next property in an enumerator. - * - * @param enumerator Indicates the handle on the enumerator. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_ITEM_NOT_FOUND if the property is not found because the enumerator - * has not started or has reached the end of the property set. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetNextProperty(TEE_PropSetHandle enumerator); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_rtc_time_api.h b/tee/include/tee_rtc_time_api.h deleted file mode 100644 index 37b7047c53d072b306dbc393f04c4e4f6d4006fc..0000000000000000000000000000000000000000 --- a/tee/include/tee_rtc_time_api.h +++ /dev/null @@ -1,117 +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. - */ - -#ifndef __TEE_RTC_TIME_API_H -#define __TEE_RTC_TIME_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_rtc_time_api.h - * - * @brief Provides APIs about rtc timer. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Create a secure timer. - * - * @param time_seconds Indicates the security duration. - * @param timer_property Indicates the property of the timer, where only need to specify the timer type. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other values if the operation fails. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_create_timer(uint32_t time_seconds, TEE_timer_property *timer_property); - -/** - * @brief Destory a secure timer. - * - * @param timer_property Indicates the property of the timer, where only need to specify the timer type. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other values if the operation fails. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_destory_timer(TEE_timer_property *timer_property); - -/** - * @brief Obtain the set timing duration. - * - * @param timer_property Indicates the property of the timer, where only need to specify the timer type. - * @param time_seconds Indicates the timing duration. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other values if the operation fails. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_get_timer_expire(TEE_timer_property *timer_property, uint32_t *time_seconds); - -/** - * @brief Obtain the remain timing duration. - * - * @param timer_property Indicates the property of the timer, where only need to specify the timer type. - * @param time_seconds Indicates the remain timing duration. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns other values if the operation fails. - * - * @since 12 - * @version 1.0 - */ -TEE_Result tee_ext_get_timer_remain(TEE_timer_property *timer_property, uint32_t *time_seconds); - -/** - * @brief Obtain the current timing of the RTC clock. - * @attention The obtained time is in seconds and cannot be converted to universal time. - * - * @return The RTC clock count(in seconds). - * - * @since 12 - * @version 1.0 - */ -unsigned int tee_get_secure_rtc_time(void); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_service_public.h b/tee/include/tee_service_public.h deleted file mode 100644 index 3a3ea2e0df649fecb03b73965370db63fd436026..0000000000000000000000000000000000000000 --- a/tee/include/tee_service_public.h +++ /dev/null @@ -1,159 +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. - */ - -#ifndef _TEE_SERVICE_PUBLIC_H_ -#define _TEE_SERVICE_PUBLIC_H_ - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_service_public.h - * - * @brief Provides the TEE service public function for developers. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*func_ptr)(void); - -/** - * @brief Defines the size of the message queue for the TEE service - * - * @since 12 - */ -#define TEE_SERVICE_MSG_QUEUE_SIZE 100 - -/** - * @brief Defines the arguments of a message. - * - * @since 12 - */ -typedef struct { - uint64_t arg0; - uint64_t arg1; - uint64_t arg2; - uint64_t arg3; - uint64_t arg4; - uint64_t arg5; - uint64_t arg6; - uint64_t arg7; -} args_t; - -/** - * @brief Defines the register information of TA. - * - * @since 12 - */ -struct reg_ta_info { - uint32_t taskid; - TEE_UUID uuid; - uint32_t userid; - /** Just for ssa, other tasks shall ignore it. */ - bool ssa_enum_enable; -}; - -/** - * @brief Defines the IPC message of TEE service. - * - * @since 12 - */ -typedef union { - args_t args_data; - struct reg_ta_info reg_ta; -} tee_service_ipc_msg; - -/** - * @brief Defines the IPC request message of TEE service. - * - * @since 12 - */ -struct tee_service_ipc_msg_req { - uint32_t cmd; - tee_service_ipc_msg msg; -}; - -/** - * @brief Defines the IPC response message of TEE service. - * - * @since 12 - */ -typedef struct { - TEE_Result ret; - tee_service_ipc_msg msg; -} tee_service_ipc_msg_rsp; - -/** - * @brief Defines the message of the TEE service. - * - * @since 12 - */ -typedef struct { - uint32_t msg_id; - uint32_t sender; - tee_service_ipc_msg msg; -} tee_service_msg_t; - -/** - * @brief Defines the message queue for the TEE service. - * - * @since 12 - */ -typedef struct { - uint32_t in; - uint32_t out; - tee_service_msg_t msg[TEE_SERVICE_MSG_QUEUE_SIZE]; -} tee_service_msg_queue_t; - -/** - * @brief Provides to send IPC synchronization messages to a specified service - * and receive responses from the service. - * - * @param task_name Indicates the task name of recipient. - * @param snd_cmd Indicates the command ID of the send message. - * @param snd_msg Indicates the send message. - * @param ack_cmd Indicates the ID of the ack cmd to be received. - * @param rsp_msg Indicates the service response message. - * - * @since 12 - * @version 1.0 - */ -void tee_common_ipc_proc_cmd(const char *task_name, - uint32_t snd_cmd, const tee_service_ipc_msg *snd_msg, - uint32_t ack_cmd, tee_service_ipc_msg_rsp *rsp_msg); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_sharemem_ops.h b/tee/include/tee_sharemem_ops.h deleted file mode 100644 index 479964ff3140a4547b7e7c8ad9da984a69790457..0000000000000000000000000000000000000000 --- a/tee/include/tee_sharemem_ops.h +++ /dev/null @@ -1,128 +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. - */ - -#ifndef TEE_SHAREMEM_OPS_H -#define TEE_SHAREMEM_OPS_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_sharemem_ops.h - * - * @brief Provides APIs for developers to apply for shared memory. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Alloc shared memory in TEE. - * - * @param uuid Indicates the UUID of TA. - * @param size Indicates the size of the requested shared memory. - * - * @return Returns a pointer to the newly allocated space if the operation is successful. - * Returns a NULL pointer if the allocation fails. - * - * @since 12 - * @version 1.0 - */ -void *tee_alloc_sharemem_aux(const struct tee_uuid *uuid, uint32_t size); - -/** - * @brief Alloc continuous shared memory in TEE. - * - * @param uuid Indicates the UUID of TA. - * @param size Indicates the size of the requested shared memory. - * - * @return Returns a pointer to the newly allocated space if the operation is successful. - * Returns a NULL pointer if the allocation fails. - * - * @since 12 - * @version 1.0 - */ -void *tee_alloc_coherent_sharemem_aux(const struct tee_uuid *uuid, uint32_t size); - -/** - * @brief Free the shared memory in TEE. - * - * @param addr Indicates the shared memory address that will be freed. - * @param size Indicates the size of the shared memory. - * - * @return Returns 0 if the operation is successful. - * Returns others if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -uint32_t tee_free_sharemem(void *addr, uint32_t size); - -/** - * @brief Copy shared memory from source task. - * - * @param src_task Indicates the pid of the source task. - * @param src Indicates the address of the source buffer. - * @param src_size Indicates the size of the source buffer. - * @param dst Indicates the address of the destination buffer. - * @param dst_size Indicates the size of the destination buffer. - * - * @return Returns 0 if the operation is successful. - * Returns -1 if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -int32_t copy_from_sharemem(uint32_t src_task, uint64_t src, uint32_t src_size, uintptr_t dst, uint32_t dst_size); - -/** - * @brief Copy shared memory to destination task. - * - * @param src Indicates the address of the source buffer. - * @param src_size Indicates the size of the source buffer. - * @param dst_task Indicates the pid of the destination task. - * @param dst Indicates the address of the destination buffer. - * @param dst_size Indicates the size of the destination buffer. - * - * @return Returns 0 if the operation is successful. - * Returns -1 if the operation is failed. - * - * @since 12 - * @version 1.0 - */ -int32_t copy_to_sharemem(uintptr_t src, uint32_t src_size, uint32_t dst_task, uint64_t dst, uint32_t dst_size); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/include/tee_time_api.h b/tee/include/tee_time_api.h deleted file mode 100644 index 58ea6d51f0a94a5b09500f3df678033779f923e5..0000000000000000000000000000000000000000 --- a/tee/include/tee_time_api.h +++ /dev/null @@ -1,131 +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. - */ - -#ifndef __TEE_TIME_API_H -#define __TEE_TIME_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_time_api.h - * - * @brief Provides APIs for managing the Trusted Execution Environment (TEE) time. - * - * You can use these APIs to implement time-related features in a TEE. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Obtains the current TEE system time. - * - * @param time Indicates the pointer to the current system time obtained. - * - * @since 12 - * @version 1.0 - */ -void TEE_GetSystemTime(TEE_Time *time); - -/** - * @brief Waits for the specified period of time, in milliseconds. - * - * @param timeout Indicates the period of time to wait, in milliseconds. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_CANCEL if the wait is canceled. - * @return Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_Wait(uint32_t timeout); - -/** - * @brief Obtains the persistent time of this trusted application (TA). - * - * @param time Indicates the pointer to the persistent time of the TA. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_TIME_NOT_SET if the persistent time has not been set. - * @return Returns TEE_ERROR_TIME_NEEDS_RESET if the persistent time is corrupted and - * the application is not longer trusted. - * @return Returns TEE_ERROR_OVERFLOW if the number of seconds in the TA persistent time - * exceeds the range of uint32_t. - * @return Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetTAPersistentTime(TEE_Time *time); - -/** - * @brief Sets the persistent time for this TA. - * - * @param time Indicates the pointer to the persistent time of the TA. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * @return Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * @return Returns TEE_ERROR_STORAGE_NO_SPACE if the storage space is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SetTAPersistentTime(TEE_Time *time); - -/** - * @brief Obtains the current Rich Execution Environment (REE) system time. - * - * @param time Indicates the pointer to the REE system time obtained. - * - * @since 12 - * @version 1.0 - */ -void TEE_GetREETime(TEE_Time *time); - -/** - * @brief Obtains the string format of the current Rich Execution Environment (REE) system time. - * - * @param tim_str Indicates the REE system time string. - * @param time_str_len Indicates the length of the string. - * - * @since 12 - * @version 1.0 - */ -void TEE_GetREETimeStr(char *tim_str, uint32_t time_str_len); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_trusted_storage_api.h b/tee/include/tee_trusted_storage_api.h deleted file mode 100644 index 2638db1d48f7e794932220646e7f69492c459639..0000000000000000000000000000000000000000 --- a/tee/include/tee_trusted_storage_api.h +++ /dev/null @@ -1,410 +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. - */ - -#ifndef __TEE_TRUSTED_STORAGE_API_H -#define __TEE_TRUSTED_STORAGE_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_trusted_storage_api.h - * - * @brief Provides trusted storage APIs. - * - * You can use these APIs to implement trusted storage features. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include "tee_defines.h" -#include "tee_object_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines the start position in the data stream associated with an object. - * It is used in the TEE_SeekObjectData function. - * - * @since 12 - */ -enum __TEE_Whence { - /* Set the start position to the beginning of the data stream. */ - TEE_DATA_SEEK_SET = 0, - /* Set the start position to the current data stream position. */ - TEE_DATA_SEEK_CUR, - /* Set the start position to the end of the data stream. */ - TEE_DATA_SEEK_END -}; - -struct __TEE_ObjectEnumHandle; - -/** - * @brief Defines the pointer to TEE_ObjectEnumHandle. - * - * @see __TEE_ObjectEnumHandle - * - * @since 12 - */ -typedef struct __TEE_ObjectEnumHandle *TEE_ObjectEnumHandle; - -typedef uint32_t TEE_Whence; - -/** - * @brief Defines the storage ID, which identifies the storage space of the application. - * - * @since 12 - */ -enum Object_Storage_Constants { - /* Separate private storage space for each application. */ - TEE_OBJECT_STORAGE_PRIVATE = 0x00000001, - /* Separate personal storage space for application. */ - TEE_OBJECT_STORAGE_PERSO = 0x00000002, - /* Space for secure flash storage. */ - TEE_OBJECT_SEC_FLASH = 0x80000000, - /* Credential encrypted storage space. */ - TEE_OBJECT_STORAGE_CE = 0x80000002, -}; - -/** - * @brief Defines the system resource constraints, such as the maximum value for the data stream position indicator. - * - * @since 12 - */ -enum Miscellaneous_Constants { - /* Maximum length that the position indicator of the data stream can take. */ - TEE_DATA_MAX_POSITION = 0xFFFFFFFF, - /* Maximum length of the object ID, which can extend to 128 bytes. */ - TEE_OBJECT_ID_MAX_LEN = 64, -}; - -/** - * @brief Defines the maximum number of bytes that can be held in a data stream. - * - * @since 12 - */ -enum TEE_DATA_Size { - TEE_DATA_OBJECT_MAX_SIZE = 0xFFFFFFFF -}; - -/** - * @brief Defines the handleFlags of a TEE_ObjectHandle. - * The handleFlags determines the access permissions to the data stream associated with the object. - * - * @since 12 - */ -enum Data_Flag_Constants { - /** The data stream can be read. */ - TEE_DATA_FLAG_ACCESS_READ = 0x00000001, - /** The data stream can be written or truncated. */ - TEE_DATA_FLAG_ACCESS_WRITE = 0x00000002, - /** The data stream can be deleted or renamed. */ - TEE_DATA_FLAG_ACCESS_WRITE_META = 0x00000004, - /** Multiple TEE_ObjectHandles can be opened for concurrent read. */ - TEE_DATA_FLAG_SHARE_READ = 0x00000010, - /** Multiple TEE_ObjectHandles can be opened for concurrent write. */ - TEE_DATA_FLAG_SHARE_WRITE = 0x00000020, - /** Reserved. */ - TEE_DATA_FLAG_CREATE = 0x00000200, - /** - * Protect the existing file with the same name. Throw an error if the file with the same name exists; - * create a data file otherwise. - */ - TEE_DATA_FLAG_EXCLUSIVE = 0x00000400, - /** - * Protect the existing file with the same name. Throw an error if the file with the same name exists; - * create a data file otherwise. - */ - TEE_DATA_FLAG_OVERWRITE = 0x00000400, - /** Use AES256 if bit 28 is 1; use AES128 if bit 28 is 0. */ - TEE_DATA_FLAG_AES256 = 0x10000000, - /** If bit 29 is set to 1, open the earlier version preferentially. */ - TEE_DATA_FLAG_OPEN_AESC = 0x20000000, -}; - -/** - * @brief Creates a persistent object. - * - * This function creates a persistent object with initialized TEE_Attribute and data stream. - * You can use the returned handle to access the TEE_Attribute and data stream of the object. - * - * @param storageID Indicates the storage to use. The value is specified by Object_Storage_Constants. - * @param ojbectID Indicates the pointer to the object identifier, that is, the name of the object to create. - * @param objectIDLen Indicates the length of the object identifier, in bytes. It cannot exceed 128 bytes. - * @param flags Indicates the flags of the object created. The value can be - * one or more of Data_Flag_Constants or Handle_Flag_Constants. - * @param attributes Indicates the TEE_ObjectHandle of a transient object from which to take - * TEE_Attribute. It can be TEE_HANDLE_NULL if the persistent object contains no attribute. - * @param initialData Indicates the pointer to the initial data used to initialize the data stream data. - * @param initialDataLen Indicates the length of the initial data, in bytes. - * @param object Indicates the pointer to the TEE_ObjectHandle returned - * after the function is successfully executed. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_ITEM_NOT_FOUND if the storage specified by storageID does not exist. - * Returns TEE_ERROR_ACCESS_CONFLICT if an access conflict occurs. - * Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * Returns TEE_ERROR_STORAGE_NO_SPACE if there is no enough space to create the object. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_CreatePersistentObject(uint32_t storageID, const void *ojbectID, size_t objectIDLen, uint32_t flags, - TEE_ObjectHandle attributes, const void *initialData, size_t initialDataLen, - TEE_ObjectHandle *object); - -/** - * @brief Opens an existing persistent object. - * - * The handle returned can be used to access the TEE_Attribute and data stream of the object. - * - * @param storageID Indicates the storage to use. The value is specified by Object_Storage_Constants. - * @param ojbectID Indicates the pointer to the object identifier, that is, the name of the object to open. - * @param objectIDLen Indicates the length of the object identifier, in bytes. It cannot exceed 128 bytes. - * @param flags Indicates the flags of the object opened. - * The value can be one or more of Data_Flag_Constants or Handle_Flag_Constants. - * @param object Indicates the pointer to the TEE_ObjectHandle returned - * after the function is successfully executed. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_ITEM_NOT_FOUND if the storage specified by storageID does not exist - * or the object identifier cannot be found in the storage. - * Returns TEE_ERROR_ACCESS_CONFLICT if an access conflict occurs. - * Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_OpenPersistentObject(uint32_t storageID, const void *ojbectID, size_t objectIDLen, uint32_t flags, - TEE_ObjectHandle *object); - -/** - * @brief Reads data from the data stream associated with an object into the buffer. - * - * The TEE_ObjectHandle of the object must have been opened with the TEE_DATA_FLAG_ACCESS_READ permission. - * - * @param ojbect Indicates the TEE_ObjectHandle of the object to read. - * @param buffer Indicates the pointer to the buffer used to store the data read. - * @param size Indicates the number of bytes to read. - * @param count Indicates the pointer to the variable that contains the number of bytes read. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_ReadObjectData(TEE_ObjectHandle ojbect, void *buffer, size_t size, uint32_t *count); - -/** - * @brief Writes bytes from the buffer to the data stream associated with an object. - * - * The TEE_ObjectHandle must have been opened with the TEE_DATA_FLAG_ACCESS_WRITE permission. - * - * @param ojbect Indicates the TEE_ObjectHandle of the object. - * @param buffer Indicates the pointer to the buffer that stores the data to be written. - * @param size Indicates the number of bytes to be written. It cannot exceed 4096 bytes. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * Returns TEE_ERROR_STORAGE_NO_SPACE if the storage space is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_WriteObjectData(TEE_ObjectHandle ojbect, const void *buffer, size_t size); - -/** - * @brief Changes the size of a data stream. - * - * If the size is less than the current size of the data stream, all bytes beyond size are deleted. If the size - * is greater than the current size of the data stream, add 0s at the end of the stream to extend the stream. - * The object handle must be opened with the TEE_DATA_FLAG_ACCESS_WRITE permission. - * - * @param object Indicates the TEE_ObjectHandle of the object. - * @param size Indicates the new size of the data stream. It cannot exceed 4096 bytes. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_STORAGE_NO_SPACE if the storage space is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TruncateObjectData(TEE_ObjectHandle object, size_t size); - -/** - * @brief Sets the position of the data stream to which TEE_ObjectHandle points. - * - * The data position indicator is determined by the start position and an offset together. - * The whence parameter determines the start position. Its value is set in TEE_Whence as follows: - * TEE_DATA_SEEK_SET = 0: The start position is the beginning of the data stream. - * TEE_DATA_SEEK_CUR: The start position is the current position of the data stream. - * TEE_DATA_SEEK_END: The start position is the end of the data stream. - * If the parameter offset is a positive number, the data position is moved forward. - * If offset is a negative number, the data position is moved backward. - * - * @param object Indicates the TEE_ObjectHandle of the object. - * @param offset Indicates the number of bytes to move the data position. It cannot exceed 4096 bytes. - * @param whence Indicates the start position in the data stream to calculate the new position. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OVERFLOW if the position indicator resulting from this operation - * is greater than TEE_DATA_MAX_POSIT. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SeekObjectData(TEE_ObjectHandle object, int32_t offset, TEE_Whence whence); - -/** - * @brief Synchronizes the opened TEE_ObjectHandle and the corresponding security attribute file to the disk. - * - * @param object Indicates the TEE_ObjectHandle of the object. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_SyncPersistentObject(TEE_ObjectHandle object); - -/** - * @brief Changes the object identifier. - * - * The TEE_ObjectHandle must have been opened with the TEE_DATA_FLAG_ACCESS_WRITE_META permission. - * - * @param object Indicates the handle of the target object. - * @param newObjectID Indicates the pointer to the new object identifier. - * @param newObjectIDLen Indicates the length of the new object identifier. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_RenamePersistentObject(TEE_ObjectHandle object, void *newObjectID, size_t newObjectIDLen); - -/** - * @brief Allocates a handle on an uninitialized object enumerator. - * - * @param obj_enumerator Indicates the pointer to the handle of the newly created object enumerator. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_OUT_OF_MEMORY if the memory is not sufficient to complete the operation. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_AllocatePersistentObjectEnumerator(TEE_ObjectEnumHandle *obj_enumerator); - -/** - * @brief Releases all resources associated with an object enumerator handle. - * - * After this function is called, the object handle is no longer valid and all resources associated with - * the object enumerator handle will be reclaimed. - * TEE_FreePersistentObjectEnumerator and TEE_AllocatePersistentObjectEnumeratorare used in pairs. - * - * @param obj_enumerator Indicates the TEE_ObjectEnumHandle to release. - * - * @since 12 - * @version 1.0 - */ -void TEE_FreePersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator); - -/** - * @brief Resets an object enumerator handle to its initial state after allocation. - * - * @param obj_enumerator Indicates the TEE_ObjectEnumHandle of the object enumerator to reset. - * - * @since 12 - * @version 1.0 - */ -void TEE_ResetPersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator); - -/** - * @brief Starts the enumeration of all the objects in the given trusted storage. - * - * The object information can be obtained by using TEE_GetNextPersistentObject. - * - * @param obj_enumerator Indicates the TEE_ObjectEnumHandle of the object enumerator. - * @param storage_id Indicates the storage, in which the objects are enumerated. - * The value is specified by Object_Storage_Constants. - * Currently, only TEE_STORAGE_PRIVATE is supported. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ITEM_NOT_FOUND if storageID is not TEE_STORAGE_PRIVATE - * or there is no object in the specified storage. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_StartPersistentObjectEnumerator(TEE_ObjectEnumHandle obj_enumerator, uint32_t storage_id); - -/** - * @brief Obtains the next object in the object enumerator. - * - * Information such as TEE_ObjectInfo, objectID, and objectIDLen will be obtained. - * - * @param obj_enumerator Indicates the TEE_ObjectEnumHandle of the object enumerator. - * @param object_info Indicates the pointer to the obtainedTEE_ObjectInfo. - * @param object_id Indicates the pointer to the buffer used to store the obtained objectID. - * @param object_id_len Indicates the pointer to the objectIDLen. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ITEM_NOT_FOUND if the object enumerator has no element - * or the enumerator has not been initialized. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_GetNextPersistentObject(TEE_ObjectEnumHandle obj_enumerator, - TEE_ObjectInfo *object_info, void *object_id, size_t *object_id_len); - -/** - * @brief Closes a TEE_ObjectHandle and deletes the object. - * - * The object must be a persistent object, and the object handle must have been opened with - * the TEE_DATA_FLAG_ACCESS_WRITE_META permission. - * - * @param object Indicates the object handle to close. - * - * @return Returns TEE_SUCCESS if the operation is successful. - * Returns TEE_ERROR_STORAGE_NOT_AVAILABLE if the object is stored - * in a storage area that is inaccessible currently. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_CloseAndDeletePersistentObject1(TEE_ObjectHandle object); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif diff --git a/tee/include/tee_tui_gp_api.h b/tee/include/tee_tui_gp_api.h deleted file mode 100644 index b50011f695169a34657f6c2b8156bc205e81169b..0000000000000000000000000000000000000000 --- a/tee/include/tee_tui_gp_api.h +++ /dev/null @@ -1,454 +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. - */ - -#ifndef TASK_TUI_GP_API_H -#define TASK_TUI_GP_API_H - -/** - * @addtogroup TeeTrusted - * @{ - * - * @brief TEE(Trusted Excution Environment) API. - * Provides security capability APIs such as trusted storage, encryption and decryption, - * and trusted time for trusted application development. - * - * @since 12 - */ - -/** - * @file tee_tui_gp_api.h - * - * @brief Provides APIs for operating big integers. - * - * @library NA - * @kit TEEKit - * @syscap SystemCapability.Tee.TeeClient - * @since 12 - * @version 1.0 - */ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define TEE_TUI_NUMBER_BUTTON_TYPES 0x00000006 -#define TEE_STORAGE_PRIVATE 0x00000001 -#define DEFAULT_MAX_ENTRY_FIELDS 3 - -#define TUI_EXIT 8 - -/** - * @brief Enumerates the modes supported when displaying characters within an input entry field. - * - * @since 12 - */ -typedef enum { - /** Never visible, displayed as '*'. */ - TEE_TUI_HIDDEN_MODE = 0, - /** Always visible. */ - TEE_TUI_CLEAR_MODE, - /** Visible then hidden. */ - TEE_TUI_TEMPORARY_CLEAR_MODE -} TEE_TUIEntryFieldMode; - -/** - * @brief Enumerates the input types supported of the TUI entry field. - * - * @since 12 - */ -typedef enum { - /** When the field accepts only digits as inputs. */ - TEE_TUI_NUMERICAL = 0, - /** When the field accepts characters and digits as inputs. */ - TEE_TUI_ALPHANUMERICAL, -} TEE_TUIEntryFieldType; - -/** - * @brief Enumerates the TUI screen orientation. - * @attention Currently {@code TEE_TUI_LANDSCAPE} is not supported. - * - * @since 12 - */ -typedef enum { - /** Displayed as a portrait, i.e. vertically. */ - TEE_TUI_PORTRAIT = 0, - /** Displayed as a landscape, i.e. horizontally. */ - TEE_TUI_LANDSCAPE, -} TEE_TUIScreenOrientation; - -/** - * @brief Enumerates the types of the button. - * - * @since 12 - */ -typedef enum { - /** Used to delete the previous input digit. */ - TEE_TUI_CORRECTION = 0, - /** Exits the interface. */ - TEE_TUI_OK, - /** Cancels the operation and exits the interface. */ - TEE_TUI_CANCEL, - /** Used to trigger PIN verifcation and exit the interface.*/ - TEE_TUI_VALIDATE, - /** Exit the current interface and ask the TA to display the previous interface. */ - TEE_TUI_PREVIOUS, - /** Exit the current interface and ask the TA to display the next interface. */ - TEE_TUI_NEXT, -} TEE_TUIButtonType; - -/** - * @brief Enumerates source of the uesd image. - * - * @since 12 - */ -typedef enum { - /** No picture provided in the input. */ - TEE_TUI_NO_SOURCE = 0, - /** The picture provided as a memory pointer. */ - TEE_TUI_REF_SOURCE, - /** The picture provided by an object in the secure storage. */ - TEE_TUI_OBJECT_SOURCE, - /** The picture provided as a file. */ - TEE_TUI_FILE_SOURCE = 0x8001 -} TEE_TUIImageSource; - -/** - * @brief Represents the image in PNG format. - * - * @since 12 - */ -typedef struct { - TEE_TUIImageSource source; - struct { - void *image; - size_t imageLength; - } ref; - struct { - uint32_t storageID; - void *objectID; - size_t objectIDLen; - } object; - /** Represents the number of pixels of the width of the image. */ - uint32_t width; - /** Represents the number of pixels of the height of the image. */ - uint32_t height; -} TEE_TUIImage; - -/** - * @brief Enumerates the GP color index. - * - * @since 12 - */ -enum gp_color_idx { - /** Red color index. */ - RED_IDX = 0, - /** Green color index. */ - GREEN_IDX = 1, - /** Blue color index. */ - BLUE_IDX = 2, - /** RGB color index. */ - RGB_COLOR_IDX = 3, -}; - -/** - * @brief Represents the label for TA branding/message, generally on the top of screen. - * - * @since 12 - */ -typedef struct { - /** It's the string to put in the label area, which can be NULL. */ - char *text; - /** X-coordinate of the upper left corner of the text information. */ - uint32_t textXOffset; - /** Y-coordinate of the upper left corner of the text information. */ - uint32_t textYOffset; - /** RGB color used for displaying the text information. */ - uint8_t textColor[RGB_COLOR_IDX]; - /** The image is placed in the label area. */ - TEE_TUIImage image; - /** X-coordinate of the upper left corner of the image to be displayed. */ - uint32_t imageXOffset; - /** Y-coordinate of the upper left corner of the image to be displayed. */ - uint32_t imageYOffset; -} TEE_TUIScreenLabel; - -/** - * @brief Represents the content displayed on a button. - * - * @since 12 - */ -typedef struct { - /** It's the string to associate with the button, which can be NULL. */ - char *text; - /** The image to associate with the button. */ - TEE_TUIImage image; -} TEE_TUIButton; - -/** - * @brief Represents the configuration about the TUI screen. - * - * @since 12 - */ -typedef struct { - /** The requested screen orientation. */ - TEE_TUIScreenOrientation screenOrientation; - /** The specifies label of the screen.*/ - TEE_TUIScreenLabel label; - /** Customizes the buttons compared to the default. */ - TEE_TUIButton *buttons[TEE_TUI_NUMBER_BUTTON_TYPES]; - /** Specifes which buttons to be displayed. */ - bool requestedButtons[TEE_TUI_NUMBER_BUTTON_TYPES]; -} TEE_TUIScreenConfiguration; - -/** - * @brief Represents the information about a TUI screen button. - * @attention The {@code buttonTextCustom} and {@code buttonImageCustom} cannot be set to true at the same time. - * - * @since 12 - */ -typedef struct { - /** Defaut label value of the button text. If the value is NULL means the parameter is unavailable. */ - const char *buttonText; - /** The pixel width of the button. - * If the text or image on the button cannot be customized, the value is 0. - */ - uint32_t buttonWidth; - /** The pixel height of the button. - * If the text or image on the button cannot be customized, the value is 0. - */ - uint32_t buttonHeight; - /** If the text on the button cannot be customized, the value is true. */ - bool buttonTextCustom; - /** If the image on the button cannot be customized, the value is true. */ - bool buttonImageCustom; -} TEE_TUIScreenButtonInfo; - -/** - * @brief Represents the information displayed on the TUI. - * - * @since 12 - */ -typedef struct { - /** Available grayscale. */ - uint32_t grayscaleBitsDepth; - /** Available red depth level. */ - uint32_t redBitsDepth; - /** Available green depth level. */ - uint32_t greenBitsDepth; - /** Available blue depth level. */ - uint32_t blueBitsDepth; - /** Indicates the number of pixels per inch in the width direction. */ - uint32_t widthInch; - /** Indicates the number of pixels per inch in the height direction. */ - uint32_t heightInch; - /** Indicates the maximum number of entries that can be displayed on the TUI. */ - uint32_t maxEntryFields; - /** Indicates the pixel width of the input region label. */ - uint32_t entryFieldLabelWidth; - /** Indicates the pixel height of the input region label. */ - uint32_t entryFieldLabelHeight; - /** Indicates the maximum number of characters that can be entered in the entry field. */ - uint32_t maxEntryFieldLength; - /** RGB value of the default label canvas. */ - uint8_t labelColor[RGB_COLOR_IDX]; - /** Indicates the pixel width of the label canvas. */ - uint32_t labelWidth; - /** Indicates the pixel height of the label canvas. */ - uint32_t labelHeight; - /** Indicates the information of the buttons on the interface. */ - TEE_TUIScreenButtonInfo buttonInfo[TEE_TUI_NUMBER_BUTTON_TYPES]; -} TEE_TUIScreenInfo; - -/** - * @brief Represents the information in an entry field that requires user input. - * - * @since 12 - */ -typedef struct { - /** Indicates the label of the entry field. */ - char *label; - /** Indicates the mode used to display characters. */ - TEE_TUIEntryFieldMode mode; - /** Indicates the type of the characters can be entered in the entry field. */ - TEE_TUIEntryFieldType type; - /** The minimum number of characters to be entered. */ - uint32_t minExpectedLength; - /** The maximum number of characters to be entered. */ - uint32_t maxExpectedLength; - /** Contains the content entered by user. */ - char *buffer; - /** Indicates the length of the buffer. */ - size_t bufferLength; -} TEE_TUIEntryField; - -/** - * @brief Initializing the TUI resources. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if the device is not support TUI. - * Returns {@code TEE_ERROR_BUSY} if the TUI resources cannot be reserved. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the system ran out of the resources. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUIInitSession(void); - - -/** - * @brief Releases TUI resources previously acquired. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_STATE} if the current TA is not within a TUI session initially - * started by a successful call to {@code TEE_TUIInitSession}. - * Returns {@code TEE_ERROR_BUSY} if the TUI resources currently are in use. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUICloseSession(void); - -/** - * @brief Allows a TA to check whether a given text can be rendered by the current implementation and - * retrieves information about the size and width that is needed to render it. - * - * @param text Indicates the string to be checked. - * @param width Indicates the width in pixels needed to render the text. - * @param height Indicates the height in pixels needed to render the text. - * @param last_index Indicates the last character that has been checked - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if at least one of the characters present - * in the text string cannot be rendered. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUICheckTextFormat(const char *text, uint32_t *width, uint32_t *height, uint32_t *last_index); - -/** - * @brief Retrieves information about the screen depending on its orientation and - * the number of required entry fields. - * - * @param screenOrientation Defines for which orientation screen information is requested. - * @param nbEntryFields Indicates the number of the requested entry fields. - * @param screenInfo Indicates the information on the requested screen for a given orientation. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if the number of entry fields is not supported. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUIGetScreenInfo(TEE_TUIScreenOrientation screenOrientation, - uint32_t nbEntryFields, - TEE_TUIScreenInfo *screenInfo); -/** - * @brief Display a TUI screen. - * - * @param screenConfiguration Indicates the configuration of the labels and optional buttons on the display interface. - * @param closeTUISession If the value is true, the TUI session will automatically closed when exiting the function. - * @param entryFields Indicates the information of entry field. - * @param entryFieldCount Indicates the count of the entry fields. - * @param selectedButton Indicates which button has been selected by the user to exit the TUI screen. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_OUT_OF_MEMORY} if the system ran out of the resources. - * Returns {@code TEE_ERROR_ITEM_NOT_FOUND} if at least one image provided by the TA refers to a storage - * denoted by a storageID which dose not exist or if the corresponding object identifier cannot be found in the storage. - * Returns {@code TEE_ERROR_ACCESS_CONFLICT} if at least one image provided by the TA refers to a data - * object in the trusted storage and an access right conflict was detected while opening the object. - * Returns {@code TEE_ERROR_BAD_FORMAT} if at least one input image is not compliant with PNG format. - * Returns {@code TEE_ERROR_BAD_STATE} if the current TA is not within a TUI session - * initially started by a successful call to {@code TEE_TUIInitSession}. - * Returns {@code TEE_ERROR_BUSY} if the TUI resources are currently in use, i.e. a TUI screen is displayed. - * Returns {@code TEE_ERROR_CANCEL} if the operation has been cancelled while a TUI screen is currently - * displayed. - * Returns {@code TEE_ERROR_EXTERNAL_CANCEL} if the operation has been cancelled by an external event which - * occurred in the REE while a TUI screen is currently displayed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUIDisplayScreen(TEE_TUIScreenConfiguration *screenConfiguration, - bool closeTUISession, - TEE_TUIEntryField *entryFields, - uint32_t entryFieldCount, - TEE_TUIButtonType *selectedButton); - -/** - * @brief Fringerprint identification port. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if the device is not support TUI. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUINotify_fp(void); - -/** - * @brief Set the Chinese character encoding. The system supports UTF-8 by default. - * - * @param type Indicates the encoding type. The value 1 indicates GBK. Other values are not supported. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_NOT_SUPPORTED} if the device is not support this function. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUISetInfo(int32_t type); - -/** - * @brief Send message to TUI. - * - * @param type Indicates the messages send to the TUI. Only support {@code TUI_EXIT}. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_BAD_PARAMETERS} if input parameter is incorrect. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUISendEvent(int32_t type); - -/** - * @brief Setting the TUI background image. - * - * @param label Configure the background image information in the label variable. - * The image must be a PNG image in array format. - * @param len Indicates the label size. - * - * @return Returns {@code TEE_SUCCESS} if the operation is successful. - * Returns {@code TEE_ERROR_GENERIC} if input parameter is incorrect. - * Returns {@code TEE_ERROR_ACCESS_DENIED} if the permission verification failed. - * - * @since 12 - * @version 1.0 - */ -TEE_Result TEE_TUISetLabel(TEE_TUIScreenLabel *label, uint32_t len); -#ifdef __cplusplus -} -#endif -/** @} */ -#endif \ No newline at end of file diff --git a/tee/libteec.ndk.json b/tee/libteec.ndk.json deleted file mode 100644 index 2083549f8607165f3afe608f3191b1abdea29d38..0000000000000000000000000000000000000000 --- a/tee/libteec.ndk.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { "name": "TEEC_InitializeContext" }, - { "name": "TEEC_FinalizeContext" }, - { "name": "TEEC_OpenSession" }, - { "name": "TEEC_CloseSession" }, - { "name": "TEEC_InvokeCommand" }, - { "name": "TEEC_RegisterSharedMemory" }, - { "name": "TEEC_AllocateSharedMemory" }, - { "name": "TEEC_ReleaseSharedMemory" }, - { "name": "TEEC_RequestCancellation" } -] \ No newline at end of file diff --git a/telephony/cellular_data/include/telephony_data.h b/telephony/cellular_data/include/telephony_data.h index 801f8e81946f4590482fe230386823dec2436170..502beb9e3fcfc823445b1333227f732eab0bc5f1 100755 --- a/telephony/cellular_data/include/telephony_data.h +++ b/telephony/cellular_data/include/telephony_data.h @@ -13,8 +13,14 @@ * limitations under the License. */ -#ifndef NATIVE_TELEPHONY_DATA_API_H -#define NATIVE_TELEPHONY_DATA_API_H +/** + * @addtogroup Telephony + * @{ + * + * @brief Provides C interface for the telephony cellular data. + * + * @since 13 + */ /** * @file telephony_data.h @@ -27,6 +33,9 @@ * @since 13 */ +#ifndef NATIVE_TELEPHONY_DATA_API_H +#define NATIVE_TELEPHONY_DATA_API_H + #include #ifdef __cplusplus @@ -47,3 +56,4 @@ int32_t OH_Telephony_GetDefaultCellularDataSlotId(void); #endif #endif // NATIVE_TELEPHONY_DATA_API_H +/** @} */ diff --git a/telephony/core_service/include/telephony_radio.h b/telephony/core_service/include/telephony_radio.h index 26746d4bed6bd0f6371cd6260811b16fcca3a448..11d6a809bd4989e1be7a9fe7febfbf3b04b27e87 100755 --- a/telephony/core_service/include/telephony_radio.h +++ b/telephony/core_service/include/telephony_radio.h @@ -13,8 +13,14 @@ * limitations under the License. */ -#ifndef NATIVE_TELEPHONY_RADIO_API_H -#define NATIVE_TELEPHONY_RADIO_API_H +/** + * @addtogroup Telephony + * @{ + * + * @brief Provides C interface for the telephony radio. + * + * @since 13 + */ /** * @file telephony_radio.h @@ -27,6 +33,9 @@ * @since 13 */ +#ifndef NATIVE_TELEPHONY_RADIO_API_H +#define NATIVE_TELEPHONY_RADIO_API_H + #include "telephony_radio_type.h" #include "stdint.h" @@ -72,3 +81,4 @@ Telephony_RadioResult OH_Telephony_GetNetworkStateForSlot(int32_t slotId, Teleph #endif #endif // NATIVE_TELEPHONY_RADIO_API_H +/** @} */ diff --git a/telephony/core_service/include/telephony_radio_type.h b/telephony/core_service/include/telephony_radio_type.h index 15877c912ec5a8e66126b051ee48c0ea61334019..72dc1aa812c5d47fea8848247c6bb47b8891cefa 100755 --- a/telephony/core_service/include/telephony_radio_type.h +++ b/telephony/core_service/include/telephony_radio_type.h @@ -13,8 +13,14 @@ * limitations under the License. */ -#ifndef NATIVE_TELEPHONY_RADIO_TYPE_H -#define NATIVE_TELEPHONY_RADIO_TYPE_H +/** + * @addtogroup Telephony + * @{ + * + * @brief Provides the data structures for the C APIs of the the telephony radio. + * + * @since 13 + */ /** * @file telephony_radio_type.h @@ -27,6 +33,9 @@ * @since 13 */ +#ifndef NATIVE_TELEPHONY_RADIO_TYPE_H +#define NATIVE_TELEPHONY_RADIO_TYPE_H + #ifdef __cplusplus extern "C" { #endif @@ -155,3 +164,4 @@ typedef struct { #endif #endif // NATIVE_TELEPHONY_RADIO_TYPE_H +/** @} */ diff --git a/third_party/egl/README.OpenSource b/third_party/egl/README.OpenSource deleted file mode 100644 index 4693a658190a41241be69c9a6e6864b0a4acc6b4..0000000000000000000000000000000000000000 --- a/third_party/egl/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "EGL", - "License": "MIT License", - "License File": "LICENSE", - "Version Number": "1.5", - "Owner": "lizheng2@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/EGL-Registry.git", - "Description": "EGL is an interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system." - } -] diff --git a/third_party/icu4c/BUILD.gn b/third_party/icu4c/BUILD.gn index d3466f1ebed09f1b65016c62ac32ac534287da58..c5dd29f7246975b30a05631664b10455c75ac619 100644 --- a/third_party/icu4c/BUILD.gn +++ b/third_party/icu4c/BUILD.gn @@ -45,6 +45,8 @@ ohos_ndk_library("libicu_ndk") { "unicode/unumberformatter.h", "unicode/uscript.h", "unicode/uset.h", + "unicode/ustring.h", + "unicode/utext.h", "unicode/utrans.h", "unicode/utypes.h", ] @@ -79,6 +81,8 @@ ohos_ndk_headers("icu_unicode_header") { "ndk_headers/unicode/unumberformatter.h", "ndk_headers/unicode/uscript.h", "ndk_headers/unicode/uset.h", + "ndk_headers/unicode/ustring.h", + "ndk_headers/unicode/utext.h", "ndk_headers/unicode/utrans.h", "ndk_headers/unicode/utypes.h", ] diff --git a/third_party/icu4c/README.OpenSource b/third_party/icu4c/README.OpenSource deleted file mode 100644 index ec3f8592fce5370ee7e0509600e7088760b64f80..0000000000000000000000000000000000000000 --- a/third_party/icu4c/README.OpenSource +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "Name": "International Components for Unicode", - "License": "ICU License, BSD 3-Clause License", - "License File": "LICENSE", - "Version Number": "72.1", - "Upstream URL": "https://github.com/unicode-org/icu/archive/release-72-1.tar.gz", - "Description": "ICU is a mature, widely used set of portable C/C++ and Java libraries for Unicode support, software internationalization and globalization (i18n/g11n). The packages are mirrors of the main website." - } -] diff --git a/third_party/icu4c/libicu.ndk.json b/third_party/icu4c/libicu.ndk.json index 5fc158cad36d00cb90e47671ea6d0854eb6124e4..40397f05313206cd8d4413e4e0f1142a8aabc6a3 100644 --- a/third_party/icu4c/libicu.ndk.json +++ b/third_party/icu4c/libicu.ndk.json @@ -1814,5 +1814,277 @@ { "first_introduced": "12", "name":"uidna_nameToUnicodeUTF8" + }, + { + "first_introduced": "15", + "name":"utext_close" + }, + { + "first_introduced": "15", + "name":"utext_openUTF8" + }, + { + "first_introduced": "15", + "name":"utext_openUChars" + }, + { + "first_introduced": "15", + "name":"utext_clone" + }, + { + "first_introduced": "15", + "name":"utext_equals" + }, + { + "first_introduced": "15", + "name":"utext_nativeLength" + }, + { + "first_introduced": "15", + "name":"utext_char32At" + }, + { + "first_introduced": "15", + "name":"utext_current32" + }, + { + "first_introduced": "15", + "name":"utext_next32" + }, + { + "first_introduced": "15", + "name":"utext_previous32" + }, + { + "first_introduced": "15", + "name":"utext_next32From" + }, + { + "first_introduced": "15", + "name":"utext_previous32From" + }, + { + "first_introduced": "15", + "name":"utext_getNativeIndex" + }, + { + "first_introduced": "15", + "name":"utext_setNativeIndex" + }, + { + "first_introduced": "15", + "name":"utext_moveIndex32" + }, + { + "first_introduced": "15", + "name":"utext_getPreviousNativeIndex" + }, + { + "first_introduced": "15", + "name":"utext_extract" + }, + { + "first_introduced": "15", + "name":"u_strlen" + }, + { + "first_introduced": "15", + "name":"u_countChar32" + }, + { + "first_introduced": "15", + "name":"u_strHasMoreChar32Than" + }, + { + "first_introduced": "15", + "name":"u_strcat" + }, + { + "first_introduced": "15", + "name":"u_strncat" + }, + { + "first_introduced": "15", + "name":"u_strstr" + }, + { + "first_introduced": "15", + "name":"u_strFindFirst" + }, + { + "first_introduced": "15", + "name":"u_strchr" + }, + { + "first_introduced": "15", + "name":"u_strchr32" + }, + { + "first_introduced": "15", + "name":"u_strrstr" + }, + { + "first_introduced": "15", + "name":"u_strFindLast" + }, + { + "first_introduced": "15", + "name":"u_strrchr" + }, + { + "first_introduced": "15", + "name":"u_strrchr32" + }, + { + "first_introduced": "15", + "name":"u_strpbrk" + }, + { + "first_introduced": "15", + "name":"u_strcspn" + }, + { + "first_introduced": "15", + "name":"u_strspn" + }, + { + "first_introduced": "15", + "name":"u_strtok_r" + }, + { + "first_introduced": "15", + "name":"u_strcmp" + }, + { + "first_introduced": "15", + "name":"u_strcmpCodePointOrder" + }, + { + "first_introduced": "15", + "name":"u_strCompare" + }, + { + "first_introduced": "15", + "name":"u_strCaseCompare" + }, + { + "first_introduced": "15", + "name":"u_strncmp" + }, + { + "first_introduced": "15", + "name":"u_strncmpCodePointOrder" + }, + { + "first_introduced": "15", + "name":"u_strcasecmp" + }, + { + "first_introduced": "15", + "name":"u_strncasecmp" + }, + { + "first_introduced": "15", + "name":"u_memcasecmp" + }, + { + "first_introduced": "15", + "name":"u_strcpy" + }, + { + "first_introduced": "15", + "name":"u_strncpy" + }, + { + "first_introduced": "15", + "name":"u_memcpy" + }, + { + "first_introduced": "15", + "name":"u_memmove" + }, + { + "first_introduced": "15", + "name":"u_memset" + }, + { + "first_introduced": "15", + "name":"u_memcmp" + }, + { + "first_introduced": "15", + "name":"u_memcmpCodePointOrder" + }, + { + "first_introduced": "15", + "name":"u_memchr" + }, + { + "first_introduced": "15", + "name":"u_memchr32" + }, + { + "first_introduced": "15", + "name":"u_memrchr" + }, + { + "first_introduced": "15", + "name":"u_memrchr32" + }, + { + "first_introduced": "15", + "name":"u_strToUpper" + }, + { + "first_introduced": "15", + "name":"u_strToLower" + }, + { + "first_introduced": "15", + "name":"u_strToTitle" + }, + { + "first_introduced": "15", + "name":"u_strFoldCase" + }, + { + "first_introduced": "15", + "name":"u_strToUTF8" + }, + { + "first_introduced": "15", + "name":"u_strFromUTF8" + }, + { + "first_introduced": "15", + "name":"u_strToUTF8WithSub" + }, + { + "first_introduced": "15", + "name":"u_strFromUTF8WithSub" + }, + { + "first_introduced": "15", + "name":"u_strFromUTF8Lenient" + }, + { + "first_introduced": "15", + "name":"u_strToUTF32" + }, + { + "first_introduced": "15", + "name":"u_strFromUTF32" + }, + { + "first_introduced": "15", + "name":"u_strToUTF32WithSub" + }, + { + "first_introduced": "15", + "name":"u_strFromUTF32WithSub" + }, + { + "first_introduced": "15", + "name":"u_errorName" } ] diff --git a/third_party/icu4c/ndk_headers/unicode/ustring.h b/third_party/icu4c/ndk_headers/unicode/ustring.h new file mode 100644 index 0000000000000000000000000000000000000000..bbb1ee30939af5a6625a068c6ad02ece876df1fa --- /dev/null +++ b/third_party/icu4c/ndk_headers/unicode/ustring.h @@ -0,0 +1,1353 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File ustring.h +* +* Modification History: +* +* Date Name Description +* 12/07/98 bertrand Creation. +****************************************************************************** +*/ + +#ifndef USTRING_H +#define USTRING_H + +#include "unicode/utypes.h" + +/** + * \def UBRK_TYPEDEF_UBREAK_ITERATOR + * @internal + */ + +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR +/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ + typedef struct UBreakIterator UBreakIterator; +#endif + +/** + * \file + * \brief C API: Unicode string handling functions + * + * These C API functions provide general Unicode string handling. + * + * Some functions are equivalent in name, signature, and behavior to the ANSI C + * functions. (For example, they do not check for bad arguments like NULL string pointers.) + * In some cases, only the thread-safe variant of such a function is implemented here + * (see u_strtok_r()). + * + * Other functions provide more Unicode-specific functionality like locale-specific + * upper/lower-casing and string comparison in code point order. + * + * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. + * UTF-16 encodes each Unicode code point with either one or two UChar code units. + * (This is the default form of Unicode, and a forward-compatible extension of the original, + * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 + * in 1996.) + * + * Some APIs accept a 32-bit UChar32 value for a single code point. + * + * ICU also handles 16-bit Unicode text with unpaired surrogates. + * Such text is not well-formed UTF-16. + * Code-point-related functions treat unpaired surrogates as surrogate code points, + * i.e., as separate units. + * + * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), + * it is much more efficient even for random access because the code unit values + * for single-unit characters vs. lead units vs. trail units are completely disjoint. + * This means that it is easy to determine character (code point) boundaries from + * random offsets in the string. + * + * Unicode (UTF-16) string processing is optimized for the single-unit case. + * Although it is important to support supplementary characters + * (which use pairs of lead/trail code units called "surrogates"), + * their occurrence is rare. Almost all characters in modern use require only + * a single UChar code unit (i.e., their code point values are <=0xffff). + * + * For more details see the User Guide Strings chapter (https://unicode-org.github.io/icu/userguide/strings/). + * For a discussion of the handling of unpaired surrogates see also + * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. + */ + +/** + * \defgroup ustring_ustrlen String Length + * \ingroup ustring_strlen + */ +/*@{*/ +/** + * Determine the length of an array of UChar. + * + * @param s The array of UChars, NULL (U+0000) terminated. + * @return The number of UChars in chars, minus the terminator. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strlen(const UChar *s); +/*@}*/ + +/** + * Count Unicode code points in the length UChar code units of the string. + * A code point may occupy either one or two UChar code units. + * Counting code points involves reading all code units. + * + * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). + * + * @param s The input string. + * @param length The number of UChar code units to be checked, or -1 to count all + * code points before the first NUL (U+0000). + * @return The number of code points in the specified code units. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_countChar32(const UChar *s, int32_t length); + +/** + * Check if the string contains more Unicode code points than a certain number. + * This is more efficient than counting all code points in the entire string + * and comparing that number with a threshold. + * This function may not need to scan the string at all if the length is known + * (not -1 for NUL-termination) and falls within a certain range, and + * never needs to count more than 'number+1' code points. + * Logically equivalent to (u_countChar32(s, length)>number). + * A Unicode code point may occupy either one or two UChar code units. + * + * @param s The input string. + * @param length The length of the string, or -1 if it is NUL-terminated. + * @param number The number of code points in the string is compared against + * the 'number' parameter. + * @return Boolean value for whether the string contains more Unicode code points + * than 'number'. Same as (u_countChar32(s, length)>number). + * @stable ICU 2.4 + */ +U_CAPI UBool U_EXPORT2 +u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); + +/** + * Concatenate two ustrings. Appends a copy of src, + * including the null terminator, to dst. The initial copied + * character from src overwrites the null terminator in dst. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strcat(UChar *dst, + const UChar *src); + +/** + * Concatenate two ustrings. + * Appends at most n characters from src to dst. + * Adds a terminating NUL. + * If src is too long, then only n-1 characters will be copied + * before the terminating NUL. + * If n<=0 then dst is not modified. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to append; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strncat(UChar *dst, + const UChar *src, + int32_t n); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.0 + * + * @see u_strrstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strstr(const UChar *s, const UChar *substring); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strstr + * @see u_strFindFirst + */ +U_CAPI UChar * U_EXPORT2 +u_strchr(const UChar *s, UChar c); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strstr + * @see u_strFindFirst + */ +U_CAPI UChar * U_EXPORT2 +u_strchr32(const UChar *s, UChar32 c); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrstr(const UChar *s, const UChar *substring); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strrstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrchr(const UChar *s, UChar c); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memchr32 + * @see u_strrstr + * @see u_strFindLast + */ +U_CAPI UChar * U_EXPORT2 +u_strrchr32(const UChar *s, UChar32 c); + +/** + * Locates the first occurrence in the string string of any of the characters + * in the string matchSet. + * Works just like C's strpbrk but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return A pointer to the character in string that matches one of the + * characters in matchSet, or NULL if no such character is found. + * @stable ICU 2.0 + */ +U_CAPI UChar * U_EXPORT2 +u_strpbrk(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that do not occur somewhere in matchSet. + * Works just like C's strcspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do not + * occur in matchSet. + * @see u_strspn + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcspn(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that occur somewhere in matchSet. + * Works just like C's strspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do + * occur in matchSet. + * @see u_strcspn + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strspn(const UChar *string, const UChar *matchSet); + +/** + * The string tokenizer API allows an application to break a string into + * tokens. Unlike strtok(), the saveState (the current pointer within the + * original string) is maintained in saveState. In the first call, the + * argument src is a pointer to the string. In subsequent calls to + * return successive tokens of that string, src must be specified as + * NULL. The value saveState is set by this function to maintain the + * function's position within the string, and on each subsequent call + * you must give this argument the same variable. This function does + * handle surrogate pairs. This function is similar to the strtok_r() + * the POSIX Threads Extension (1003.1c-1995) version. + * + * @param src String containing token(s). This string will be modified. + * After the first call to u_strtok_r(), this argument must + * be NULL to get to the next token. + * @param delim Set of delimiter characters (Unicode code points). + * @param saveState The current pointer within the original string, + * which is set by this function. The saveState + * parameter should the address of a local variable of type + * UChar *. (i.e. defined "UChar *myLocalSaveState" and use + * &myLocalSaveState for this parameter). + * @return A pointer to the next token found in src, or NULL + * when there are no more tokens. + * @stable ICU 2.0 + */ +U_CAPI UChar * U_EXPORT2 +u_strtok_r(UChar *src, + const UChar *delim, + UChar **saveState); + +/** + * Compare two Unicode strings for bitwise equality (code unit order). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2,; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcmp(const UChar *s1, + const UChar *s2); + +/** + * Compare two Unicode strings in code point order. + * See u_strCompare for details. + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); + +/** + * Compare two Unicode strings (binary order). + * + * The comparison can be done in code unit order or in code point order. + * They differ only in UTF-16 when + * comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param codePointOrder Choose between code unit order (false) + * and code point order (true). + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +u_strCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + UBool codePointOrder); + + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to + * u_strCompare(u_strFoldCase(s1, options), + * u_strFoldCase(s2, options), + * (options&U_COMPARE_CODE_POINT_ORDER)!=0). + * + * The comparison can be done in UTF-16 code unit order or in code point order. + * They differ only when comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_CAPI int32_t U_EXPORT2 +u_strCaseCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + uint32_t options, + UErrorCode *pErrorCode); + +/** + * Compare two ustrings for bitwise equality. + * Compares at most n characters. + * + * @param ucs1 A string to compare (can be NULL/invalid if n<=0). + * @param ucs2 A string to compare (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to compare; always returns 0 if n<=0. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncmp(const UChar *ucs1, + const UChar *ucs2, + int32_t n); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_strncmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), + * u_strFoldCase(s2, at most n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), + * u_strFoldCase(s2, n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param length The number of characters in each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); + +/** + * Copy a ustring. Adds a null terminator. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strcpy(UChar *dst, + const UChar *src); + +/** + * Copy a ustring. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to copy; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_strncpy(UChar *dst, + const UChar *src, + int32_t n); + + +/** + * Synonym for memcpy(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to copy; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memcpy(UChar *dest, const UChar *src, int32_t count); + +/** + * Synonym for memmove(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to move; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memmove(UChar *dest, const UChar *src, int32_t count); + +/** + * Initialize count characters of dest to c. + * + * @param dest The destination string. + * @param c The character to initialize the string. + * @param count The maximum number of characters to set. + * @return A pointer to dest. + * @stable ICU 2.0 + */ +U_CAPI UChar* U_EXPORT2 +u_memset(UChar *dest, UChar c, int32_t count); + +/** + * Compare the first count UChars of each buffer. + * + * @param buf1 The first string to compare. + * @param buf2 The second string to compare. + * @param count The maximum number of UChars to compare. + * @return When buf1 < buf2, a negative number is returned. + * When buf1 == buf2, 0 is returned. + * When buf1 > buf2, a positive number is returned. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_memcmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param count The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strFindFirst + */ +U_CAPI UChar* U_EXPORT2 +u_memchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strFindFirst + */ +U_CAPI UChar* U_EXPORT2 +u_memchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memrchr32 + * @see u_strFindLast + */ +U_CAPI UChar* U_EXPORT2 +u_memrchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strFindLast + */ +U_CAPI UChar* U_EXPORT2 +u_memrchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Unicode String literals in C. + * We need one macro to declare a variable for the string + * and to statically preinitialize it if possible, + * and a second macro to dynamically initialize such a string variable if necessary. + * + * The macros are defined for maximum performance. + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * A pair of macros for a single string must be used with the same + * parameters. + * The string parameter must be a C string literal. + * The length of the string, not including the terminating + * `NUL`, must be specified as a constant. + * The U_STRING_DECL macro should be invoked exactly once for one + * such string variable before it is used. + * + * Usage: + * + * U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_DECL(ustringVar2, "jumps 5%", 8); + * static UBool didInit=false; + * + * int32_t function() { + * if(!didInit) { + * U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); + * U_STRING_INIT(ustringVar2, "jumps 5%", 8); + * didInit=true; + * } + * return u_strcmp(ustringVar1, ustringVar2); + * } + * + * Note that the macros will NOT consistently work if their argument is another #`define`. + * The following will not work on all platforms, don't use it. + * + * #define GLUCK "Mr. Gluck" + * U_STRING_DECL(var, GLUCK, 9) + * U_STRING_INIT(var, GLUCK, 9) + * + * Instead, use the string literal "Mr. Gluck" as the argument to both macro + * calls. + * + * + * @stable ICU 2.0 + */ +#if defined(U_DECLARE_UTF16) +# define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs) + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#else +# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) +#endif + + +/** + * Uppercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strToUpper(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +/** + * Lowercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strToLower(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Titlecase a string. + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (NULL), then a standard titlecase + * break iterator is opened. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.1 + */ +U_CAPI int32_t U_EXPORT2 +u_strToTitle(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UBreakIterator *titleIter, + const char *locale, + UErrorCode *pErrorCode); + +#endif + +/** + * Case-folds the characters in a string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_CAPI int32_t U_EXPORT2 +u_strFoldCase(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + uint32_t options, + UErrorCode *pErrorCode); + + +/** + * Convert a UTF-16 string to UTF-8. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strToUTF8WithSub + * @see u_strFromUTF8 + */ +U_CAPI char* U_EXPORT2 +u_strToUTF8(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strFromUTF8WithSub + * @see u_strFromUTF8Lenient + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF8(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-16 string to UTF-8. + * + * Same as u_strToUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF8 + * @see u_strFromUTF8WithSub + * @stable ICU 3.6 + */ +U_CAPI char* U_EXPORT2 +u_strToUTF8WithSub(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF8 + * @see u_strFromUTF8Lenient + * @see u_strToUTF8WithSub + * @stable ICU 3.6 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF8WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except that this function is designed to be very fast, + * which it achieves by being lenient about malformed UTF-8 sequences. + * This function is intended for use in environments where UTF-8 text is + * expected to be well-formed. + * + * Its semantics are: + * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. + * - The function will not read beyond the input string, nor write beyond + * the destCapacity. + * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not + * be well-formed UTF-16. + * The function will resynchronize to valid code point boundaries + * within a small number of code points after an illegal sequence. + * - Non-shortest forms are not detected and will result in "spoofing" output. + * + * For further performance improvement, if srcLength is given (>=0), + * then it must be destCapacity>=srcLength. + * + * There is no inverse u_strToUTF8Lenient() function because there is practically + * no performance gain from not checking that a UTF-16 string is well-formed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * Unlike for other ICU functions, if srcLength>=0 then it + * must be destCapacity>=srcLength. + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * Unlike for other ICU functions, if srcLength>=0 but + * destCapacity=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF32 + * @see u_strFromUTF32WithSub + * @stable ICU 4.2 + */ +U_CAPI UChar32* U_EXPORT2 +u_strToUTF32WithSub(UChar32 *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-32 string to UTF-16. + * + * Same as u_strFromUTF32() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF32 + * @see u_strToUTF32WithSub + * @stable ICU 4.2 + */ +U_CAPI UChar* U_EXPORT2 +u_strFromUTF32WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar32 *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + + +#endif diff --git a/third_party/icu4c/ndk_headers/unicode/utext.h b/third_party/icu4c/ndk_headers/unicode/utext.h new file mode 100644 index 0000000000000000000000000000000000000000..66e557ccf5543829ee1377ff4cde8d777ddee672 --- /dev/null +++ b/third_party/icu4c/ndk_headers/unicode/utext.h @@ -0,0 +1,582 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utext.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004oct06 +* created by: Markus W. Scherer +*/ + +#ifndef __UTEXT_H__ +#define __UTEXT_H__ + +/** + * \file + * \brief C API: Abstract Unicode Text API + * + * The Text Access API provides a means to allow text that is stored in alternative + * formats to work with ICU services. ICU normally operates on text that is + * stored in UTF-16 format, in (UChar *) arrays for the C APIs or as type + * UnicodeString for C++ APIs. + * + * ICU Text Access allows other formats, such as UTF-8 or non-contiguous + * UTF-16 strings, to be placed in a UText wrapper and then passed to ICU services. + * + * There are three general classes of usage for UText: + * + * Application Level Use. This is the simplest usage - applications would + * use one of the utext_open() functions on their input text, and pass + * the resulting UText to the desired ICU service. + * + * Second is usage in ICU Services, such as break iteration, that will need to + * operate on input presented to them as a UText. These implementations + * will need to use the iteration and related UText functions to gain + * access to the actual text. + * + * The third class of UText users are "text providers." These are the + * UText implementations for the various text storage formats. An application + * or system with a unique text storage format can implement a set of + * UText provider functions for that format, which will then allow + * ICU services to operate on that format. + * + * + * Iterating over text + * + * Here is sample code for a forward iteration over the contents of a UText + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * + * for (c=utext_next32From(ut, 0); c>=0; c=utext_next32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * And here is similar code to iterate in the reverse direction, from the end + * of the text towards the beginning. + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * int textLength = utext_nativeLength(ut); + * for (c=utext_previous32From(ut, textLength); c>=0; c=utext_previous32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * Characters and Indexing + * + * Indexing into text by UText functions is nearly always in terms of the native + * indexing of the underlying text storage. The storage format could be UTF-8 + * or UTF-32, for example. When coding to the UText access API, no assumptions + * can be made regarding the size of characters, or how far an index + * may move when iterating between characters. + * + * All indices supplied to UText functions are pinned to the length of the + * text. An out-of-bounds index is not considered to be an error, but is + * adjusted to be in the range 0 <= index <= length of input text. + * + * + * When an index position is returned from a UText function, it will be + * a native index to the underlying text. In the case of multi-unit characters, + * it will always refer to the first position of the character, + * never to the interior. This is essentially the same thing as saying that + * a returned index will always point to a boundary between characters. + * + * When a native index is supplied to a UText function, all indices that + * refer to any part of a multi-unit character representation are considered + * to be equivalent. In the case of multi-unit characters, an incoming index + * will be logically normalized to refer to the start of the character. + * + * It is possible to test whether a native index is on a code point boundary + * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex(). + * If the index is returned unchanged, it was on a code point boundary. If + * an adjusted index is returned, the original index referred to the + * interior of a character. + * + * Conventions for calling UText functions + * + * Most UText access functions have as their first parameter a (UText *) pointer, + * which specifies the UText to be used. Unless otherwise noted, the + * pointer must refer to a valid, open UText. Attempting to + * use a closed UText or passing a NULL pointer is a programming error and + * will produce undefined results or NULL pointer exceptions. + * + * The UText_Open family of functions can either open an existing (closed) + * UText, or heap allocate a new UText. Here is sample code for creating + * a stack-allocated UText. + * + * \code + * char *s = whatever(); // A utf-8 string + * U_ErrorCode status = U_ZERO_ERROR; + * UText ut = UTEXT_INITIALIZER; + * utext_openUTF8(ut, s, -1, &status); + * if (U_FAILURE(status)) { + * // error handling + * } else { + * // work with the UText + * } + * \endcode + * + * Any existing UText passed to an open function _must_ have been initialized, + * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated + * by an open function. Passing NULL will cause the open function to + * heap-allocate and fully initialize a new UText. + * + */ + + + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#include "unicode/rep.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#endif + + +U_CDECL_BEGIN + +struct UText; +typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ + + +/*************************************************************************************** + * + * C Functions for creating UText wrappers around various kinds of text strings. + * + ****************************************************************************************/ + + +/** + * Close function for UText instances. + * Cleans up, releases any resources being held by an open UText. + *

+ * If the UText was originally allocated by one of the utext_open functions, + * the storage associated with the utext will also be freed. + * If the UText storage originated with the application, as it would with + * a local or static instance, the storage will not be deleted. + * + * An open UText can be reset to refer to new string by using one of the utext_open() + * functions without first closing the UText. + * + * @param ut The UText to be closed. + * @return NULL if the UText struct was deleted by the close. If the UText struct + * was originally provided by the caller to the open function, it is + * returned by this function, and may be safely used again in + * a subsequent utext_open. + * + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_close(UText *ut); + +/** + * Open a read-only UText implementation for UTF-8 strings. + * + * \htmlonly + * Any invalid UTF-8 in the input will be handled in this way: + * a sequence of bytes that has the form of a truncated, but otherwise valid, + * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. + * Any other illegal bytes will each be replaced by a \uFFFD. + * \endhtmlonly + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UTF-8 string. + * @param s A UTF-8 string. Must not be NULL. + * @param length The length of the UTF-8 string in bytes, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); + + +/** + * Open a read-only UText for UChar * string. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UChar string. + * @param s A UChar (UTF-16) string + * @param length The number of UChars in the input string, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); + + +/** + * Clone a UText. This is much like opening a UText where the source text is itself + * another UText. + * + * A deep clone will copy both the UText data structures and the underlying text. + * The original and cloned UText will operate completely independently; modifications + * made to the text in one will not affect the other. Text providers are not + * required to support deep clones. The user of clone() must check the status return + * and be prepared to handle failures. + * + * The standard UText implementations for UTF8, UChar *, UnicodeString and + * Replaceable all support deep cloning. + * + * The UText returned from a deep clone will be writable, assuming that the text + * provider is able to support writing, even if the source UText had been made + * non-writable by means of UText_freeze(). + * + * A shallow clone replicates only the UText data structures; it does not make + * a copy of the underlying text. Shallow clones can be used as an efficient way to + * have multiple iterators active in a single text string that is not being + * modified. + * + * A shallow clone operation will not fail, barring truly exceptional conditions such + * as memory allocation failures. + * + * Shallow UText clones should be avoided if the UText functions that modify the + * text are expected to be used, either on the original or the cloned UText. + * Any such modifications can cause unpredictable behavior. Read Only + * shallow clones provide some protection against errors of this type by + * disabling text modification via the cloned UText. + * + * A shallow clone made with the readOnly parameter == false will preserve the + * utext_isWritable() state of the source object. Note, however, that + * write operations must be avoided while more than one UText exists that refer + * to the same underlying text. + * + * A UText and its clone may be safely concurrently accessed by separate threads. + * This is true for read access only with shallow clones, and for both read and + * write access with deep clones. + * It is the responsibility of the Text Provider to ensure that this thread safety + * constraint is met. + * + * @param dest A UText struct to be filled in with the result of the clone operation, + * or NULL if the clone function should heap-allocate a new UText struct. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to become the clone. + * @param src The UText to be cloned. + * @param deep true to request a deep clone, false for a shallow clone. + * @param readOnly true to request that the cloned UText have read only access to the + * underlying text. + + * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR + * will be returned if the text provider is unable to clone the + * original text. + * @return The newly created clone, or NULL if the clone operation failed. + * @stable ICU 3.4 + */ +U_CAPI UText * U_EXPORT2 +utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); + + +/** + * Compare two UText objects for equality. + * UTexts are equal if they are iterating over the same text, and + * have the same iteration position within the text. + * If either or both of the parameters are NULL, the comparison is false. + * + * @param a The first of the two UTexts to compare. + * @param b The other UText to be compared. + * @return true if the two UTexts are equal. + * @stable ICU 3.6 + */ +U_CAPI UBool U_EXPORT2 +utext_equals(const UText *a, const UText *b); + + +/***************************************************************************** + * + * Functions to work with the text represented by a UText wrapper + * + *****************************************************************************/ + +/** + * Get the length of the text. Depending on the characteristics + * of the underlying text representation, this may be expensive. + * @see utext_isLengthExpensive() + * + * + * @param ut the text to be accessed. + * @return the length of the text, expressed in native units. + * + * @stable ICU 3.4 + */ +U_CAPI int64_t U_EXPORT2 +utext_nativeLength(UText *ut); + +/** + * Returns the code point at the requested index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * If the specified index points to the interior of a multi-unit + * character - one of the trail bytes of a UTF-8 sequence, for example - + * the complete code point will be returned. + * + * The iteration position will be set to the start of the returned code point. + * + * This function is roughly equivalent to the sequence + * utext_setNativeIndex(index); + * utext_current32(); + * (There is a subtle difference if the index is out of bounds by being less than zero - + * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current() + * will return the char at zero. utext_char32At(negative index), on the other hand, will + * return the U_SENTINEL value of -1.) + * + * @param ut the text to be accessed + * @param nativeIndex the native index of the character to be accessed. If the index points + * to other than the first unit of a multi-unit character, it will be adjusted + * to the start of the character. + * @return the code point at the specified index. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_char32At(UText *ut, int64_t nativeIndex); + + +/** + * + * Get the code point at the current iteration position, + * or U_SENTINEL (-1) if the iteration has reached the end of + * the input text. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the current iterator position. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_current32(UText *ut); + + +/** + * Get the code point at the current iteration position of the UText, and + * advance the position to the first index following the character. + * + * If the position is at the end of the text (the index following + * the last character, which is also the length of the text), + * return U_SENTINEL (-1) and do not advance the index. + * + * This is a post-increment operation. + * + * An inline macro version of this function, UTEXT_NEXT32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the iteration position. + * @see UTEXT_NEXT32 + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_next32(UText *ut); + + +/** + * Move the iterator position to the character (code point) whose + * index precedes the current position, and return that character. + * This is a pre-decrement operation. + * + * If the initial position is at the start of the text (index of 0) + * return U_SENTINEL (-1), and leave the position unchanged. + * + * An inline macro version of this function, UTEXT_PREVIOUS32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the previous UChar32 code point, or U_SENTINEL (-1) + * if the iteration has reached the start of the text. + * @see UTEXT_PREVIOUS32 + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_previous32(UText *ut); + + +/** + * Set the iteration index and return the code point at that index. + * Leave the iteration index at the start of the following code point. + * + * This function is the most efficient and convenient way to + * begin a forward iteration. The results are identical to the those + * from the sequence + * \code + * utext_setIndex(); + * utext_next32(); + * \endcode + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index, in the native units of the text provider. + * @return Code point which starts at or before index, + * or U_SENTINEL (-1) if it is out of bounds. + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_next32From(UText *ut, int64_t nativeIndex); + + + +/** + * Set the iteration index, and return the code point preceding the + * one specified by the initial index. Leave the iteration position + * at the start of the returned code point. + * + * This function is the most efficient and convenient way to + * begin a backwards iteration. + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index in the native units of the text provider. + * @return Code point preceding the one at the initial index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * @stable ICU 3.4 + */ +U_CAPI UChar32 U_EXPORT2 +utext_previous32From(UText *ut, int64_t nativeIndex); + +/** + * Get the current iterator position, which can range from 0 to + * the length of the text. + * The position is a native index into the input text, in whatever format it + * may have (possibly UTF-8 for example), and may not always be the same as + * the corresponding UChar (UTF-16) index. + * The returned position will always be aligned to a code point boundary. + * + * @param ut the text to be accessed. + * @return the current index position, in the native units of the text provider. + * @stable ICU 3.4 + */ +U_CAPI int64_t U_EXPORT2 +utext_getNativeIndex(const UText *ut); + +/** + * Set the current iteration position to the nearest code point + * boundary at or preceding the specified index. + * The index is in the native units of the original input text. + * If the index is out of range, it will be pinned to be within + * the range of the input text. + *

+ * It will usually be more efficient to begin an iteration + * using the functions utext_next32From() or utext_previous32From() + * rather than setIndex(). + *

+ * Moving the index position to an adjacent character is best done + * with utext_next32(), utext_previous32() or utext_moveIndex32(). + * Attempting to do direct arithmetic on the index position is + * complicated by the fact that the size (in native units) of a + * character depends on the underlying representation of the character + * (UTF-8, UTF-16, UTF-32, arbitrary codepage), and is not + * easily knowable. + * + * @param ut the text to be accessed. + * @param nativeIndex the native unit index of the new iteration position. + * @stable ICU 3.4 + */ +U_CAPI void U_EXPORT2 +utext_setNativeIndex(UText *ut, int64_t nativeIndex); + +/** + * Move the iterator position by delta code points. The number of code points + * is a signed number; a negative delta will move the iterator backwards, + * towards the start of the text. + *

+ * The index is moved by delta code points + * forward or backward, but no further backward than to 0 and + * no further forward than to utext_nativeLength(). + * The resulting index value will be in between 0 and length, inclusive. + * + * @param ut the text to be accessed. + * @param delta the signed number of code points to move the iteration position. + * @return true if the position could be moved the requested number of positions while + * staying within the range [0 - text length]. + * @stable ICU 3.4 + */ +U_CAPI UBool U_EXPORT2 +utext_moveIndex32(UText *ut, int32_t delta); + +/** + * Get the native index of the character preceding the current position. + * If the iteration position is already at the start of the text, zero + * is returned. + * The value returned is the same as that obtained from the following sequence, + * but without the side effect of changing the iteration position. + * + * \code + * UText *ut = whatever; + * ... + * utext_previous(ut) + * utext_getNativeIndex(ut); + * \endcode + * + * This function is most useful during forwards iteration, where it will get the + * native index of the character most recently returned from utext_next(). + * + * @param ut the text to be accessed + * @return the native index of the character preceding the current index position, + * or zero if the current position is at the start of the text. + * @stable ICU 3.6 + */ +U_CAPI int64_t U_EXPORT2 +utext_getPreviousNativeIndex(UText *ut); + + +/** + * + * Extract text from a UText into a UChar buffer. The range of text to be extracted + * is specified in the native indices of the UText provider. These may not necessarily + * be UTF-16 indices. + *

+ * The size (number of 16 bit UChars) of the data to be extracted is returned. The + * full number of UChars is returned, even when the extracted text is truncated + * because the specified buffer size is too small. + *

+ * The extracted string will (if you are a user) / must (if you are a text provider) + * be NUL-terminated if there is sufficient space in the destination buffer. This + * terminating NUL is not included in the returned length. + *

+ * The iteration index is left at the position following the last extracted character. + * + * @param ut the UText from which to extract data. + * @param nativeStart the native index of the first character to extract.\ + * If the specified index is out of range, + * it will be pinned to be within 0 <= index <= textLength + * @param nativeLimit the native string index of the position following the last + * character to extract. If the specified index is out of range, + * it will be pinned to be within 0 <= index <= textLength. + * nativeLimit must be >= nativeStart. + * @param dest the UChar (UTF-16) buffer into which the extracted text is placed + * @param destCapacity The size, in UChars, of the destination buffer. May be zero + * for precomputing the required size. + * @param status receives any error status. + * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the + * buffer was too small. Returns number of UChars for preflighting. + * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. + * + * @stable ICU 3.4 + */ +U_CAPI int32_t U_EXPORT2 +utext_extract(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + + +U_CDECL_END + + +#endif diff --git a/third_party/icu4c/ndk_headers/unicode/utypes.h b/third_party/icu4c/ndk_headers/unicode/utypes.h index 5f6cac32a0d9dd62a84831d04baa0c2b81bbfb1b..8293ca70e7caafc051c959bd87c1d8b532341dca 100644 --- a/third_party/icu4c/ndk_headers/unicode/utypes.h +++ b/third_party/icu4c/ndk_headers/unicode/utypes.h @@ -637,5 +637,13 @@ typedef enum UErrorCode { # define U_FAILURE(x) ((x)>U_ZERO_ERROR) #endif +/** + * Return a string for a UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum above. + * @stable ICU 2.0 + */ +U_CAPI const char * U_EXPORT2 +u_errorName(UErrorCode code); #endif /* _UTYPES */ diff --git a/third_party/libuv/README.OpenSource b/third_party/libuv/README.OpenSource deleted file mode 100644 index 5b25fcf7ccca5edb1c7775521a1b17ab52d02330..0000000000000000000000000000000000000000 --- a/third_party/libuv/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "libuv", - "License": "MIT License", - "License File": "LICENSE", - "Version Number": "v1.48.0", - "Owner": "sunbingxin@huawei.com", - "Upstream URL": "https://github.com/libuv/libuv", - "Description": "libuv is a multi-platform support library with a focus on asynchronous I/O." - } -] diff --git a/third_party/mindspore/README.OpenSource b/third_party/mindspore/README.OpenSource deleted file mode 100644 index bd6c7775a37b7798f96d0f4a70fc7b263f241c9a..0000000000000000000000000000000000000000 --- a/third_party/mindspore/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "MindSpore", - "License": "Apache License 2.0", - "License File": "LICENSE.txt", - "Version Number": "2.1.0", - "Owner": "chengfeng27@huawei.com", - "Upstream URL": "https://gitee.com/mindspore/mindspore/repository/archive/v2.1.0", - "Description": "MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios." - } -] diff --git a/third_party/mindspore/kits/context.h b/third_party/mindspore/kits/context.h index b6b7f084ff2ce50d8bc04f9ba375f1bccfada337..55c4efaccf2c9317948d1da6c03953d3508a01e9 100644 --- a/third_party/mindspore/kits/context.h +++ b/third_party/mindspore/kits/context.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief 提供MindSpore Lite的模型推理相关接口。 + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file context.h * @kit MindSporeLiteKit - * @brief 提供了Context相关的接口,可以配置运行时信息。 + * @brief Provides **Context** APIs for configuring runtime information. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/data_type.h b/third_party/mindspore/kits/data_type.h index d16a99fc0cf00c0b6669dbf8fb5ef180712fcec6..f6a0f1cadad379a42b58f60f3caaafa0ddc7b1ec 100644 --- a/third_party/mindspore/kits/data_type.h +++ b/third_party/mindspore/kits/data_type.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief 提供MindSpore Lite的模型推理相关接口。 + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file data_type.h * @kit MindSporeLiteKit - * @brief 声明了张量的数据的类型。 + * @brief Declares tensor data types. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/format.h b/third_party/mindspore/kits/format.h index a9ba6a6be5ab934289dc7c4489775ae4a4cd0823..f62482648f9e31c2f238b264fc3054398e97eff8 100644 --- a/third_party/mindspore/kits/format.h +++ b/third_party/mindspore/kits/format.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief 提供MindSpore Lite的模型推理相关接口。 + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file format.h * @kit MindSporeLiteKit - * @brief 提供张量数据的排列格式。 + * @brief Declares tensor data formats. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/model.h b/third_party/mindspore/kits/model.h index 7ac15719ea4220d03468ba6bfa1ec754bca575df..1f597803525c9ec19704ae9e2eea8e442ac616f1 100644 --- a/third_party/mindspore/kits/model.h +++ b/third_party/mindspore/kits/model.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief provide the model reasoning related interfaces of MindSpore Lite. + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file model.h * @kit MindSporeLiteKit - * @brief provide model-related interfaces that can be used for model creation, model reasoning, and more. + * @brief Provides model-related APIs for model creation and inference. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/status.h b/third_party/mindspore/kits/status.h index 65b6eec5f2a49cd2712a06759046808d875a821d..029e08b2d51cc0ab7af1423d59b2caee810a8a5d 100644 --- a/third_party/mindspore/kits/status.h +++ b/third_party/mindspore/kits/status.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief 提供MindSpore Lite的模型推理相关接口。 + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file status.h * @kit MindSporeLiteKit - * @brief 提供了Mindspore Lite运行时的状态码。 + * @brief Provides the status codes of MindSpore Lite. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/tensor.h b/third_party/mindspore/kits/tensor.h index fb4d2b25a68a299ada165db53c26df5cedcf788c..cccd8605ce85bf3c95b5fe8e17b2efe48268754b 100644 --- a/third_party/mindspore/kits/tensor.h +++ b/third_party/mindspore/kits/tensor.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief 提供MindSpore Lite的模型推理相关接口。 + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file tensor.h * @kit MindSporeLiteKit - * @brief 提供了张量相关的接口,可用于创建和修改张量信息。 + * @brief Provides APIs for creating and modifying tensor information. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/mindspore/kits/types.h b/third_party/mindspore/kits/types.h index 8d0b6fd219400557c8e6a729a582474c29f1f4fc..0b3d269653c987e27e7e342521cd6847c47fd919 100644 --- a/third_party/mindspore/kits/types.h +++ b/third_party/mindspore/kits/types.h @@ -18,7 +18,7 @@ * @addtogroup MindSpore * @{ * - * @brief provide the model reasoning related interfaces of MindSpore Lite. + * @brief Provides APIs related to MindSpore Lite model inference. * * @Syscap SystemCapability.Ai.MindSpore * @since 9 @@ -27,7 +27,7 @@ /** * @file types.h * @kit MindSporeLiteKit - * @brief provides the model file types and device types supported by MindSpore Lite. + * @brief Provides the model file types and device types supported by MindSpore Lite. * * @library libmindspore_lite_ndk.so * @since 9 diff --git a/third_party/musl/README.OpenSource b/third_party/musl/README.OpenSource deleted file mode 100644 index ed40042f94204a5c81bd51ed50667f860c54d321..0000000000000000000000000000000000000000 --- a/third_party/musl/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name" : "musl", - "License" : "MIT License", - "License File" : "COPYRIGHT", - "Version Number" : "1.2.5", - "Owner" : "zhaoxinyuan9@huawei.com", - "Upstream URL" : "https://musl.libc.org", - "Description" : "musl is an MIT-licensed implementation of the standard C library" - } -] diff --git a/third_party/musl/ndk_musl_include/info/device_api_version.h b/third_party/musl/ndk_musl_include/info/device_api_version.h index 1708aa441f362186f70de33c8c3fdd4f3927f89d..20f22c0774f9e52d3d29acbf0561d7b893cfddfb 100644 --- a/third_party/musl/ndk_musl_include/info/device_api_version.h +++ b/third_party/musl/ndk_musl_include/info/device_api_version.h @@ -22,7 +22,10 @@ extern "C" { /** * @brief Get the api version number of the device. + * Note: the interface function is not implemented. * @return The api version number of the device. + * @since 12 + * @deprecated since 15 */ int get_device_api_version(void); diff --git a/third_party/musl/ndk_script/BUILD.gn b/third_party/musl/ndk_script/BUILD.gn index a71e33565ab354dd49bfb34bdfa2de31e336bbe8..6001b9347bd3daa03bb0d6c8c56b57734109dc2b 100644 --- a/third_party/musl/ndk_script/BUILD.gn +++ b/third_party/musl/ndk_script/BUILD.gn @@ -14,6 +14,7 @@ import("//build/config/clang/clang.gni") import("//build/ohos/ndk/ndk.gni") +import("//build/version.gni") import("//third_party/musl/musl_config.gni") import("//third_party/musl/musl_src.gni") import("//third_party/musl/musl_template.gni") @@ -21,6 +22,8 @@ import("//third_party/musl/musl_template.gni") musl_target_out_dir = "${root_out_dir}/obj/third_party/musl" ndk_musl_include = "ndk_musl_include" interface_musl_dir = "//interface/sdk_c/third_party/musl" +target_version_dir = "ndk_musl_include/info" +target_version_file = "application_target_sdk_version.h" if (host_os == "mac") { if (host_cpu == "arm64") { @@ -106,6 +109,7 @@ if (host_os == "mac") { "${windows_x86_64_toolchain_dir}/llvm/include", "${windows_x86_64_toolchain_dir}/llvm/lib", "${windows_x86_64_toolchain_dir}/llvm/libexec", + "${windows_x86_64_toolchain_dir}/llvm/python3", "${windows_x86_64_toolchain_dir}/llvm/script", "${windows_x86_64_toolchain_dir}/llvm/share", ] @@ -223,6 +227,15 @@ action("copy_ndk_musl_headers") { deps = [ ":copy_ndk_uapi" ] } +action("updated_version") { + outputs = [ "${musl_target_out_dir}/${target_version_dir}" ] + script = "updated_version.py" + args = [ "-p" ] + [ rebase_path( + "${musl_target_out_dir}/${target_version_dir}/${target_version_file}") ] + args += [ "-v" ] + [ api_version ] + deps = [ ":copy_ndk_musl_headers" ] +} + action("copy_musl_sysroot") { outputs = [ "${ndk_headers_out_dir}" ] script = "copy_musl_sysroot.sh" @@ -230,7 +243,7 @@ action("copy_musl_sysroot") { [ "-i" ] + [ rebase_path("${musl_target_out_dir}/${ndk_musl_include}") ] args += [ "-o" ] + [ rebase_path("${ndk_headers_out_dir}") ] args += [ "-t" ] + [ "${musl_arch}" ] - deps = [ ":copy_ndk_musl_headers" ] + deps = [ ":updated_version" ] } musl_libs_arm32 = [ diff --git a/third_party/musl/ndk_script/toolchain.sh b/third_party/musl/ndk_script/toolchain.sh index 7f90ff69dfbb4c8cb752eb19a562d905fa4dce31..1bdc1baffa44181f65361af650ec98a8c9414a57 100755 --- a/third_party/musl/ndk_script/toolchain.sh +++ b/third_party/musl/ndk_script/toolchain.sh @@ -49,4 +49,14 @@ function strip_dir() { fi done } +function remove_unnecessary_file { + file_list=("bin/llvm-ifs" "bin/llvm-ifs.exe" "lib/clang/current" "lib/arm-liteos-ohos" "lib/loongarch64-linux-ohos" "lib/mipsel-linux-ohos" "lib/riscv64-linux-ohos" "lib/clang/15.0.4/bin/loongarch64-linux-ohos" "lib/clang/15.0.4/lib/arm-liteos-ohos" "lib/clang/15.0.4/lib/i386-unknown-linux-gnu" "lib/clang/15.0.4/lib/loongarch64-linux-ohos" "lib/clang/15.0.4/lib/mipsel-linux-ohos" "lib/clang/15.0.4/lib/riscv64-linux-ohos" "lib/clang/15.0.4/lib/windows") + + for i in "${file_list[@]}"; do + if [ -e "${OUT_DIR}/${i}" ]; then + rm -rf "${OUT_DIR}/${i}" + fi + done +} +remove_unnecessary_file strip_dir ${OUT_DIR}/lib diff --git a/third_party/musl/ndk_script/updated_version.py b/third_party/musl/ndk_script/updated_version.py new file mode 100755 index 0000000000000000000000000000000000000000..3623845279fa0deb813750097d61dbf2b016676c --- /dev/null +++ b/third_party/musl/ndk_script/updated_version.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# 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 argparse + + +# 插入新版宏内容 +def updated_version(file_path: str, new_version: int): + version_define = '#define OH_API_VERSION_' + version_current_define = '#define OH_CURRENT_API_VERSION OH_API_VERSION_' + # 需要插入的内容 + new_content = '' + # 插入的标志位置 + insert_after_line = '#define SDK_VERSION_9 9' + # 旧版本 + old_version = 9 + # 更新需插入的内容 + for i in range(new_version - old_version): + new_content += '{}{} {}\n'.format(version_define, old_version + i + 1, old_version + i + 1) + new_content_tag = '{}{}\n'.format(version_current_define, new_version) + new_content += new_content_tag + + with open(file_path, 'r') as fp: + lines = fp.readlines() + + # 查找插入位置的索引 + insert_position = None + for i, line in enumerate(lines): + if insert_after_line in line: + insert_position = i + 1 # 插入在该行之后 + break + + # 如果找到插入位置 + if (insert_position is not None) and (new_content_tag not in lines): + # 插入新内容 + lines.insert(insert_position, new_content) + # 更新修改后的内容 + with open(file_path, 'w') as fp: + fp.writelines(lines) + elif insert_position is None: + raise Exception('未找到插入位置: {},写入失败'.format(insert_after_line)) + + +# 入口 +def process_target_version(): + try: + parser = argparse.ArgumentParser(description='Updated version') + # 定义命令行参数 + parser.add_argument('-p', '--path', type=str, required=True, help='Path to the input file') + parser.add_argument('-v', '--version', type=str, required=True, help='Version of the api') + args = parser.parse_args() + # 获取文件路径和版本 + input_file = args.path + api_version = int(args.version) + # 写入新版宏内容 + updated_version(input_file, api_version) + except Exception as e: + raise e + + +if __name__ == '__main__': + process_target_version() diff --git a/third_party/node/BUILD.gn b/third_party/node/BUILD.gn index 254f38555d0f37183f6a5736d43a277d625376fc..8429a6bc3b6c7c1cc938cd82912009dfdb45cff3 100644 --- a/third_party/node/BUILD.gn +++ b/third_party/node/BUILD.gn @@ -16,9 +16,9 @@ import("//build/ohos.gni") ohos_ndk_headers("node_header") { dest_dir = "$ndk_headers_out_dir" sources = [ - "//third_party/node/src/js_native_api.h", - "//third_party/node/src/js_native_api_types.h", - "//third_party/node/src/node_api.h", - "//third_party/node/src/node_api_types.h", + "src/js_native_api.h", + "src/js_native_api_types.h", + "src/node_api.h", + "src/node_api_types.h", ] } diff --git a/third_party/node/README.OpenSource b/third_party/node/README.OpenSource deleted file mode 100644 index 28991b992ddac0f9064195e839a956823a9f417d..0000000000000000000000000000000000000000 --- a/third_party/node/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "node", - "License": "ISC License,Public Domain,MIT License,Free Software Foundation - MIT License,Apache License V2.0,ICU License,zlib/libpng License,BSD 2-Clause License,BSD 3-Clause License", - "License File": "LICENSE", - "Version Number": "v18.20.1", - "Owner": "sunbingxin@huawei.com", - "Upstream URL": "http://www.nodejs.org/", - "Description": "Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser." - } -] diff --git a/third_party/node/src/js_native_api_types.h b/third_party/node/src/js_native_api_types.h index 74dc6d148e3d7bffa7dc93dbee271963d812e2fd..464d4983245acc2945f5bdff8ea9552a476c001f 100644 --- a/third_party/node/src/js_native_api_types.h +++ b/third_party/node/src/js_native_api_types.h @@ -93,11 +93,8 @@ typedef enum { napi_arraybuffer_expected, napi_detachable_arraybuffer_expected, napi_would_deadlock, // unused - // Created too many ark runtime environment, up to 16. napi_create_ark_runtime_too_many_envs = 22, - // Only one ark runtime environment can be created per thread. napi_create_ark_runtime_only_one_env_per_thread = 23, - // The ark runtime environment to be destroyed does not exist. napi_destroy_ark_runtime_env_not_exist = 24 } napi_status; // Note: when adding a new enum value to `napi_status`, please also update diff --git a/third_party/node/src/node_api.h b/third_party/node/src/node_api.h index f51d42c310707c4c8496384aa08fa1f6b3705127..79371815e3a02edeeacb712cfcc5f3bf946609e8 100644 --- a/third_party/node/src/node_api.h +++ b/third_party/node/src/node_api.h @@ -14,8 +14,8 @@ /** * @brief Struct declaration used in the napi_get_uv_event_loop interface - * @deprecated since 12 - * @since since 8 + * @deprecated since 16 + * @since 8 */ struct uv_loop_s; // Forward declaration. @@ -190,8 +190,8 @@ napi_status napi_get_node_version(napi_env env, * @param env The environment that the API is invoked under. * @param loop The current libuv loop instance. * @return A napi_status value is returned, which is used to check whether the UV is successfully obtained. - * @deprecated since 12 - * @since since 8 + * @deprecated since 16 + * @since 8 */ NAPI_EXTERN napi_status napi_get_uv_event_loop(napi_env env, struct uv_loop_s** loop); diff --git a/third_party/openGLES/README.OpenSource b/third_party/openGLES/README.OpenSource deleted file mode 100644 index 82565035b4e93797b8a7b3a93c62e1692f11eb5a..0000000000000000000000000000000000000000 --- a/third_party/openGLES/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "openGLES", - "License": "Apache-2.0", - "License File": "NOTICE", - "Version Number": "63161d674db04a96635c6ab300db793e83f6762c", - "Owner": "lizheng2@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/OpenGL-Registry.git", - "Description": "The OpenGL ES registry contains specifications of the core API and shading language; specifications of Khronos- and vendor-approved OpenGL ES extensions; header files corresponding to the specificatio" - } -] diff --git a/third_party/openSLES/README.OpenSource b/third_party/openSLES/README.OpenSource deleted file mode 100644 index 2eda1e4fdac76f25a768837cd831a5bb01ea1cb9..0000000000000000000000000000000000000000 --- a/third_party/openSLES/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "Khronos Group - OpenSL ES", - "License": "null", - "License File": "NOTICE", - "Version Number": "1.0.1", - "Owner": "yangshuai67@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/OpenSL-ES-Registry.git", - "Description": "OpenSL ES™ is a royalty-free, cross-platform, hardware-accelerated audio API tuned for embedded systems." - } -] \ No newline at end of file diff --git a/third_party/vulkan-headers/README.OpenSource b/third_party/vulkan-headers/README.OpenSource deleted file mode 100644 index 97fefa261c1dd7c1ae2b76a35e97e2ee8a5ae61e..0000000000000000000000000000000000000000 --- a/third_party/vulkan-headers/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name": "Vulkan", - "License": "Apache-2.0", - "License File": "LICENSE", - "Version Number": "v1.3.275", - "Owner": "mengzhaobing@huawei.com", - "Upstream URL": "https://github.com/KhronosGroup/Vulkan-Headers.git", - "Description": "Vulkan header files and API registry" - } -] diff --git a/third_party/zlib/README.OpenSource b/third_party/zlib/README.OpenSource deleted file mode 100644 index e3a0accc9f3c2b0bb46cc67944abe7b34c25ee78..0000000000000000000000000000000000000000 --- a/third_party/zlib/README.OpenSource +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "Name" : "zlib", - "License" : "zlib/libpng License", - "License File" : "LICENSE", - "Version Number" : "v1.3.1", - "Owner" : "gongjunsong@huawei.com", - "Upstream URL" : "https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz", - "Description" : "zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files" - } -] diff --git a/web/webview/interfaces/native/arkweb_error_code.h b/web/webview/interfaces/native/arkweb_error_code.h index a445de2c717c0e35ae1df73fd6cf6f26a6be6514..4caab8f5df045eb1f12b84c9ab4a79b45c722548 100644 --- a/web/webview/interfaces/native/arkweb_error_code.h +++ b/web/webview/interfaces/native/arkweb_error_code.h @@ -53,6 +53,23 @@ ARKWEB_INVALID_URL = 17100103, /** @error Invalid cookie value. */ ARKWEB_INVALID_COOKIE_VALUE = 17100104, + +/* + * @brief Failed to open the library. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 15 + */ +ARKWEB_LIBRARY_OPEN_FAILURE = 17100105, + +/* + * @brief The required symbol was not found in the library. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 15 + */ +ARKWEB_LIBRARY_SYMBOL_NOT_FOUND = 17100106, } ArkWeb_ErrorCode; #endif // ARKWEB_ERROR_CODE_H +/** @} */ diff --git a/web/webview/interfaces/native/arkweb_interface.h b/web/webview/interfaces/native/arkweb_interface.h index b610729ed5c308d1ff263f45f6450d904a34b766..f6c1ea37b23e728d29c120ede08f548dc1f50108 100644 --- a/web/webview/interfaces/native/arkweb_interface.h +++ b/web/webview/interfaces/native/arkweb_interface.h @@ -65,9 +65,15 @@ typedef enum { ARKWEB_NATIVE_WEB_MESSAGE, /** API type related to ArkWeb cookie manager. */ ARKWEB_NATIVE_COOKIE_MANAGER, + /** + * @brief API type related to ArkWeb JavaScript value. + * + * @since 18 + */ + ARKWEB_NATIVE_JAVASCRIPT_VALUE, } ArkWeb_NativeAPIVariantKind; -/* +/** * @brief Obtains the native API set of a specified type. * @param type Indicates the type of the native API set provided by ArkWeb. * @return Return the pointer to the native API abstract object that carries the size. @@ -78,7 +84,22 @@ typedef enum { */ ArkWeb_AnyNativeAPI* OH_ArkWeb_GetNativeAPI(ArkWeb_NativeAPIVariantKind type); + +/* + * @brief Register a scrolling event callback. + * @param webTag The name of the web component. + * @param callback The ArkWeb scrolling callback. + * @param userData The data set by user. + * @return Returns whether the registration was successful, false indicates failure. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 18 + */ +bool OH_ArkWeb_RegisterScrollCallback( + const char* webTag, ArkWeb_OnScrollCallback callback, void* userData); + #ifdef __cplusplus }; #endif -#endif // ARKWEB_INTERFACE_H \ No newline at end of file +#endif // ARKWEB_INTERFACE_H +/** @} */ \ No newline at end of file diff --git a/web/webview/interfaces/native/arkweb_net_error_list.h b/web/webview/interfaces/native/arkweb_net_error_list.h index 4a579c45eee3adbf6f1c000000759bbc02c44000..feabf1440c64fa2c15eca875a9df63d555a69c0d 100644 --- a/web/webview/interfaces/native/arkweb_net_error_list.h +++ b/web/webview/interfaces/native/arkweb_net_error_list.h @@ -1402,3 +1402,4 @@ typedef enum ArkWeb_NetError { } ArkWeb_NetError; #endif // ARKWEB_NET_ERROR_LIST_H +/** @} */ diff --git a/web/webview/interfaces/native/arkweb_scheme_handler.h b/web/webview/interfaces/native/arkweb_scheme_handler.h index 4ab4b8b94be74d5abb1edaabca4c68a04d24e834..d88272e7e8e630d3f02f493c1dc4af4af1e06d58 100644 --- a/web/webview/interfaces/native/arkweb_scheme_handler.h +++ b/web/webview/interfaces/native/arkweb_scheme_handler.h @@ -672,7 +672,7 @@ void OH_ArkWeb_CreateSchemeHandler(ArkWeb_SchemeHandler** schemeHandler); /** * @brief Destroy a SchemeHandler. - * @param The ArkWeb_SchemeHandler to be destroy. + * @param schemeHandler The ArkWeb_SchemeHandler to be destroy. * * @syscap SystemCapability.Web.Webview.Core * @since 12 @@ -995,3 +995,4 @@ void OH_ArkWeb_ReleaseByteArray(uint8_t* byteArray); }; #endif #endif // ARKWEB_SCHEME_HANDLER_H +/** @} */ diff --git a/web/webview/interfaces/native/arkweb_type.h b/web/webview/interfaces/native/arkweb_type.h index d626371eb13fe4cc6ea18cb9e3700e7add4d21c6..b8b65f4fa6a770f52b4de394b69672a3b9f06000 100644 --- a/web/webview/interfaces/native/arkweb_type.h +++ b/web/webview/interfaces/native/arkweb_type.h @@ -68,6 +68,20 @@ typedef enum ArkWeb_WebMessageType { ARKWEB_BUFFER } ArkWeb_WebMessageType; +/** + * @brief Defines the data type carried in a ArkWeb_JavaScriptValue. + * + * @since 18 + */ +typedef enum ArkWeb_JavaScriptValueType { + /** Represent error data */ + ARKWEB_JAVASCRIPT_NONE = 0, + /** The data carried in the ArkWeb_JavaScriptValue is string. */ + ARKWEB_JAVASCRIPT_STRING, + /** The data carried in the ArkWeb_JavaScriptValue is bool. */ + ARKWEB_JAVASCRIPT_BOOL +} ArkWeb_JavaScriptValueType; + /** * @brief Defines the ArkWeb_WebMessage. * @@ -75,6 +89,13 @@ typedef enum ArkWeb_WebMessageType { */ typedef struct ArkWeb_WebMessage* ArkWeb_WebMessagePtr; +/** + * @brief Defines the ArkWeb_JavaScriptValuePtr. + * + * @since 18 + */ +typedef struct ArkWeb_JavaScriptValue* ArkWeb_JavaScriptValuePtr; + /** * @brief Defines the javascript callback of the native ArkWeb. * @@ -91,6 +112,19 @@ typedef void (*ArkWeb_OnJavaScriptCallback)( typedef void (*ArkWeb_OnJavaScriptProxyCallback)( const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData); +/** + * @brief Defines the JavaScript proxy callback of the native ArkWeb. + * + * @param webTag The name of the web component. + * @param dataArray The JavaScript bridge data array from HTML. + * @param arraySize The number of elements in the array. + * @param userData The data set by user. + * + * @since 18 + */ +typedef ArkWeb_JavaScriptValuePtr (*ArkWeb_OnJavaScriptProxyCallbackWithResult)( + const char* webTag, const ArkWeb_JavaScriptBridgeData* dataArray, size_t arraySize, void* userData); + /** * @brief Defines the component callback of the native ArkWeb. * @@ -98,6 +132,18 @@ typedef void (*ArkWeb_OnJavaScriptProxyCallback)( */ typedef void (*ArkWeb_OnComponentCallback)(const char* webTag, void* userData); +/** + * @brief Defines the scroll callback of the native ArkWeb. + * + * @param webTag The name of the web component. + * @param userData The data set by user. + * @param x X-axis scrolling offset. + * @param y Y-axis scrolling offset. + * + * @since 18 + */ +typedef void (*ArkWeb_OnScrollCallback)(const char* webTag, void* userData, double x, double y); + /** * @brief Defines the ArkWeb_WebMessagePort that represent a HTML5 message port. * @@ -148,6 +194,20 @@ typedef struct { void* userData; } ArkWeb_ProxyMethod; +/** + * @brief Defines the JavaScript proxy method with a return value. + * + * @since 18 + */ +typedef struct { + /** The method of the application side JavaScript object participating in the registration. */ + const char* methodName; + /** The callback function with a return value registered by developer is called back when HTML side uses. */ + ArkWeb_OnJavaScriptProxyCallbackWithResult callback; + /** The user data to set. */ + void* userData; +} ArkWeb_ProxyMethodWithResult; + /** * @brief Defines the javascript proxy registered object. * @@ -162,6 +222,20 @@ typedef struct { size_t size; } ArkWeb_ProxyObject; +/** + * @brief Defines the JavaScript proxy registered object with methodList that has a return value. + * + * @since 18 + */ +typedef struct { + /** The name of the registered object. */ + const char* objName; + /** The JavaScript proxy registered method object list with a callback function that has a return value */ + const ArkWeb_ProxyMethodWithResult* methodList; + /** The size of the methodList. */ + size_t size; +} ArkWeb_ProxyObjectWithResult; + /** * @brief Defines the controller API for native ArkWeb. * Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check @@ -214,6 +288,41 @@ typedef struct { */ ArkWeb_ErrorCode (*postWebMessage)( const char* webTag, const char* name, ArkWeb_WebMessagePortPtr* webMessagePorts, size_t size, const char* url); + + /** + * @brief Get the url of the last frame that calls the JavaScriptProxy. + * This should be call on the thread which JavaScriptProxy called. + * + * @return The url of the last frame that calls the JavaScriptProxy. + * @since 14 + */ + const char* (*getLastJavascriptProxyCallingFrameUrl)(); + + /** + * @brief Register the JavaScript object and method list, the method is callback function that has a return value. + * + * @param webTag The name of the web component. + * @param proxyObject The JavaScript object to register, the object has callback functions with return value. + * @param permission The JSON string, which defaults to null, is used to configure the permission control for + * JSBridge, allowing for the definition of URL whitelists at the object and method levels. + * + * @since 18 + */ + void (*registerJavaScriptProxyEx)(const char* webTag, const ArkWeb_ProxyObjectWithResult* proxyObject, + const char* permission); + + /** + * @brief Register the JavaScript object and async method list. + * + * @param webTag The name of the web component. + * @param proxyObject The JavaScript object to register. + * @param permission The JSON string, which defaults to null, is used to configure the permission control + * for JSBridge, allowing for the definition of URL whitelists at the object and method levels. + * + * @since 18 + */ + void (*registerAsyncJavaScriptProxyEx)(const char* webTag, const ArkWeb_ProxyObject* proxyObject, + const char* permission); } ArkWeb_ControllerAPI; /** @@ -344,7 +453,7 @@ typedef struct { typedef struct { /** The ArkWeb_CookieManagerAPI struct size. */ size_t size; - + /** * @brief Obtains the cookie value corresponding to a specified URL. * @@ -399,6 +508,30 @@ typedef struct { void (*clearSessionCookiesSync)(); } ArkWeb_CookieManagerAPI; +/** + * @brief Defines the native JavaScriptValue API for ArkWeb. + * Before invoking an API, you are advised to use ARKWEB_MEMBER_MISSING to check + * whether the function structure has a corresponding function pointer to avoid crash + * caused by mismatch between the SDK and the device ROM. + * + * @since 18 + */ +typedef struct { + /** The ArkWeb_JavaScriptValueAPI struct size. */ + size_t size; + + /** + * @brief Create the JavaScript value responding to HTML. + * + * @param type The type of ArkWeb_JavaScriptValue. + * @param data The data buffer of ArkWeb_JavaScriptValue. + * @param dataLength The length of data buffer. + * @return ArkWeb_JavaScriptValuePtr created by ArkWeb, the memory of ArkWeb_JavaScriptValue + * is managed by ArkWeb itself. + */ + ArkWeb_JavaScriptValuePtr (*createJavaScriptValue)(ArkWeb_JavaScriptValueType type, void* data, size_t dataLength); +} ArkWeb_JavaScriptValueAPI; + /** * @brief Check whether the member variables of the current struct exist. * @@ -417,4 +550,5 @@ typedef struct { #ifdef __cplusplus } #endif -#endif // ARKWEB_TYPE_H \ No newline at end of file +#endif // ARKWEB_TYPE_H +/** @} */ \ No newline at end of file diff --git a/web/webview/interfaces/native/libohweb.ndk.json b/web/webview/interfaces/native/libohweb.ndk.json index a92438ec859e9a67ab90686dbbeb52e44fe24ba3..4981b04a45e2d152ae6c0f77f133a157153c29d4 100644 --- a/web/webview/interfaces/native/libohweb.ndk.json +++ b/web/webview/interfaces/native/libohweb.ndk.json @@ -314,5 +314,13 @@ { "first_introduced": "12", "name": "OH_ArkWeb_GetNativeAPI" + }, + { + "first_introduced": "15", + "name": "OH_NativeArkWeb_LoadData" + }, + { + "first_introduced": "18", + "name": "OH_ArkWeb_RegisterScrollCallback" } ] diff --git a/web/webview/interfaces/native/native_interface_arkweb.h b/web/webview/interfaces/native/native_interface_arkweb.h index 48c114fce6b90828b892c8484f0bd84cc1d23b91..9f81279887649f751ae01cf250526640b5f368c4 100644 --- a/web/webview/interfaces/native/native_interface_arkweb.h +++ b/web/webview/interfaces/native/native_interface_arkweb.h @@ -35,6 +35,8 @@ #include #include +#include "arkweb_error_code.h" + #ifdef __cplusplus extern "C" { #endif @@ -129,7 +131,7 @@ void OH_NativeArkWeb_SetJavaScriptProxyValidCallback(const char* webTag, NativeA */ NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback(const char* webTag); -/* +/** * @brief Registers the destroy callback. * * @param webTag The name of the web component. @@ -140,7 +142,7 @@ NativeArkWeb_OnValidCallback OH_NativeArkWeb_GetJavaScriptProxyValidCallback(con */ void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestroyCallback callback); -/* +/** * @brief Get the destroy callback. * * @param webTag The name of the web component. @@ -153,7 +155,38 @@ void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestr */ NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback(const char* webTag); +/** + * @brief Loads the data or URL. + * This function should be called on main thread. + * + * @param webTag The name of the web component. + * @param data A string encoded according to "Base64" or "URL", should not be NULL. + * @param mimeType Media type. For example: "text/html", should not be NULL. + * @param encoding Encoding type. For example: "UTF-8", should not be NULL. + * @param baseUrl A specified URL path ("http"/"https"/"data" protocol), + * which is assigned to window.origin by the Web component. + * @param historyUrl History URL. When it is not empty, it can be managed by + * history records to realize the back and forth function. + * @return LoadData result code. + * {@link ARKWEB_SUCCESS} load data success. + * {@link ARKWEB_INVALID_PARAM} Mandatory parameters are left unspecified or + * Incorrect parameter types or Parameter verification failed. + * {@link ARKWEB_INIT_ERROR} Initialization error, can't get a valid Web for the webTag. + * {@link ARKWEB_LIBRARY_OPEN_FAILURE} Failed to open the library. + * {@link ARKWEB_LIBRARY_SYMBOL_NOT_FOUND} The required symbol was not found in the library. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 15 + */ +ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag, + const char* data, + const char* mimeType, + const char* encoding, + const char* baseUrl, + const char* historyUrl); + #ifdef __cplusplus }; #endif -#endif // NATIVE_INTERFACE_ARKWEB_H \ No newline at end of file +#endif // NATIVE_INTERFACE_ARKWEB_H +/** @} */ \ No newline at end of file